> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xpander.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# get

> Load a single task by ID.

`Tasks.aget` loads a full `Task` object: input, status, result, token usage, deep-planning state, attached files, and everything else stored against the task record.

```python theme={"dark"}
from xpander_sdk import Tasks

tasks = Tasks()
task = await tasks.aget(task_id="task_xyz")
print(task.status.value, task.result)
```

### Parameters

| Parameter | Type  | Required | Description |
| --------- | ----- | -------- | ----------- |
| `task_id` | `str` | Yes      | Task ID.    |

### Returns `Task`

A full `Task`. See the [`Task` class reference](/developers/sdk-reference/tasks/task) for attributes.

## Examples

### Wait for completion

```python theme={"dark"}
import asyncio
from xpander_sdk import AgentExecutionStatus

terminal = {
    AgentExecutionStatus.Completed,
    AgentExecutionStatus.Failed,
    AgentExecutionStatus.Error,
    AgentExecutionStatus.Stopped,
}

while True:
    task = await tasks.aget(task_id=task.id)
    if task.status in terminal:
        break
    await asyncio.sleep(2)

print(task.result)
```

For finer-grained progress, use `task.aevents()` instead: see [streaming events](/developers/sdk-reference/tasks/events).

### Reload an existing instance

If you already have a `Task` instance and want fresh data, prefer `task.areload()` over a fresh `aget`: it preserves any in-flight `deep_planning` state that the API might briefly return as empty:

```python theme={"dark"}
await task.areload()
```

### Sync version

```python theme={"dark"}
task = tasks.get(task_id="task_xyz")
```

## Errors

Raises [`ModuleException`](/developers/sdk-reference/error-handling) on failure. Common statuses:

| Status | Cause                                       |
| ------ | ------------------------------------------- |
| 404    | Task doesn't exist (or wrong organization). |
| 403    | Task exists but isn't accessible.           |
| 500    | Server error.                               |
