Skip to main content
Tasks are the core unit of work in the A2A protocol, managing the complete lifecycle from submission to completion with built-in state tracking and storage. The user asks for task status; the agent calls A2A JSON-RPC to list or cancel remote tasks.

How It Works

Quick Start

1

Send Message (Creates Task)

2

Get Task Status

3

Cancel Task


Task Lifecycle

Every A2A interaction creates a Task that progresses through defined states:

Task States

Python Task States


Task Structure

A task contains all information about an A2A interaction:

Task Fields


JSON-RPC Methods

tasks/get — Retrieve a Task

Response:
Task not found:

tasks/list — List Tasks

The tasks/list method is available in the task store but not yet exposed via JSON-RPC. This method is planned for future implementation.
The task store supports listing tasks with optional context filtering:
Planned JSON-RPC Interface:

tasks/cancel — Cancel a Task

Response:

Python Client Implementation

A high-level A2AClient class is planned for future releases. Currently, use direct HTTP calls with aiohttp or requests.

Task Store

The A2A server maintains an in-memory task store that tracks all tasks:
  • Tasks are automatically created when message/send or message/stream is called
  • Each task gets a unique UUID
  • Tasks within the same conversation share a contextId
  • Task history includes both user messages and agent responses
  • Artifacts contain the agent’s output
  • Store is per-server-instance and does not persist across restarts

Context-Based Conversations

Tasks can be grouped by contextId for multi-turn conversations:

Error Handling

Common error codes returned by task management methods: Error Response Format:

Best Practices

Always check task state before assuming completion. Tasks can fail or require input.
Use context IDs to group related tasks and maintain conversation history.
Cancel unnecessary tasks to free resources and avoid confusion.
Handle JSON-RPC errors and HTTP errors gracefully.

A2A Protocol

Server setup and configuration

Handoffs

Multi-agent communication patterns