Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

A2A JSON-RPC

Stability: beta -- A2A protocol support ships with orloj.dev/v1. The JSON-RPC interface follows the A2A specification and may evolve as the spec matures.

Orloj exposes A2A functionality via JSON-RPC 2.0 over HTTP. All requests are POST with Content-Type: application/json.

Endpoints

EndpointAuthDescription
POST /a2aBearer token when auth is enabledShared JSON-RPC endpoint. Resolves target from params or defaults to the single A2A-enabled AgentSystem.
POST /v1/agent-systems/{name}/a2aBearer token when auth is enabledPer-system JSON-RPC endpoint. AgentSystem name in the path determines routing.

Legacy /v1/agents/{name}/a2a paths are accepted as aliases for AgentSystem names.

Request Format

All methods use the standard JSON-RPC 2.0 envelope:

{
  "jsonrpc": "2.0",
  "id": "req-1",
  "method": "tasks/send",
  "params": { ... }
}

The id field can be a string or integer. If omitted, the request is treated as a notification (no response body).

Methods

tasks/send

Create a task and wait for completion. Returns the final task state.

Params:
FieldTypeRequiredDescription
idstringYesClient-provided task ID. The server rejects requests without an id.
messageA2AMessageYesInput message for the agent.
metadatamap[string]stringNoArbitrary key-value pairs attached to the task.

Result: A2ATask

Example:
{
  "jsonrpc": "2.0",
  "id": "req-1",
  "method": "tasks/send",
    "params": {
      "id": "task-001",
      "message": {
        "role": "user",
        "parts": [{"type": "text", "text": "Summarize this document"}]
      },
      "metadata": {
        "source": "external-workflow"
      }
    }
}
Response:
{
  "jsonrpc": "2.0",
  "id": "req-1",
  "result": {
    "id": "a2a-task-xyz",
    "status": {
      "state": "completed",
      "message": {
        "role": "agent",
        "parts": [{"type": "text", "text": "Here is the summary..."}]
      }
    },
    "artifacts": [
      {
        "name": "summary",
        "parts": [{"type": "text", "text": "..."}],
        "index": 0
      }
    ]
  }
}

tasks/get

Retrieve the current state of an existing task.

Params:
FieldTypeRequiredDescription
idstringYesTask ID to retrieve.

Result: A2ATask

Example:
{
  "jsonrpc": "2.0",
  "id": "req-2",
  "method": "tasks/get",
  "params": {
    "id": "a2a-task-xyz"
  }
}

tasks/cancel

Request cancellation of a running task.

Params:
FieldTypeRequiredDescription
idstringYesTask ID to cancel.
reasonstringNoCancellation reason.

Result: A2ATask with status state canceled.

Example:
{
  "jsonrpc": "2.0",
  "id": "req-3",
  "method": "tasks/cancel",
  "params": {
    "id": "a2a-task-xyz",
    "reason": "No longer needed"
  }
}

tasks/sendSubscribe

Create a task and stream status updates via SSE. The initial HTTP response transitions to an SSE stream.

Params: Same as tasks/send.

Response: Server-Sent Events stream with the following event types:

EventDataDescription
statusTaskResult JSONTask state transition (full task result including id, status, artifacts, etc.)
: heartbeat(comment)Keep-alive comment sent every 15 s; not a named event

The stream ends when the task reaches a terminal state (completed, failed, canceled, rejected).

Example SSE stream:
event: status
data: {"id": "a2a-task-xyz", "status": {"state": "working"}}
 
: heartbeat
 
event: status
data: {"id": "a2a-task-xyz", "status": {"state": "completed", "message": {"role": "agent", "parts": [{"type": "text", "text": "Done."}]}}, "artifacts": []}

Error Codes

JSON-RPC errors use standard codes plus A2A-specific extensions:

CodeNameDescription
-32700Parse errorInvalid JSON
-32600Invalid requestMissing required fields
-32601Method not foundUnknown method name
-32602Invalid paramsInvalid method parameters
-32603Internal errorServer-side failure
-32001Task not foundReferenced task ID does not exist
-32002Task cancelledTask has been cancelled
-32003Agent not foundTarget agent does not exist or A2A is not enabled for it
Error response example:
{
  "jsonrpc": "2.0",
  "id": "req-4",
  "error": {
    "code": -32001,
    "message": "task not found",
    "data": {
      "task_id": "a2a-task-unknown"
    }
  }
}

Data Types

A2ATask

FieldTypeDescription
idstringUnique task identifier
statusA2AStatusCurrent task status
artifacts[]A2AArtifactOutput artifacts
history[]A2AMessageMessage history (when stateTransitionHistory is enabled)
metadatamap[string]stringTask metadata

A2AStatus

FieldTypeDescription
statestringOne of: submitted, working, input-required, completed, failed, canceled, rejected
messageA2AMessageOptional status message from the agent

A2AMessage

FieldTypeDescription
rolestringuser or agent
parts[]A2APartMessage content parts

A2APart

FieldTypeDescription
typestringPart type (e.g., text, data)
textstringText content (when type=text)
dataanyStructured data (when type=data)
metadataobjectAdditional part metadata

A2AArtifact

FieldTypeDescription
namestringArtifact name
descriptionstringArtifact description
parts[]A2APartArtifact content
indexintegerArtifact index for ordering

Related