Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions agents/a2a/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Keycloak Configuration
# Use service name 'keycloak' when running in Docker network
# Use 'localhost' when running agents outside Docker
KEYCLOAK_URL=http://keycloak:8080
KEYCLOAK_REALM=mcp-gateway

# MCP Registry
# MUST use port 80 (nginx) for proper JWT authentication, not direct registry access (port 7860)
# Use service name 'registry' when running in Docker network
# Use 'localhost' when running agents outside Docker
MCP_REGISTRY_URL=http://registry

# Travel Assistant Agent M2M Credentials
# Get these from: ../../.oauth-tokens/agent-test-agent-m2m.json
TRAVEL_AGENT_M2M_CLIENT_ID=agent-test-agent-m2m
TRAVEL_AGENT_M2M_CLIENT_SECRET=your-secret-here

# Flight Booking Agent M2M Credentials
# You can use the same credentials or create separate ones
FLIGHT_BOOKING_M2M_CLIENT_ID=agent-test-agent-m2m
FLIGHT_BOOKING_M2M_CLIENT_SECRET=your-secret-here
28 changes: 28 additions & 0 deletions agents/a2a/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Environment variables with secrets
.env

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
.venv/

# Docker
.tmp/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
10 changes: 6 additions & 4 deletions agents/a2a/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Two AI agents built with AWS Bedrock AgentCore and the Strands framework for fli
- Searches for available flights between cities
- Provides flight recommendations based on price and preferences
- Returns detailed flight information (times, prices, airlines)
- **Discovers other agents** through the MCP Gateway Registry and dynamically adds them as tools
- [Full specification](https://github.com/agentic-community/mcp-gateway-registry/issues/196)

**Flight Booking Agent** (`flight_booking_agent`)
Expand All @@ -29,12 +30,13 @@ Run agents locally with full FastAPI server including custom API endpoints.

**Deploy:**
```bash
# Configure AWS credentials (one of these methods)
export AWS_PROFILE=your_profile_name
# 1. Get AWS credentials (for Isengard users)
isengard credentials --account YOUR_ACCOUNT --role YOUR_ROLE --export

# Or use EC2 IAM role (no export needed)
# This exports: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
# Docker will automatically pick these up from your environment

# Then deploy (auto-detects your system architecture)
# 2. Deploy (auto-detects your system architecture)
# From repo root:
agents/a2a/deploy_local.sh

Expand Down
27 changes: 27 additions & 0 deletions agents/a2a/docker-compose.arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ services:
- DB_PATH=/app/data/flights.db
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-}
- AGENT_NAME=travel-assistant
- AGENTCORE_RUNTIME_URL=http://travel-assistant-agent:9000/
# Keycloak M2M authentication for agent discovery
- KEYCLOAK_URL=${KEYCLOAK_URL:-http://keycloak:8080}
- KEYCLOAK_REALM=${KEYCLOAK_REALM:-mcp-gateway}
- M2M_CLIENT_ID=${TRAVEL_AGENT_M2M_CLIENT_ID:-agent-test-agent-m2m}
- M2M_CLIENT_SECRET=${TRAVEL_AGENT_M2M_CLIENT_SECRET}
- MCP_REGISTRY_URL=${MCP_REGISTRY_URL:-http://registry}
volumes:
- travel_assistant_data:/app/data
healthcheck:
Expand All @@ -38,8 +47,17 @@ services:
- DB_PATH=/app/data/bookings.db
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-}
- AGENT_NAME=flight-booking
- AGENTCORE_RUNTIME_URL=http://flight-booking-agent:9000/
# Keycloak M2M authentication for agent discovery
- KEYCLOAK_URL=${KEYCLOAK_URL:-http://keycloak:8080}
- KEYCLOAK_REALM=${KEYCLOAK_REALM:-mcp-gateway}
- M2M_CLIENT_ID=${FLIGHT_BOOKING_M2M_CLIENT_ID:-agent-test-agent-m2m}
- M2M_CLIENT_SECRET=${FLIGHT_BOOKING_M2M_CLIENT_SECRET}
- MCP_REGISTRY_URL=${MCP_REGISTRY_URL:-http://registry}
volumes:
- flight_booking_data:/app/data
healthcheck:
Expand All @@ -54,3 +72,12 @@ volumes:
driver: local
flight_booking_data:
driver: local

networks:
default:
# Use the external network created by the main mcp-gateway-registry docker-compose
# "default" is the logical network name used within this compose file
# "external: true" means this network already exists and should not be created
# This allows agents to communicate with gateway/registry services on the same network
name: mcp-gateway-registry_default
external: true
28 changes: 27 additions & 1 deletion agents/a2a/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ services:
- DB_PATH=/app/data/flights.db
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-}
- AGENT_NAME=travel-assistant
- AGENTCORE_RUNTIME_URL=http://travel-assistant-agent:9000/
- KEYCLOAK_URL=${KEYCLOAK_URL}
- KEYCLOAK_REALM=${KEYCLOAK_REALM}
- MCP_REGISTRY_URL=${MCP_REGISTRY_URL}
- M2M_CLIENT_ID=${TRAVEL_AGENT_M2M_CLIENT_ID}
- M2M_CLIENT_SECRET=${TRAVEL_AGENT_M2M_CLIENT_SECRET}
volumes:
- travel_assistant_data:/app/data
healthcheck:
Expand All @@ -38,8 +46,16 @@ services:
- DB_PATH=/app/data/bookings.db
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-}
- AGENT_NAME=flight-booking
- AGENTCORE_RUNTIME_URL=http://flight-booking-agent:9000/
- KEYCLOAK_URL=${KEYCLOAK_URL}
- KEYCLOAK_REALM=${KEYCLOAK_REALM}
- MCP_REGISTRY_URL=${MCP_REGISTRY_URL}
- M2M_CLIENT_ID=${FLIGHT_BOOKING_M2M_CLIENT_ID}
- M2M_CLIENT_SECRET=${FLIGHT_BOOKING_M2M_CLIENT_SECRET}
volumes:
- flight_booking_data:/app/data
healthcheck:
Expand All @@ -53,4 +69,14 @@ volumes:
travel_assistant_data:
driver: local
flight_booking_data:
driver: local
driver: local

networks:
default:
# Use the external network created by the main mcp-gateway-registry docker-compose
# "default" is the logical network name used within this compose file
# "name" overrides the actual Docker network name (prevents creating a2a_default)
# "external: true" means this network already exists and should not be created
# This allows agents to communicate with gateway/registry services on the same network
name: mcp-gateway-registry_default
external: true
5 changes: 3 additions & 2 deletions agents/a2a/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[project]
name = "travel-agents"
name = "a2a"
version = "0.1.0"
description = "Travel and Flight Booking Agents"
requires-python = ">=3.12"
requires-python = ">=3.12,<3.13"
dependencies = [
"fastapi>=0.115.12",
"uvicorn[standard]>=0.34.2",
"strands-agents[a2a]>=0.1.6",
"pydantic>=2.11.3",
"python-dotenv>=1.1.0",
"aiohttp>=3.8.0",
]

[project.optional-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion agents/a2a/src/flight-booking-agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
description="Flight booking and reservation management agent",
tools=FLIGHT_BOOKING_TOOLS,
callback_handler=None,
model="us.anthropic.claude-haiku-4-5-20251001-v1:0",
model="global.anthropic.claude-sonnet-4-5-20250929-v1:0",
)

env_settings = get_env()
Expand Down
2 changes: 1 addition & 1 deletion agents/a2a/src/travel-assistant-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:9000/ping || exit 1

# Run the agent with uv (uses the virtual environment created by uv sync)
CMD ["uv", "run", "--no-sync", "agent.py"]
CMD ["uv", "run", "--no-sync", "server.py"]
5 changes: 2 additions & 3 deletions agents/a2a/src/travel-assistant-agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
from .env_settings import env_settings
from .tools import TRAVEL_ASSISTANT_TOOLS

# Configure logging with basicConfig

logging.basicConfig(
level=logging.INFO, # Set the log level to INFO
# Define log message format
level=logging.INFO,
format="%(asctime)s,p%(process)s,{%(filename)s:%(lineno)d},%(levelname)s,%(message)s",
)
logger = logging.getLogger(__name__)
Expand Down
Loading
Loading