/a2a/{assistant_id}.
Supported methods
Agent Server supports the following A2A RPC methods:- message/send: Send a message to an assistant and receive a complete response
- message/stream: Send a message and stream responses in real-time using Server-Sent Events (SSE)
- tasks/get: Retrieve the status and results of a previously created task
Agent card discovery
Each assistant automatically exposes an A2A Agent Card that describes its capabilities and provides the information needed for other agents to connect. You can retrieve the agent card for any assistant using:Requirements
To use A2A, ensure you have the following dependencies installed:langgraph-api >= 0.4.21
Usage overview
To enable A2A:- Upgrade to use langgraph-api>=0.4.21.
- Deploy your agent with message-based state structure.
- Connect with other A2A-compatible agents using the endpoint.
Creating an A2A-compatible agent
This example creates an A2A-compatible agent that processes incoming messages using OpenAI’s API and maintains conversational state. The agent defines a message-based state structure and handles the A2A protocol’s message format. To be compatible with the A2A “text” parts, the agent must have amessages key in state.
The A2A protocol uses two identifiers to maintain conversational continuity:
contextId: Groups messages into a conversation thread (like a session ID)taskId: Identifies each individual request within that conversation
contextId and taskId - the agent will generate and return them. For all subsequent messages in the conversation, include the contextId and taskId from the prior response to maintain thread continuity.
LangSmith Tracing: The Langsmith Deployment A2A endpoint automatically converts the A2A contextId to thread_id for LangSmith tracing, grouping all messages in the conversation under a single thread.
For example:
Agent-to-agent communication
Once your agents are running locally vialanggraph dev or deployed to production, you can facilitate communication between them using the A2A protocol.
This example demonstrates how two agents can communicate by sending JSON-RPC messages to each other’s A2A endpoints. The script simulates a multi-turn conversation where each agent processes the other’s response and continues the dialogue.
- Two LangGraph agents communicating - Example of two LangGraph agents using the A2A protocol
- Google ADK agent with LangChain agent - Example of a Google ADK agent interacting with a LangChain agent using the A2A protocol
Disable A2A
To disable the A2A endpoint, setdisable_a2a to true in your langgraph.json configuration file:
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.