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_hereJSON-RPC Methods#
All requests use JSON-RPC 2.0 format. The endpoint is /api/a2a.
| Method | Required Scope | Description |
|---|---|---|
| message/send | tasks.create | Send a message to create or continue a task |
| message/sendStream | tasks.stream | Send a message with SSE streaming response |
| tasks/get | tasks.read | Get the current status and result of a task |
| tasks/cancel | tasks.cancel | Cancel a running task |
| tasks/pushNotification/set | tasks.create | Register a webhook for task updates |
| tasks/pushNotification/get | tasks.read | Get 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.
| Scope | Description |
|---|---|
| tasks.read | Read task status and results |
| tasks.create | Create new tasks via message/send |
| tasks.cancel | Cancel running tasks |
| tasks.stream | Use streaming (SSE) responses |
| agents.read | Read individual agent details |
| agents.list | List available agents |
| results.read | Read task result data |
| results.files | Access file artifacts from results |
Trust Levels#
Trust levels are pre-configured scope bundles that make it easy to set the right permissions.
| Level | Scopes Included | Use Case |
|---|---|---|
| read_only | agents.list, agents.read, tasks.read, results.read | Monitoring and analytics dashboards |
| execute | read_only + tasks.create | Send tasks but no cancel or file access |
| autonomous | execute + tasks.cancel, results.files | Full automation with file access |
| admin | All scopes | Complete access (internal tools only) |
Error Codes#
| Code | Name | Description |
|---|---|---|
| -32700 | PARSE_ERROR | Invalid JSON in request body |
| -32600 | INVALID_REQUEST | Missing required JSON-RPC fields |
| -32601 | METHOD_NOT_FOUND | Unknown method name |
| -32602 | INVALID_PARAMS | Missing or invalid parameters |
| -32603 | INTERNAL_ERROR | Server-side error during execution |
| -32001 | TASK_NOT_FOUND | No task with the given ID |
| -32002 | TASK_NOT_CANCELABLE | Task is already completed or failed |
| -32003 | UNAUTHORIZED | Invalid or missing API key |
| -32004 | RATE_LIMITED | Too many requests; try again later |
| -32005 | AGENT_NOT_FOUND | No agent matches the request |
| -32006 | SCOPE_INSUFFICIENT | API 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.