Tasks & States
Tasks track the lifecycle of agent operations.
Task Structure
| Field | Type | Description |
|---|---|---|
id | string | Unique task identifier |
state | string | Current task state |
artifacts | array | Output artifacts (optional) |
history | array | State transition history (optional) |
Task States
| State | Description |
|---|---|
submitted | Task received but not started |
working | Task is being processed |
input-required | Agent needs more input from the user |
completed | Task finished successfully |
failed | Task encountered an error |
canceled | Task was canceled |
unknown | State cannot be determined |
State Transitions
submitted → working → completed
→ failed
→ input-required → working
→ canceled
submitted → canceled
Task Operations
Get Task Status
{
"jsonrpc": "2.0",
"method": "tasks/get",
"id": "1",
"params": { "id": "task-uuid" }
}
Cancel Task
{
"jsonrpc": "2.0",
"method": "tasks/cancel",
"id": "1",
"params": { "id": "task-uuid" }
}
Artifacts
Completed tasks may return artifacts:
{
"id": "task-uuid",
"state": "completed",
"artifacts": [
{
"artifactId": "result-1",
"name": "result",
"parts": [
{ "kind": "text", "text": "Here is the result..." }
]
}
]
}