A2A (Agent-to-Agent) is Google’s open protocol for agent interoperability. It lets agents built on different frameworks - from different vendors - discover and communicate with each other over a standard JSON-RPC HTTP interface. Any A2A-compatible client can find your agent via its AgentCard and invoke it without knowing which framework you used.
A2AAdapter wraps any Vibes agent and serves it as a fully compliant A2A server.
Architecture
Setup
Install @vibesjs/sdk and import A2AAdapter:
Constructor
A2AAdapterOptions fields:
Deno HTTP server
adapter.handler() returns a standard Deno HTTP handler. You can also call adapter.handleRequest(req) directly if you need to integrate into an existing server.
AgentCard discovery
Remote agents and clients discover your server by fetching GET /.well-known/agent.json. The response is an AgentCard object describing your agent’s identity and capabilities.
AgentCard fields:
Task lifecycle
Synchronous: message/send
Send a message and wait for the full result. The response is an A2ATask with all output artifacts.
Streaming: message/stream
Receive incremental updates as the agent processes the request. Returns an SSE stream of events.
Task state machine
Every task progresses through a defined set of states:
A2ATaskState values:
SSE streaming events
When using message/stream, the server emits two event types:
status-update
Emitted when the task state changes:
The final: true flag marks the last event in the stream (state: completed, failed, or canceled).
artifact-update
Emitted for each chunk of streaming output:
Other JSON-RPC methods
tasks/get
Fetch the current state of a task by ID:
tasks/cancel
Cancel a running task. This signals an abort to the SSE stream - any in-flight message/stream response will terminate:
Task store
By default, A2AAdapter uses MemoryTaskStore - an in-memory implementation that does not persist tasks across process restarts.
MemoryTaskStore is fine for development and stateless serverless deployments. For long-running processes where you need task history across restarts, implement the TaskStore interface backed by a database or Redis.
Message parts
A2A messages are composed of parts. Each part has a kind discriminant:
Text part
File part
Data part
API reference
A2AAdapterOptions
A2AAdapter
A2AAgentSkill
JSON-RPC Methods