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.
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." });
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.
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)
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.