A2A protocol
On this page
Agent CardSending tasksChecking task statusCanceling tasksTask lifecycleJSON-RPC methodsError codesStreaming tasksPipelines as skillsGuardrailsHow it relates to MCPThe Agent-to-Agent (A2A) protocol lets AI agents communicate with your deployed functions using a standard JSON-RPC interface. Every organization with deployed MCP tools automatically gets an A2A endpoint — no extra configuration needed.
Agent Card
Each organization publishes a discoverable Agent Card at:
GET https://{tenant}.fold.run/.well-known/agent.jsonThe card is auto-generated from your deployed MCP tools:
{
"name": "fold-my-tenant",
"description": "AI agent powered by fold.run with 3 tool(s)",
"url": "https://my-tenant.fold.run",
"version": "0.1.0",
"capabilities": {
"streaming": true,
"pushNotifications": false
},
"skills": [
{
"id": "weather-lookup",
"name": "weather-lookup",
"description": "Look up current weather for a city",
"inputModes": ["application/json"],
"outputModes": ["application/json"]
}
],
"defaultInputModes": ["application/json"],
"defaultOutputModes": ["application/json"]
}AI agents use this card to discover what skills your organization offers.
Sending tasks
Send a task to your A2A endpoint:
curl -X POST https://my-tenant.fold.run/_a2a/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "tasks/send",
"params": {
"skill": "weather-lookup",
"message": { "city": "San Francisco" }
}
}'Response:
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"id": "task_abc123",
"status": { "state": "completed" },
"artifacts": [
{
"name": "weather-lookup-result",
"parts": [{ "type": "text", "text": "{\"temp\":62,\"condition\":\"foggy\"}" }]
}
]
}
}Checking task status
Retrieve the status of a previously submitted task:
curl -X POST https://my-tenant.fold.run/_a2a/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "2",
"method": "tasks/get",
"params": { "id": "task_abc123" }
}'Canceling tasks
Cancel a task that is still in the working state:
curl -X POST https://my-tenant.fold.run/_a2a/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "3",
"method": "tasks/cancel",
"params": { "id": "task_abc123" }
}'Only tasks with status submitted or working can be canceled.
Task lifecycle
Tasks move through these states:
| State | Description |
|---|---|
submitted |
Task received, queued for execution |
working |
Currently executing |
completed |
Finished successfully (artifacts available) |
failed |
Execution errored |
canceled |
Canceled by caller |
Tasks are retained for 24 hours and then automatically cleaned up.
JSON-RPC methods
| Method | Description |
|---|---|
tasks/send |
Execute a skill with input data |
tasks/sendSubscribe |
Execute a skill and stream status/artifact events via SSE |
tasks/get |
Retrieve task status and artifacts |
tasks/cancel |
Cancel a running task |
Error codes
Standard JSON-RPC error codes apply:
| Code | Meaning |
|---|---|
-32600 |
Invalid request |
-32601 |
Method not found |
-32602 |
Invalid params (e.g. unknown skill) |
-32603 |
Internal error |
Streaming tasks
Use tasks/sendSubscribe to receive real-time SSE events as a task executes. See the Streaming guide for details and examples.
Pipelines as skills
Active pipelines are automatically exposed as A2A skills with pipeline: prefix. For example, a pipeline named summarize-and-translate appears as skill pipeline:summarize-and-translate in the Agent Card.
Guardrails
If guardrail policies are configured, inputs are checked before dispatch and outputs are checked after completion. A block policy returns a JSON-RPC error instead of executing the skill.
How it relates to MCP
MCP and A2A are complementary:
- MCP is for tool-use — an AI agent calls your function as a tool within its reasoning loop.
- A2A is for agent-to-agent delegation — one agent asks another agent to complete a task.
Both protocols are auto-configured from the same deployed functions and pipelines. Deploy once, and your code is reachable via MCP (/mcp), A2A (/_a2a/), and plain HTTP.