API Reference

Complete reference for the A2A protocol implementation: methods, types, scopes, and error codes.

Agent Card Schema#

The Agent Card is published at /.well-known/agent-card.json and describes your agents' capabilities.

A2AAgentCard
interface A2AAgentCard {
  name: string;              // Display name
  description: string;       // What this agent system does
  url: string;               // A2A endpoint URL
  version: string;           // Protocol version (e.g. "0.3")
  capabilities: {
    streaming: boolean;             // Supports SSE streaming
    pushNotifications: boolean;     // Supports push notifications
    stateTransitionHistory: boolean; // Returns task history
  };
  authentication: {
    schemes: string[];       // e.g. ["bearer"]
    credentials?: string;    // How to get credentials
  };
  defaultInputModes: string[];  // e.g. ["text"]
  defaultOutputModes: string[]; // e.g. ["text"]
  skills: A2ASkill[];          // List of agent capabilities
}

Skill Schema#

A2ASkill
interface A2ASkill {
  id: string;           // Unique identifier (e.g. "content-writing")
  name: string;         // Human-readable name
  description: string;  // What this skill does
  tags?: string[];      // Searchable tags
  examples?: string[];  // Example prompts
  inputModes?: string[];  // Override default input modes
  outputModes?: string[]; // Override default output modes
}

Authentication#

All A2A requests require a Bearer token in the Authorization header. Keys use the ohw_a2a_ prefix.

http
POST /api/a2a HTTP/1.1
Content-Type: application/json
Authorization: Bearer ohw_a2a_your_key_here

JSON-RPC Methods#

All requests use JSON-RPC 2.0 format. The endpoint is /api/a2a.

MethodRequired ScopeDescription
message/sendtasks.createSend a message to create or continue a task
message/sendStreamtasks.streamSend a message with SSE streaming response
tasks/gettasks.readGet the current status and result of a task
tasks/canceltasks.cancelCancel a running task
tasks/pushNotification/settasks.createRegister a webhook for task updates
tasks/pushNotification/gettasks.readGet push notification config for a task

message/send#

Request
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "message/send",
  "params": {
    "message": {
      "role": "user",
      "parts": [
        { "type": "text", "text": "Your task description here" }
      ]
    },
    "sessionId": "optional-session-id"
  }
}
Response
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "id": "task_abc123",
    "status": {
      "state": "completed",
      "message": {
        "role": "agent",
        "parts": [{ "type": "text", "text": "Here are the results..." }]
      }
    },
    "artifacts": []
  }
}

tasks/get#

Request
{
  "jsonrpc": "2.0",
  "id": "2",
  "method": "tasks/get",
  "params": {
    "id": "task_abc123",
    "historyLength": 10
  }
}

Scopes#

Each API key has a set of scopes that determine what operations it can perform.

ScopeDescription
tasks.readRead task status and results
tasks.createCreate new tasks via message/send
tasks.cancelCancel running tasks
tasks.streamUse streaming (SSE) responses
agents.readRead individual agent details
agents.listList available agents
results.readRead task result data
results.filesAccess file artifacts from results

Trust Levels#

Trust levels are pre-configured scope bundles that make it easy to set the right permissions.

LevelScopes IncludedUse Case
read_onlyagents.list, agents.read, tasks.read, results.readMonitoring and analytics dashboards
executeread_only + tasks.createSend tasks but no cancel or file access
autonomousexecute + tasks.cancel, results.filesFull automation with file access
adminAll scopesComplete access (internal tools only)

Error Codes#

CodeNameDescription
-32700PARSE_ERRORInvalid JSON in request body
-32600INVALID_REQUESTMissing required JSON-RPC fields
-32601METHOD_NOT_FOUNDUnknown method name
-32602INVALID_PARAMSMissing or invalid parameters
-32603INTERNAL_ERRORServer-side error during execution
-32001TASK_NOT_FOUNDNo task with the given ID
-32002TASK_NOT_CANCELABLETask is already completed or failed
-32003UNAUTHORIZEDInvalid or missing API key
-32004RATE_LIMITEDToo many requests; try again later
-32005AGENT_NOT_FOUNDNo agent matches the request
-32006SCOPE_INSUFFICIENTAPI key lacks the required scope

Key Types#

Task#

typescript
interface A2ATask {
  id: string;
  sessionId?: string;
  status: {
    state: 'submitted' | 'working' | 'input-required'
         | 'completed' | 'canceled' | 'failed';
    message?: A2AMessage;
    timestamp?: string;
  };
  artifacts?: A2AArtifact[];
  history?: A2AMessage[];
  metadata?: Record<string, unknown>;
}

Message & Parts#

typescript
interface A2AMessage {
  role: 'user' | 'agent';
  parts: A2APart[];
  metadata?: Record<string, unknown>;
}

type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;

interface A2ATextPart {
  type: 'text';
  text: string;
}

interface A2AFilePart {
  type: 'file';
  file: {
    name?: string;
    mimeType?: string;
    bytes?: string;  // base64
    uri?: string;
  };
}

interface A2ADataPart {
  type: 'data';
  data: Record<string, unknown>;
}

Artifact#

typescript
interface A2AArtifact {
  name?: string;
  description?: string;
  parts: A2APart[];
  index: number;
  append?: boolean;
  lastChunk?: boolean;
}

Note

All type definitions are available in the source at src/lib/a2a/types.ts.