/a2a/{assistant_id}
.
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.9
Usage overview
To enable A2A:- Upgrade to use langgraph-api>=0.4.9.
- 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. Here’s an 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.