Share
## https://sploitus.com/exploit?id=859FF433-686A-5B73-9687-9FEFC9E41907
# A2A Travel Agency Multi-Agent System
A Proof of Concept demonstrating **Agent-to-Agent (A2A) Communication Protocol** and **Model Context Protocol (MCP)** for cross-organizational interoperability in a travel booking scenario.
## π― Overview
This system showcases how multiple specialized AI agents from different organizations can collaborate to fulfill complex user requests through standardized protocols. A Travel Agency Orchestrator coordinates with external partner agents (flights, hotels, insurance, transport) to assemble complete holiday packages.
## ποΈ Architecture
### Layered Protocol Stack
1. **A2A Layer**: Agent identity, discovery (Agent Cards), and message transport
2. **MCP Layer**: Standardized tool definitions and execution interface
### System Components
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React UI (Port 5173) β
β Real-time SSE streaming interface β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β Travel Orchestrator Agent (Port 8001) β
β β’ Coordinates multi-agent workflows β
β β’ Streams progress updates via SSE β
β β’ Handles async webhooks & polling β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β Discovery
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β Gateway Service (Port 8000) β
β β’ Agent registration & discovery β
β β’ Capability-based routing β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ¬βββββββββββββββ
β β β β
βββββββββΌβββββββ ββββββββΌβββββββ βββββββββΌβββββββ ββββββΌββββββ
βFlight Agent β βHotel Agent β βInsurance β βTransport β
β(Port 8010) β β(Port 8011) β βAgent β βAgent β
β β β β β(Port 8012) β β(8013) β
ββ’ Streaming β ββ’ Sync β ββ’ Sync β ββ’ Sync β
ββ’ Webhooks β β search β β quotes β β quotes β
ββ’ Polling β β β β β β β
ββββββββββββββββ βββββββββββββββ ββββββββββββββββ ββββββββββββ
```
## π Project Structure
```
A2A/
βββ a2a/
β βββ agents/ # A2A agent implementations
β β βββ agent_travel_orchestrator.py
β β βββ agent_flights.py
β β βββ agent_hotels.py
β β βββ agent_insurance.py
β β βββ agent_transport.py
β βββ mcp_servers/ # MCP tool servers with mock data
β βββ schemas/ # Protocol & domain schemas
β β βββ schema_a2a.py
β β βββ schema_mcp.py
β β βββ schema_travel.py
β βββ services/
β βββ gateway_service.py
βββ ui/ # React + TypeScript frontend
βββ run_poc.py # Launch all services
βββ test_scenarios.py # Automated test scenarios
βββ requirements.txt
```
## π Getting Started
### Prerequisites
- Python 3.9+
- Node.js 18+ (for UI)
### Backend Setup
```bash
# Create virtual environment
python -m venv venv
.\venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
# Launch all services
python run_poc.py
```
This starts:
- **Gateway**: http://localhost:8000
- **Orchestrator**: http://localhost:8001
- **Flight Agent**: http://localhost:8010
- **Hotel Agent**: http://localhost:8011
- **Insurance Agent**: http://localhost:8012
- **Transport Agent**: http://localhost:8013
### Frontend Setup
```bash
cd ui
npm install
npm run dev
```
Access the UI at: http://localhost:5173
## π¬ Use Case: Holiday Package Booking
### User Journey
1. User requests a holiday to Lisbon via chat interface
2. Orchestrator analyzes request and discovers partner agents
3. Parallel coordination:
- **Flights**: Streaming search with real-time progress updates
- **Hotels**: Synchronous search for 4-star accommodations
- **Insurance**: Quote calculation based on travelers & duration
- **Transport**: Airport transfer estimation
4. Results assembled into complete package with total price
5. User sees real-time updates character-by-character via SSE
### Example Request Flow
```
User: "I need a holiday to Lisbon for 2 people, March 15-22"
β
Orchestrator discovers agents via Gateway
β
Flight Agent (streaming): "Searching airlines... Found 5 options..."
Hotel Agent: Returns 4-star hotels in Lisbon
Insurance Agent: Calculates quote for 2 travelers, 7 days
Transport Agent: Estimates airport transfer cost
β
Complete package presented with itemized pricing
```
## β¨ Key Features Demonstrated
### Protocol Features
- β
**Agent Discovery**: Dynamic capability-based agent lookup
- β
**Agent Cards**: Self-describing agent capabilities (MCP tools)
- β
**JSON-RPC 2.0**: Standardized message format
- β
**Protocol Layering**: A2A wraps MCP for cross-org communication
### Communication Patterns
- β
**Synchronous RPC**: Direct request-response (hotels, insurance, transport)
- β
**Streaming**: Real-time progress updates (flight search)
- β
**Async Webhooks**: Callback-based notifications
- β
**Polling Fallback**: Status checking when webhooks fail
### User Experience
- β
**Server-Sent Events (SSE)**: Character-by-character streaming to UI
- β
**Real-time Progress**: Live updates during multi-agent orchestration
- β
**Notification Center**: Push notifications for completed tasks
- β
**Responsive UI**: Modern React interface with Tailwind CSS
## π§ͺ Testing
### Run Test Scenarios
```bash
# All scenarios (S1-S4)
python test_scenarios.py
# Specific failure scenario
python test_s4_failure.py
# Verify backend health
python verify_backend.py
```
### Test Scenarios
- **S1**: Full happy path with all agents available
- **S2**: Flight streaming with fallback to webhooks
- **S3**: Webhook timeout with polling fallback
- **S4**: Critical agent unavailable (failure case)
## π§ Development
### Start Individual Services
```bash
# Terminal 1 - Gateway
python a2a/services/gateway_service.py
# Terminal 2 - Orchestrator
python a2a/agents/agent_travel_orchestrator.py
# Terminal 3 - Flight Agent
python a2a/agents/agent_flights.py
# ... etc
```
### Environment Variables
No configuration needed for POC. All services use hardcoded localhost ports.
## π API Endpoints
### Orchestrator (Port 8001)
- `POST /chat/message` - Initiate booking request
- `GET /chat/stream/{task_id}` - SSE stream for real-time updates
- `POST /a2a/webhook` - Receive async agent callbacks
- `GET /notifications` - Poll for push notifications
### Gateway (Port 8000)
- `POST /register` - Agent registration
- `POST /discover` - Find agents by capability
- `GET /agents` - List all registered agents
### Partner Agents (Ports 8010-8013)
- `POST /a2a/message` - Receive A2A protocol messages
- `GET /card` - Retrieve agent card (capabilities)
## π Learning Resources
This POC demonstrates concepts from:
- [Google's A2A Protocol](https://github.com/google/a2a)
- [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
- Multi-agent orchestration patterns
- Real-time streaming architectures
## π License
Educational POC - see thesis documentation for academic context.