Content
# A2A Demo - Agent Communication Demonstration
This is a demonstration project based on the A2A (Agent-to-Agent) protocol, showcasing how to use the A2A protocol for interaction between agents.
## Features
- 🤖 A2A protocol-supported agent client
- 📡 Streamed response handling
- 🔔 Push notification support
- 📝 User-friendly Chinese interface
- 📁 File attachment support
- 🔄 Task status inquiry
## Main Components
### Client (client.py)
A general A2A agent client that provides the following functionalities:
- Connect to the agent server
- Send messages and files
- Receive streamed responses
- Handle push notifications
- Query task status
### Agent (agent.py)
An agent implementation based on LangGraph, featuring:
- Search capabilities
- File processing
- Conversation memory
- Tool invocation
## Quick Start
### 1. Install Dependencies
```bash
pip install -r requirements.txt
```
Or use uv:
```bash
uv sync
```
### 2. Configure Environment Variables
Copy `.env.example` to `.env` and configure the necessary parameters:
```bash
cp .env.example .env
```
### 3. Start the Agent Server
```bash
python -m a2a_demo.app.agent
```
### 4. Connect Using the Client
```bash
python -m a2a_demo.app.client --url http://localhost:10001
```
## Usage
### Basic Conversation
After starting the client, you can:
1. Enter questions to converse with the agent
2. Attach files (optional)
3. View streamed responses
4. Type `:q` or `quit` to exit
### Push Notifications
Enable push notification functionality:
```bash
python -m a2a_demo.app.client --url http://localhost:10001 --push
```
### Query Specific Tasks
Inquire about the status of existing tasks:
```bash
python -m a2a_demo.app.client --task-id <TaskID>
```
### Non-Streaming Mode
Use non-streaming request mode:
```bash
python -m a2a_demo.app.client --url http://localhost:10001 --no-streaming
```
## Project Structure
```
a2a_demo/
├── app/
│ ├── agent.py # Agent implementation
│ ├── client.py # Client implementation
│ └── agent_executor.py # Agent executor
├── pyproject.toml # Project configuration
├── .env.example # Environment variable example
└── README.md # Project description
```
## Dependency Requirements
- Python 3.9+
- a2a-python
- langchain-openai
- langgraph
- httpx
- uvicorn
- python-dotenv
- click
## License
MIT License
## Contribution
Contributions are welcome! Please submit Issues and Pull Requests!
## Contact
If you have any questions, please reach out via Issues.