Content
# A2A Demo
A demonstration project showcasing Agent-to-Agent (A2A) communication using the Strands framework.
## Overview
This project demonstrates how to create and deploy AI agents that can communicate with each other using the A2A protocol. It includes a basic greeting agent that provides personalized greetings with fortune messages.
## Project Structure
```
a2a-demo/
├── main.py # Main entry point
├── pyproject.toml # Project configuration
├── demos/
│ └── basic_agent/ # Basic greeting agent demo
│ ├── main.py # Agent implementation
│ ├── pyproject.toml # Agent-specific config
│ └── README.md # Agent documentation
└── README.md # This file
```
## Features
- **Basic Greeting Agent**: An A2A-enabled agent that provides personalized greetings with fortune messages
- **A2A Server**: HTTP server for agent-to-agent communication
- **Configurable Port**: Environment variable support for server port configuration
## Requirements
- Python >= 3.14
- Dependencies managed via `uv`
## Installation
1. Clone the repository
2. Install dependencies:
```bash
uv sync
```
## Quick Start
1. **Install dependencies:**
```bash
uv sync
```
2. **Start the server:**
```bash
cd demos/basic_agent
uv run main.py
```
3. **Retrieve the A2A AgentCard:**
```bash
curl http://localhost:8000/.well-known/agent.json
```
The server runs on port 8000 by default. Set `A2A_SERVER_PORT` to use a different port.
## Usage
### Running the Basic Agent
Navigate to the basic agent demo and start the server:
```bash
cd demos/basic_agent
uv run main.py
```
The agent will start an A2A server on port 8000 (default) or the port specified by the `A2A_SERVER_PORT` environment variable.
### Environment Variables
- `A2A_SERVER_PORT`: Port for the A2A server (default: 8000)
## Agent Tools
The basic agent provides the following tool:
- **greet(name: str)**: Generates a personalized greeting with a random fortune message
## Development
This project uses a workspace structure with `uv` for dependency management. The main project coordinates multiple agent demos, each with their own dependencies and configurations.
To add new agent demos:
1. Create a new directory under `demos/`
2. Add the new demo to the workspace members in the root `pyproject.toml`
3. Implement your agent using the Strands framework
## Dependencies
- `strands-agents[a2a]`: Core agent framework with A2A support
- `fortune-python`: Fortune message generation