Worked example: Google A2A

This walkthrough shows how to pass a plan from a Planner agent to a Coder agent via Attach Gateway, using:

  • Google’s A2A task protocol (/a2a/tasks/send + /status/{id})

  • Attach Gateway’s X‑Attach‑* headers

  • Weaviate as the shared memory store

The same pattern applies to any engine (vLLM, llama.cpp, commercial APIs).


0 · What A2A expects

Endpoint
Purpose
Typical caller

POST /a2a/tasks/send

Submit a task & choose target agent

UI → Gateway

GET /a2a/tasks/status/{task_id}

Poll until state:"done"

UI → Gateway

Attach Gateway forwards both calls to the chosen agent, adds the Attach headers, and records every hop in Weaviate.


1 · Planner → Coder flow (with memory)

sequenceDiagram
    participant UI   as Browser
    participant GW   as Attach Gateway
    participant PL   as Planner Agent
    participant CD   as Coder Agent
    participant WV   as Weaviate

    UI ->> GW: POST /a2a/tasks/send { messages:[…], target:"planner" }
    Note right of UI: Authorization: Bearer JWT
    GW ->> PL: same body + X‑Attach‑User / Session
    PL ->> WV: MemoryEvent(role=planner, content=plan)
    PL -->> GW: { mem_id:123, plan:"…" }
    GW ->> CD: POST /a2a/tasks/send { mem_id:123, … }
    CD ->> WV: fetch plan 123
    CD ->> WV: MemoryEvent(role=coder, content=answer)
    CD -->> GW: TaskStatus(state="done", result=answer)
    GW -->> UI: state="done"

2 · Skeleton agents

Planner – saves a plan, returns mem_id

Coder – receives mem_id, fetches plan, prepends it


3 · Smoke‑test locally


4 · cURL only


5 · What Attach handles vs. what you write

Layer
Provided by attach‑gateway
You supply

JWT verification & /a2a routing

✔︎

Memory utils (write_plan, fetch_doc)

✔︎

Agent FastAPI skeletons

Examples

Prompts / business logic

Demo UI

Optional

Swap in any engine (vLLM, llama.cpp, OpenAI, etc.) and you still get SSO + memory + hand‑off out‑of‑the‑box.

Last updated