Get Task
Task API
Get Task
Get details of a specific task
GET
Get Task
Get Task
Retrieve the details and current status of a specific task, including accumulated output and any pending tool approvals.Request
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique task identifier |
Response
Running Task with Pending Approvals
When a task requires tool approval, the response includes apendingApprovals array:
Completed Task
When a task is completed,output contains the final response:
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique task identifier |
apiKeyId | string | ID of the API key used to create the task |
username | string | Username associated with the API key |
sessionId | string | ID of the agent session |
conversationId | string | ID of the conversation for history |
status | string | Current task status |
message | string | Original task message |
systemPrompt | string | null | Custom system prompt if provided |
showInHistory | boolean | Whether task appears in conversation history |
autoExecute | boolean | Whether tools auto-execute |
env | object | null | Non-sensitive env vars provided at creation |
error | string | null | Error message if task failed |
createdAt | string | ISO timestamp when task was created |
startedAt | string | null | ISO timestamp when execution started |
completedAt | string | null | ISO timestamp when task completed |
output | object | undefined | Accumulated output (present for running and completed tasks) |
pendingApprovals | array | undefined | Tool calls awaiting approval (present when non-empty) |
Output Object
Theoutput field provides a unified view of the task’s response, whether the task is still running or has completed. Use the status field to determine if the content is partial (running) or final (completed/failed/cancelled).
| Field | Type | Description |
|---|---|---|
content | string | Accumulated text response (partial while running, final when completed) |
updatedAt | string | ISO timestamp when the output was last updated |
thoughts | array | undefined | Agent’s thinking process entries |
toolCalls | array | undefined | Tool executions with their current status |
Tool Call Structure
Each entry intoolCalls has the following structure:
| Field | Type | Description |
|---|---|---|
callId | string | Unique identifier for the tool call |
toolName | string | Name of the tool being executed |
status | string | Tool execution status |
args | object | Arguments passed to the tool |
output | string | Tool output (when completed) |
description | string | Human-readable description of the tool call |
| Status | Description |
|---|---|
pending | Tool call queued, not yet started |
awaiting_approval | Waiting for user approval |
executing | Currently running |
success | Completed successfully |
error | Failed with an error |
cancelled | User cancelled the call |
Task Status Values
| Status | Description |
|---|---|
pending | Task created, not yet started |
running | Task is currently executing |
awaiting_approval | Waiting for tool call approval |
completed | Task finished successfully |
failed | Task failed with an error |
cancelled | Task was cancelled |
Use
output.updatedAt to track when content was last accumulated. This is useful for detecting changes when polling.Examples
Use Cases
Polling for Progress
Use theoutput field to show real-time progress without maintaining an SSE connection:
Polling for Completion (Simple)
If you only need to check final task status:Checking for Pending Approvals
ThependingApprovals array provides a convenient way to discover tool calls awaiting approval without an active SSE connection:
Pending Approval Object
| Field | Type | Description |
|---|---|---|
callId | string | Tool call ID (use with the approve endpoint) |
toolName | string | Name of the tool awaiting approval |
args | object | Arguments that will be passed to the tool |
Errors
| Code | Description |
|---|---|
AUTH_REQUIRED | No authentication provided |
INVALID_API_KEY | Invalid or expired API key |
NOT_FOUND | Task with the specified ID was not found |