Skip to main content

A2A Task Lifecycle — A2A Protocol & Google ADK

[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4
SEQ. 5

A2A Task Lifecycle

🌐 A2A Protocol & Google ADK⏱ 10 min⭐ 100 BASE XP⌨ HANDS-ON LAB

How Tasks Flow Between Agents

In A2A, work is organized around Tasks - structured units of work that flow between a Client Agent and a Remote Agent.

Task State Machine

┌───────────┐     ┌───────────┐     ┌───────────┐
│ submitted │────▶│  working  │────▶│ completed │
└───────────┘     └─────┬─────┘     └───────────┘
                        │
                  ┌─────▼──────────┐
                  │ input-required │ (needs input from client)
                  └─────┬──────────┘
                        │
                  ┌─────▼─────────────┐
                  │ failed / canceled │
                  └───────────────────┘

Task Lifecycle Example

// 1. Client creates a task (JSON-RPC message/send or tasks/send)
POST /a2a
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "message/send",
  "params": {
    "message": {
      "role": "user",
      "parts": [{ "kind": "text", "text": "Book a flight from London to New York on 2026-05-15" }]
    }
  }
}

// 2. Remote agent processes and responds
{
  "taskId": "task_abc123",
  "status": { "state": "working" },
  "updates": [
    { "type": "status", "message": "Searching 5 airlines..." },
    { "type": "status", "message": "Found 12 flights" }
  ]
}

// 3. Agent might need clarification (input-required)
{
  "status": { "state": "input-required" },
  "question": "Do you prefer direct flights only or include layovers?",
  "options": ["direct_only", "include_layovers"]
}

// 4. Client responds, agent completes
{
  "status": { "state": "completed" },
  "artifacts": [{
    "flight": "BA177",
    "price": "$542",
    "departure": "09:15"
  }]
}

Key A2A Interaction Patterns

PatternDescriptionUse Case
Fire-and-ForgetSubmit task, don't waitBackground processing, batch jobs
Request-ResponseSubmit task, wait for resultSimple delegation (booking, search)
StreamingReceive real-time updatesResearch, long-running analysis
NegotiationPropose → Counter → AcceptPrice negotiation, scheduling
🎯 Pro Tip: Always implement the input-required state. Real-world tasks frequently need clarification. An agent that can ask for input mid-task is far more useful than one that guesses and fails.
⌨ HANDS-ON LABMonitor A2A Task State Transitions
⭐ +150 XP

Track an A2A task through its formal lifecycle: Submitted -> Working -> Completed with progress telemetry.

1Monitor A2A task lifecycle telemetry.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
What happens when an A2A task enters the 'input-required' state?
The task is cancelled
The remote agent needs input or clarification from the client before it can continue
The server crashes
The task retries automatically