A2a task lifecycle

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

A2a task lifecycle is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement A2A task lifecycle management — task creation, state transitions, terminal states, history, and artifacts. Use when building task state machines, handling state transitions, or managing task persistence.

How to use this skill

Skill file

A2A Task Lifecycle

Before writing code

Fetch live docs:

  1. Fetch https://a2a-protocol.org/latest/specification/ for the Task object schema and state machine
  2. Web-search site:github.com a2aproject A2A task lifecycle states for state transition rules
  3. Web-search site:github.com a2aproject a2a-samples task for task handling examples
  4. Fetch SDK docs for task-related classes and state management utilities

Conceptual Architecture

What a Task Is

A Task is the central unit of work in A2A. It represents a request from a client agent to a server agent, tracks progress through well-defined states, accumulates messages and artifacts, and reaches a terminal state when complete.

Task Structure

Key fields of a Task object:

The 9 States

| State | Terminal? | Description |

|-------|-----------|-------------|

| submitted | No | Task received, queued for processing |

| working | No | Agent actively processing |

| input-required | No | Agent needs more input (multi-turn) |

| auth-required | No | Authentication needed |

| completed | Yes | Task finished successfully |

| failed | Yes | Task encountered an unrecoverable error |

| canceled | Yes | Task was canceled |

| rejected | Yes | Server refused the task |

| unknown | — | Default/unknown state |

Valid State Transitions

submitted → working
submitted → rejected
submitted → canceled

working → completed
working → failed
working → canceled
working → input-required

input-required → working (when client provides more input)
input-required → canceled

auth-required → working (when auth is provided)
auth-required → canceled

Rules:

Task Creation

Tasks are created implicitly when a client sends a message without a taskId:

  1. Client sends message/send or message/stream without taskId
  2. Server creates a new task, assigns an ID
  3. Task starts in submitted state
  4. Server may immediately transition to working or return submitted

Task Continuation

When a client sends a message with an existing taskId:

  1. The message is appended to the task's history
  2. The server resumes processing
  3. State typically transitions from input-required back to working

Artifacts

Artifacts are the outputs of a task:

State Transition History

If the agent declares stateTransitionHistory: true in its Agent Card:

Best Practices

Fetch the specification for the exact Task object schema, state enum values, and transition validation rules before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.