Content
# A2A Experiments
This repository contains experiments and demos for Agent-to-Agent (A2A) communication using different frameworks and approaches in Python. Each subfolder demonstrates a unique way to implement or interact with A2A agents.
---
## Repository Structure
```
a2a-experiments/
│
├── basic_a2a_demo/ # Minimal FastAPI-based A2A agent and client
├── google_a2a_demo/ # Google A2A SDK-based agent and client
└── python_a2a_demo/ # python-a2a library-based agents and integrations
```
---
## Prerequisites
- Python **3.10** or higher
- [`uv`](https://docs.astral.sh/uv/getting-started/installation/) (an ultra-fast Python package manager)
```bash
# For Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
set Path=C:\Users\Codem\.local\bin;%Path%
# For linux / Mac
curl -LsSf https://astral.sh/uv/install.sh | sh
```
We recommend using a virtual environment for isolation:
```bash
uv venv
source .venv/bin/activate # For linux
.venv\Scripts\activate # For windows
```
---
## Folder Overviews
### [basic_a2a_demo](basic_a2a_demo/)
- **Purpose:** Simple echo agent using FastAPI, with a matching client.
- **Key files:**
- `echo_server.py`: FastAPI server that echoes user messages.
- `echo_client.py`: Python client for sending messages to the echo agent.
- `agent.json`: Agent metadata in standard A2A format.
- **How to run:**
1. Install dependencies:
`uv pip install -r requirements.txt` (see `pyproject.toml` for details)
2. Start the server:
`python echo_server.py`
3. Run the client:
`python echo_client.py`
---
### [google_a2a_demo](google_a2a_demo/)
- **Purpose:** Demonstrates an A2A agent using the official Google A2A SDK.
- **Key files:**
- `main.py`: Starts the A2A agent server with public and extended agent cards.
- `agent_executor.py`: Implements the agent's logic.
- `test_client.py`: Async client for interacting with the agent.
- **How to run:**
1. Install dependencies:
`uv sync` (see `pyproject.toml`)
2. Start the server:
`python main.py`
3. Run the test client:
`python test_client.py`
---
### [python_a2a_demo](python_a2a_demo/)
- **Purpose:** Rich demos using the [python-a2a](https://pypi.org/project/python-a2a/) library, including custom agents, OpenAI integration, and LangChain tools.
- **Key files:**
- `echo_agent.py`, `echo_client.py`: Echo agent and client using python-a2a.
- `calculator_agent.py`, `calculator_client.py`: Calculator agent with math skills.
- `greeting_agent.py`, `greeting_client.py`: Agent that responds to greetings.
- `llm_agent.py`, `llm_client.py`: OpenAI-powered agent and client.
- `langchain_to_a2a_server.py`, `langchain_to_a2a_client.py`: LangChain integration examples.
- **How to run:**
1. Install dependencies:
`uv sync` (see `pyproject.toml`)
2. Start any agent server, e.g.:
`python echo_agent.py`
3. Run the corresponding client, e.g.:
`python echo_client.py`
---
## Acknowledgements
- [FastAPI](https://fastapi.tiangolo.com/)
- [python-a2a](https://python-a2a.readthedocs.io/en/latest/)
- [Google A2A SDK](https://github.com/google/a2a)
- [LangChain](https://python.langchain.com/)