Adk A2A
20by vladkol
ADK to A2A relay sample: expose your ADK Agent as an A2A Server
Getting Started
README
ADK to A2A Relay
This example is a lightweight relay server that exposes Agent Development Kit (ADK) agents as Agent2Agent (A2A) compliant services.
This library acts as a bridge, allowing any ADK agent to be discovered and communicate within an A2A ecosystem using the standard A2A protocol.
Features
- Seamless Protocol Bridging: Translates A2A requests into ADK queries and streams ADK responses back as A2A events.
- Dynamic Agent Loading: Run any ADK agent without code modification by simply pointing the CLI to its directory.
- Full Streaming Support: Natively handles the streaming capabilities of both ADK and A2A for real-time, interactive experiences.
- Automatic Type Conversion: Intelligently converts message parts (text, files, data payloads) between A2A and Google GenAI formats.
- Function Call Forwarding: Optionally relays ADK function calls and responses as structured A2A artifacts for advanced tool use cases.
- Artifact Handling: Manages ADK artifacts, making them available within the A2A task context.
- Automatic Agent Card: Generates a standard A2A AgentCard from your ADK agent's metadata, or uses a custom agent.json file if provided.
- Simple CLI Interface: Easy to run from the command line with configurable host, port, and more flags.
Prerequisites
- Python 3.10+
- uv
Installation
# Using uv (recommended)
uv venv
source .venv/bin/activate
uv pip install -U -r requirements.txt
Usage
- Copy
.env-samplefile to the same directory as.env. - Specify Id of your Google Cloud Project in
GOOGLE_CLOUD_PROJECTvariable. The project must have Vertex AI APIs enabled.
To run the sample agent:
python3 -m adk_a2a samples/adk_agents/dice_roll
To run your own agent, replace the last argument with your ADK agent's directory.
CLI Options
python3 -m adk_a2a [--debug] [--host HOST_NAME] [--port PORT_NUMBER] [--transfer-function-calls] AGENT_DIRECTORY
You can customize the server's behavior with the following arguments:
| Argument | Description | Default |
|---|---|---|
AGENT_DIRECTORY |
(Required) Path to the directory containing the ADK agent. | N/A |
--host |
Host address to bind the server to. | 0.0.0.0 |
--port |
Port for the HTTP server. | 8080 |
--transfer-function-calls |
If set, relays ADK function calls/responses as A2A artifacts. | False |
--debug |
Enables debug-level logging for detailed output. | False |
Interact with the Agent
Use any A2A-compatible client, such as A2A Inspector.
- Run the agent server (see above).
- Connect to
http://127.0.0.1:8080(if testing locally) or another address you exposed the server with. - Make a query to the agent from the client.
Known limitations
The relay currently doesn't support the following features:
- ADK Long-running tools
- ADK in-task authentication
- Agent-to-agent authentication must be done at the service level when making a request from the client.
Disclaimer
This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.
Code and data from this repository are intended for demonstration purposes only. It is not intended for use in a production environment.