Expose a Vibes agent as an A2A-compatible server for cross-vendor agent interoperability using A2AAdapter.
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:
import { A2AAdapter, Agent } from "jsr:@vibesjs/sdk";import { anthropic } from "npm:@ai-sdk/anthropic";const model = anthropic("claude-opus-4-5");const agent = new Agent({ model, name: "Research Agent", systemPrompt: "You are a research assistant." });
Constructor
const adapter = new A2AAdapter(agent, { name: "Research Agent", description: "Answers research questions using web search and reasoning.", url: "https://my-agent.example.com", version: "1.0.0", skills: [ { id: "research", name: "Research", description: "Answer factual questions and summarize information", }, ], provider: { organization: "Acme Corp", url: "https://acme.example.com" }, deps: { db: getDb() },});
A2AAdapterOptions fields:
Option
Type
Default
Description
name
string
Agent name
Displayed in AgentCard
description
string
-
Agent description in AgentCard
url
string
"http://localhost:8000"
Public URL of this server
version
string
"1.0.0"
Agent version string
skills
A2AAgentSkill[]
[]
Capabilities list for discovery
provider
{ organization, url? }
-
Organization info
deps
TDeps
-
Static dependencies for every agent run
taskStore
TaskStore
MemoryTaskStore
Task persistence backend
Deno HTTP server
Deno.serve(adapter.handler());// GET /.well-known/agent.json → AgentCard (discovery)// POST / → JSON-RPC (tasks/send, message/stream, etc.)
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.
// Example AgentCard returned by GET /.well-known/agent.json{ "name": "Research Agent", "description": "Answers research questions", "url": "https://my-agent.example.com", "version": "1.0.0", "capabilities": { "streaming": true, "pushNotifications": false, "stateTransitionHistory": false }, "skills": [ { "id": "research", "name": "Research", "description": "Answer factual questions and summarize information" } ], "provider": { "organization": "Acme Corp", "url": "https://acme.example.com" }, "defaultInputModes": ["text/plain"], "defaultOutputModes": ["text/plain"]}
AgentCard fields:
Field
Type
Description
name
string
Agent display name
description
string | undefined
What the agent does
url
string
Base URL of the A2A server
version
string
Agent version
capabilities
object
Supported features (streaming, pushNotifications, stateTransitionHistory)
skills
A2AAgentSkill[]
Array of named capabilities
provider
{ organization, url? } | undefined
Organization info
defaultInputModes
string[]
MIME types accepted
defaultOutputModes
string[]
MIME types returned
documentationUrl
string | undefined
Link to docs
iconUrl
string | undefined
Agent icon URL
Task lifecycle
Synchronous: message/send
Send a message and wait for the full result. The response is an A2ATask with all output artifacts.
By default, A2AAdapter uses MemoryTaskStore - an in-memory implementation that does not persist tasks across process restarts.
import { A2AAdapter, MemoryTaskStore } from "jsr:@vibesjs/sdk";// Default - no need to import MemoryTaskStore for basic usageconst adapter = new A2AAdapter(agent);// Explicit in-memory store (same as default)const adapter = new A2AAdapter(agent, { taskStore: new MemoryTaskStore(),});// Swap for a persistent store in production (implement TaskStore interface):// const adapter = new A2AAdapter(agent, {// taskStore: new RedisTaskStore(redisClient),// });
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
{ kind: "text", text: "What is the capital of France?" }