a2aproject/a2a-js

Official JavaScript SDK for the Agent2Agent (A2A) Protocol

What it solves

It provides a standardized way for AI agents to communicate and interoperate. By implementing the Agent2Agent (A2A) Protocol, it allows developers to build agents that can be discovered, driven, and managed by different clients regardless of the underlying transport method.

How it works

The SDK allows developers to create A2A servers (agents that expose capabilities) and A2A clients (applications that interact with those agents). It abstracts the communication layer by supporting three wire transports: JSON-RPC, HTTP+JSON/REST, and gRPC.

On the server side, an AgentExecutor handles the business logic, while a DefaultRequestHandler manages routing, task storage, and push notifications. On the client side, a ClientFactory automatically selects the best transport based on the agent's advertised capabilities (the "agent card").

Who it’s for

Developers building agentic applications who need a consistent protocol for agent-to-agent or client-to-agent communication, especially those working in TypeScript or JavaScript environments.

Highlights

  • Multi-Transport Support: Native support for JSON-RPC, REST, and gRPC.
  • Task Lifecycle Management: Built-in handling for task submission, streaming updates, and user-initiated cancellation.
  • Persistent Storage: Support for PostgreSQL, MySQL, SQLite, and Cloudflare D1 to ensure tasks and notification configs survive restarts.
  • Push Notifications: Webhook-based updates for long-running tasks where persistent connections cannot be maintained.
  • Backward Compatibility: An opt-in layer allowing v1.0 deployments to interoperate with v0.3 peers.

Related

  • Project
  • Project
  • Project
  • Project
  • Project