FerriteDocs

Agent Cards and A2A

Publish an A2A v0.3.0 Agent Card at /.well-known/agent-card.json and serve JSON-RPC agent-to-agent tasks at POST /a2a from your Surface or Agent SDK application.

The Agent-to-Agent (A2A) protocol lets one autonomous agent discover another agent’s capabilities and delegate work over JSON-RPC. On Ferrite, the agent-ready package projects an A2A v0.3.0 Agent Card at GET /.well-known/agent-card.json and answers JSON-RPC requests at POST /a2a directly from your declared Surface operations, routing skill calls into the exact same domain handlers that serve your HTTP and MCP routes. Applications built with the Agent SDK can also expose an A2A face directly over their embedded agent loop.

Publish the Agent Card and /a2a endpoint

Install agent-ready and dispatch requests through agent_ready::well_known::handle_h (or mount agent_ready::a2a_face directly when supplying a durable TaskStore):

ferrite add agent-ready

Every Operation declared in your Surface appears as a skill in GET /.well-known/agent-card.json with preferredTransport: "JSONRPC" and url pointing to https://<your-host>/a2a.

A remote agent invokes one of your declared skills by sending a message/send JSON-RPC request containing a data part:

{
  "jsonrpc": "2.0",
  "id": "req-1",
  "method": "message/send",
  "params": {
    "message": {
      "role": "user",
      "messageId": "msg-1",
      "parts": [
        {
          "kind": "data",
          "data": {
            "skill": "get_quote",
            "arguments": { "tag": "systems" }
          }
        }
      ]
    }
  }
}

If a caller sends a message without a data part naming a skill, the face responds with the list of available skills and the expected invocation shape (or leaves the task in input-required when a TaskStore is configured).

Stateless mode vs durable TaskStore mode

agent_ready::a2a_face supports two execution modes depending on whether your application needs multi-turn task inspection and cancellation:

  • Stateless mode (a2a_face::handle / NoTasks). message/send executes the skill and answers immediately with an agent Message. Calling tasks/get or tasks/cancel returns A2A TaskNotFoundError (-32001). This is the default when wired through well_known::handle_h.
  • Durable task mode (a2a_face::handle_with + TaskStore). Every message/send creates or continues a stored Task that the caller can inspect via tasks/get and cancel via tasks/cancel. Each save uses compare-and-set on the loaded version so a concurrent cancel cannot silently overwrite a completion. If a process stops while a task is working, load_reconciled reconciles expired claim leases (default DEFAULT_LEASE_MS = 60_000 ms) to failed so replays read the recorded failure instead of executing the skill twice.

Security and caller isolation

  • Bind TaskStore keys to the authenticated caller. Your TaskStore implementation must namespace every task ID under the verified caller identity before passing the store to a2a_face::handle_with. One caller attempting to read, continue, or cancel another caller’s taskId receives TaskNotFoundError (-32001).
  • Share authorization across HTTP, MCP, and A2A. Skill execution calls your application’s own handler closure. Enforce the same bearer-token, tenant, role, and ownership checks inside that handler so A2A never bypasses rules applied to browser or MCP requests.
  • No implicit notifications. A2A defines no client notifications; a JSON-RPC request without an id still receives a response with id: null.

Protocol limits and unsupported features

The A2A face advertises its capabilities accurately on the Agent Card and returns typed A2A JSON-RPC errors for unsupported operations:

BoundaryBehavior
Protocol versionA2A 0.3.0 (preferredTransport: "JSONRPC")
Request body capMAX_BODY_BYTES = 64 KiB (larger bodies are rejected because messages persist in task history)
Task history capHISTORY_LIMIT = 50 entries per task (oldest dropped first)
Streaming (message/stream, tasks/resubscribe)Advertised off; answers UnsupportedOperationError (-32004)
Push notificationsAdvertised off; answers PushNotificationNotSupportedError (-32003)
Authenticated extended cardNot configured; answers AuthenticatedExtendedCardNotConfiguredError (-32007)

Verify locally

Start your application with ferrite dev and inspect the Agent Card and a live JSON-RPC call:

curl -s http://127.0.0.1:8787/.well-known/agent-card.json | jq '{name, protocolVersion, url, capabilities, skills: [.skills[].id]}'

curl -s -X POST http://127.0.0.1:8787/a2a \
  -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":"1","method":"message/send","params":{"message":{"role":"user","messageId":"m1","parts":[{"kind":"text","text":"list skills"}]}}}' | jq .

Next steps

Ferrite counts page views on this site. Privacy · Terms · Support