Skip to main content
POST
/
a2a
POST /a2a
curl --request POST \
  --url https://api.example.com/a2a \
  --header 'Authorization: Bearer <token>'

POST /a2a

Send a message to the agent using the A2A (Agent-to-Agent) protocol.

Endpoint

POST /a2a

Description

This endpoint accepts JSON-RPC 2.0 formatted requests to communicate with the agent. It supports various methods for task management and message exchange.

Request

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes

Body

{
  "jsonrpc": "2.0",
  "method": "tasks/send",
  "params": {
    "id": "task-123",
    "message": {
      "role": "user",
      "parts": [
        {
          "type": "text",
          "text": "Hello, can you help me?"
        }
      ]
    }
  },
  "id": 1
}

Request Fields

FieldTypeRequiredDescription
jsonrpcstringYesMust be "2.0"
methodstringYesA2A method name
paramsobjectYesMethod parameters
idinteger/stringYesRequest ID

Supported Methods

MethodDescription
tasks/sendSend a message to create or continue a task
tasks/getGet task status and history
tasks/cancelCancel a running task

Response

Success Response (200 OK)

{
  "jsonrpc": "2.0",
  "result": {
    "id": "task-123",
    "status": {
      "state": "completed"
    },
    "artifacts": [
      {
        "parts": [
          {
            "type": "text",
            "text": "Hello! I'd be happy to help you. What do you need assistance with?"
          }
        ]
      }
    ]
  },
  "id": 1
}

Response Fields

FieldTypeDescription
jsonrpcstringAlways "2.0"
resultobjectTask result
result.idstringTask ID
result.statusobjectTask status
result.artifactsarrayResponse artifacts
idinteger/stringRequest ID (echoed)

Task States

StateDescription
submittedTask received
workingTask in progress
completedTask finished successfully
failedTask failed
canceledTask was canceled

Example

cURL

curl -X POST http://localhost:8000/a2a \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tasks/send",
    "params": {
      "id": "task-123",
      "message": {
        "role": "user",
        "parts": [{"type": "text", "text": "What is AI?"}]
      }
    },
    "id": 1
  }'

Python

import requests

response = requests.post(
    "http://localhost:8000/a2a",
    json={
        "jsonrpc": "2.0",
        "method": "tasks/send",
        "params": {
            "id": "task-123",
            "message": {
                "role": "user",
                "parts": [{"type": "text", "text": "What is AI?"}]
            }
        },
        "id": 1
    }
)

result = response.json()
print(result["result"]["artifacts"][0]["parts"][0]["text"])

Error Responses

JSON-RPC Error

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32600,
    "message": "Invalid Request"
  },
  "id": 1
}
CodeMessageDescription
-32700Parse errorInvalid JSON
-32600Invalid RequestInvalid JSON-RPC
-32601Method not foundUnknown method
-32602Invalid paramsInvalid parameters
-32603Internal errorServer error

See Also