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
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.tasks/cancel — Cancel a Task
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/sendormessage/streamis 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 bycontextId for multi-turn conversations:
Error Handling
Common error codes returned by task management methods:
Error Response Format:
Best Practices
Task State Monitoring
Task State Monitoring
Always check task state before assuming completion. Tasks can fail or require input.
Context Management
Context Management
Use context IDs to group related tasks and maintain conversation history.
Cleanup
Cleanup
Cancel unnecessary tasks to free resources and avoid confusion.
Error Handling
Error Handling
Handle JSON-RPC errors and HTTP errors gracefully.
Related
A2A Protocol
Server setup and configuration
Handoffs
Multi-agent communication patterns

