Content
# A2A Communication Sample Using ADK and CrewAI
## Overview
This project is a sample implementation of basic bidirectional communication (sending and receiving text messages) between agents created with the Google Agent Development Kit (ADK) and agents built using the CrewAI framework, utilizing the Agent2Agent (A2A) protocol.
The aim is to demonstrate the foundation of agent collaboration across different frameworks.
## Directory Structure
```
a2a_adk_crewai_impl/
├── A2A_repo/ # Clone of the Google A2A repository (using samples/python)
├── adk_agent/ # ADK agent related files
│ ├── main.py # Main script for the ADK agent (including A2A server)
│ ├── adk_config.yaml # Configuration file for the ADK agent
│ ├── pyproject.toml # Python project configuration (uv)
│ └── .venv/ # Virtual environment (automatically generated by uv)
├── crewai_agent/ # CrewAI agent related files
│ ├── main.py # Main script for the CrewAI agent (including A2A server)
│ ├── crewai_config.yaml# Configuration file for the CrewAI agent
│ ├── pyproject.toml # Python project configuration (uv)
│ └── .venv/ # Virtual environment (automatically generated by uv)
├── pyproject.toml # Root workspace configuration (uv)
└── README.md # This file
```
## Environment Setup
1. **Prerequisites:**
* Python 3.12 or higher
* [uv](https://github.com/astral-sh/uv) (Python package installer and resolver)
* Git
2. **Clone the Repository:**
```bash
git clone <repository URL of this project> a2a_adk_crewai_impl
cd a2a_adk_crewai_impl
```
3. **Clone the Google A2A Repository:**
Clone Google's A2A repository into the project root (`a2a_adk_crewai_impl`) with the name `A2A_repo`.
```bash
git clone https://github.com/google/A2A.git A2A_repo
```
4. **Prepare Python Environment (uv):**
Use `uv` to install Python 3.12 in the project root (skip if the appropriate version is already installed).
```bash
# Execute if necessary
# uv python install 3.12
```
5. **Install Dependencies (uv sync):**
Use the workspace feature of `uv` to install dependencies for each agent. Run the following command in the project root.
```bash
uv sync --all-members
```
This will install the necessary packages in the virtual environments of both `adk_agent` and `crewai_agent`.
## Configuration Files
The operation of each agent is configured in the `.yaml` files located in their respective directories.
* `adk_agent/adk_config.yaml`: Configuration for the ADK agent (its own Agent ID, listening port, and information of the connected CrewAI agent)
* `crewai_agent/crewai_config.yaml`: Configuration for the CrewAI agent (its own Agent ID, listening port, and information of the connected ADK agent)
By default, the ADK agent listens on port `8001`, and the CrewAI agent listens on port `8002`.
## How to Run
1. **Terminal 1: Start the CrewAI Agent**
```bash
cd /path/to/a2a_adk_crewai_impl/crewai_agent
uv run python main.py
```
The server will start at `http://0.0.0.0:8002`.
2. **Terminal 2: Start the ADK Agent**
```bash
cd /path/to/a2a_adk_crewai_impl/adk_agent
uv run python main.py
```
The server will start at `http://0.0.0.0:8001`.
## Expected Behavior
1. Once both agents are started, each will send a test message (`tasks/send` request) to the other agent based on their configuration files.
2. The terminal logs of each agent will display logs for sending messages to the other (`Sending test message to ...`) and receiving responses from the other (`Received response from target agent: ...`).
3. The terminal logs of each agent will also show logs for receiving the test message sent from the other (`Received SendTask request: ...`).
This confirms that basic bidirectional communication has been established.
## Notes
* This implementation is a demonstration of basic message sending and receiving. The actual task execution logic of CrewAI and ADK is not included (`TaskManager` is a dummy implementation).
* Error handling and security measures are minimal.
* The A2A protocol is under development, and it may stop functioning due to changes in specifications.