A2A protocol
A2A (Agent2Agent) lets agents on different platforms talk to each other over HTTP. Harmony speaks both sides of it (Decision 0026): you can expose a workspace agent as an A2A server, and you can consume an external A2A agent — including using it as a delegate inside a multi-agent run.
The whole adapter rests on one idea: an A2A Task is a Run, made addressable across a network boundary. A remote caller submits a message, gets back a Task, and polls or streams it to completion. Underneath, that Task is one of our Runs — the same append-only event log, projected through a thin adapter (src/lib/a2a/adapter.ts).
The mapping:
| A2A | Harmony |
|---|---|
| Task | a Run |
contextId | the Run's threadId (or its own id when there's no thread) |
| Message / Artifact | the user/agent turns and final result, projected from RunEvents |
Spec version is 0.3.0, transport is JSON-RPC 2.0 over POST with SSE for streaming.
Naming nuance. An A2A
Taskis not the 0027 work-item Task (a unit of delegated work). An A2A Task ≈ a Harmony Run. The name collision is the protocol's, not ours — read "A2A Task" as "a run you can address remotely."
Only Message and Artifact data cross the network edge. Tool calls, reasoning, token usage, and the rest of the event log stay internal — A2A's opaque-agent guarantee. The remote peer sees the conversation and the result, never the machinery.
Expose: Harmony agents as A2A servers
Every workspace agent is automatically reachable as an A2A server. No separate publish step.
GET /api/v1/a2a/{slug}/{agent} → Agent Card
GET /api/v1/a2a/{slug}/{agent}/.well-known/agent-card.json → Agent Card (discovery path)
POST /api/v1/a2a/{slug}/{agent} → JSON-RPC 2.0
Auth is the workspace API key as a bearer token (Authorization: Bearer hk_…), the same credential as the rest of the v1 API. The Agent Card advertises this as its declared securityScheme.
Agent Card
GET either the base endpoint or the well-known discovery path. Both return the same card; the discovery path is a catch-all so any other sub-path under the agent 404s. The card's url always points back at the base JSON-RPC endpoint (resolved from the forwarded host/proto, so it's reachable from outside the reverse proxy).
curl https://platform.groupany.ai/api/v1/a2a/acme-research/research-agent/.well-known/agent-card.json \
-H "Authorization: Bearer $HARMONY_API_KEY"
{
"protocolVersion": "0.3.0",
"name": "research-agent",
"description": "Researches a topic and writes a brief.",
"url": "https://platform.groupany.ai/api/v1/a2a/acme-research/research-agent",
"preferredTransport": "JSONRPC",
"version": "4",
"provider": { "organization": "Harmony", "url": "https://platform.groupany.ai" },
"capabilities": { "streaming": true, "pushNotifications": false, "stateTransitionHistory": true },
"defaultInputModes": ["text/plain"],
"defaultOutputModes": ["text/plain"],
"securitySchemes": {
"harmonyApiKey": { "type": "http", "scheme": "bearer", "description": "Workspace API key (hk_...)" }
},
"security": [{ "harmonyApiKey": [] }],
"skills": [
{
"id": "research-agent",
"name": "research-agent",
"description": "Researches a topic and writes a brief.",
"tags": ["harmony"],
"inputModes": ["text/plain"],
"outputModes": ["text/plain"]
}
]
}
version is the agent's latest version number. description comes from the agent's latest skill-version metadata (falling back to the skill description). A GET for an agent that doesn't exist in the workspace returns 404; a failed auth returns 401.
JSON-RPC methods
POST to the base endpoint with a JSON-RPC 2.0 envelope. Supported methods: message/send, message/stream, tasks/get, tasks/cancel.
message/send
Starts a run with the message's text and returns the Task. Pass contextId to continue an existing thread; alternatively pass taskId (a prior run id) and Harmony resolves its thread for you.
curl -X POST https://platform.groupany.ai/api/v1/a2a/acme-research/research-agent \
-H "Authorization: Bearer $HARMONY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "message/send",
"params": {
"message": {
"kind": "message",
"role": "user",
"messageId": "m-1",
"parts": [{ "kind": "text", "text": "What changed in the EU AI Act last quarter?" }]
}
}
}'
The result is an A2A Task projected from the run:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"kind": "task",
"id": "run_…",
"contextId": "thr_…",
"status": { "state": "working", "timestamp": "2026-05-28T19:02:11.000Z" },
"history": [
{ "kind": "message", "role": "user", "messageId": "evt_…", "taskId": "run_…", "contextId": "thr_…",
"parts": [{ "kind": "text", "text": "What changed in the EU AI Act last quarter?" }] }
],
"artifacts": []
}
}
result.id is the Task id (= the run id) you poll with tasks/get. contextId is the thread — pass it back on the next message/send to continue the conversation. The agent loop runs asynchronously, so the first Task is usually working with no artifacts yet.
If the message carries no text part, you get -32602 (Invalid params). A run-start failure surfaces as -32603.
message/stream
Same params as message/send, but the response is an SSE feed of JSON-RPC result frames instead of a single Task. The first frame is the initial Task snapshot; thereafter a status-update frame is emitted on each state change, with the final artifact-update sent once just before the terminal status.
curl -N -X POST https://platform.groupany.ai/api/v1/a2a/acme-research/research-agent \
-H "Authorization: Bearer $HARMONY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "jsonrpc": "2.0", "id": 2, "method": "message/stream",
"params": { "message": { "kind": "message", "role": "user", "messageId": "m-2",
"parts": [{ "kind": "text", "text": "Summarise the enforcement timeline." }] } } }'
data: {"jsonrpc":"2.0","id":2,"result":{"kind":"task","id":"run_…","contextId":"thr_…","status":{"state":"working"},…}}
data: {"jsonrpc":"2.0","id":2,"result":{"kind":"artifact-update","taskId":"run_…","contextId":"thr_…","artifact":{"artifactId":"run_…-result","name":"result","parts":[{"kind":"text","text":"…"}]},"lastChunk":true}}
data: {"jsonrpc":"2.0","id":2,"result":{"kind":"status-update","taskId":"run_…","contextId":"thr_…","status":{"state":"completed"},"final":true}}
The stream closes after the terminal status-update (final: true). A stream-level fault is emitted as a status-update frame carrying an error field with final: true.
tasks/get
Poll a Task by id (the run id). Returns the current projected Task.
curl -X POST https://platform.groupany.ai/api/v1/a2a/acme-research/research-agent \
-H "Authorization: Bearer $HARMONY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "jsonrpc": "2.0", "id": 3, "method": "tasks/get", "params": { "id": "run_…" } }'
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"kind": "task",
"id": "run_…",
"contextId": "thr_…",
"status": { "state": "completed", "timestamp": "2026-05-28T19:02:48.000Z" },
"history": [
{ "kind": "message", "role": "user", "messageId": "evt_…", "parts": [{ "kind": "text", "text": "…" }] },
{ "kind": "message", "role": "agent", "messageId": "run_…-final", "parts": [{ "kind": "text", "text": "The EU AI Act…" }] }
],
"artifacts": [
{ "artifactId": "run_…-result", "name": "result", "parts": [{ "kind": "text", "text": "The EU AI Act…" }] }
]
}
}
The final agent answer appears both as the last agent message in history and as the result artifact. An unknown task id returns -32001 (Task not found).
tasks/cancel
Best-effort cancel: marks an unfinalized run terminal (cancelled) and returns the updated Task. A turn already in flight may still finish. Returns -32001 if the task isn't in the workspace.
curl -X POST https://platform.groupany.ai/api/v1/a2a/acme-research/research-agent \
-H "Authorization: Bearer $HARMONY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "jsonrpc": "2.0", "id": 4, "method": "tasks/cancel", "params": { "id": "run_…" } }'
State mapping
The Task's status.state is mapped from the run's status:
| Run status | A2A TaskState |
|---|---|
active | working |
awaiting_approval | input-required |
completed | completed |
failed | failed |
budget_exceeded | failed |
cancelled | canceled |
| (anything else) | unknown |
Consume: calling external A2A agents
Register any external A2A agent in a workspace, then invoke it directly or wire it in as a delegate. The client (src/lib/a2a/client.ts) fetches the peer's card, sends a message, and polls tasks/get to a terminal state — the same Task↔Run mapping in reverse, treating the remote Task as an opaque unit of work and surfacing only its text result.
GET /api/v1/workspaces/{slug}/remote-agents → list registered remote agents
POST /api/v1/workspaces/{slug}/remote-agents → register one (admin)
POST /api/v1/workspaces/{slug}/remote-agents/{name}/invoke → call it (member)
Register a remote agent
POST /api/v1/workspaces/{slug}/remote-agents (requires the admin role). The body is validated as:
{
name: string // 1–80 chars, ^[a-z0-9][a-z0-9-]{0,62}$
description?: string // ≤ 500 chars
endpointUrl: string // the JSON-RPC POST endpoint (valid URL)
cardUrl?: string // where to fetch the Agent Card, if not the well-known path
token?: string // bearer token for the remote (1–4000 chars)
}
On register, Harmony fetches the peer's Agent Card to confirm reachability and snapshots it. If the card declares its own url, that wins over the supplied endpointUrl. An unreachable card fails the registration with validation_failed.
curl -X POST https://platform.groupany.ai/api/v1/workspaces/acme-research/remote-agents \
-H "Authorization: Bearer $HARMONY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "partner-pricing",
"endpointUrl": "https://partner.example.com/a2a/pricing",
"token": "their-secret-key"
}'
Response 201:
{
"remote_agent": {
"id": "ra_…",
"name": "partner-pricing",
"endpoint_url": "https://partner.example.com/a2a/pricing",
"has_token": true
},
"uri": "harmony://ws/acme-research/remote-agents/partner-pricing"
}
The token is encrypted with the workspace vault key at rest and resolved fresh per call — never stored plaintext, never written to the run log. Registering a duplicate name returns conflict.
List remote agents
curl https://platform.groupany.ai/api/v1/workspaces/acme-research/remote-agents \
-H "Authorization: Bearer $HARMONY_API_KEY"
{
"remote_agents": [
{
"id": "ra_…",
"name": "partner-pricing",
"description": "Returns a quote for a SKU + region.",
"endpointUrl": "https://partner.example.com/a2a/pricing",
"hasToken": true,
"createdAt": "2026-05-29T10:00:00.000Z"
}
]
}
The token itself is never returned — only hasToken.
Invoke a remote agent
POST /api/v1/workspaces/{slug}/remote-agents/{name}/invoke (requires the member role). Body is { input: string (1–10000), context_id?: string }. Harmony decrypts the token, sends the message, and polls the remote task to a terminal state, returning the final text.
curl -X POST https://platform.groupany.ai/api/v1/workspaces/acme-research/remote-agents/partner-pricing/invoke \
-H "Authorization: Bearer $HARMONY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "input": "Quote SKU-4471 for the EU region." }'
{
"result": {
"remote": "partner-pricing",
"state": "completed",
"task_id": "task_…",
"output": "SKU-4471 (EU): €1,240 ex VAT, 3-week lead time."
}
}
Pass context_id (the remote's contextId from a prior call) to continue the same remote conversation. The poll has a default 120-second deadline; on timeout the last observed state and text are returned.
As a delegate / sub-agent
A registered remote agent isn't just for direct invocation — it can be used as a delegate in a multi-agent run. When a parent run delegates to a remote agent, runSubagent resolves it over the wire (callRemoteAgent), so an external A2A peer participates in delegation exactly like an in-platform sub-agent, with only its text result crossing back over the edge. This is how A2A consume closes the loop with the multi-agent model in Decision 0026.