基于Google ADK、A2A协议和MCP集成的AI Agent项目
该项目是一个与Google ADK(代理开发工具包)集成的AI代理的实现,支持A2A(代理到代理)协议,用于与其他代理交互,并可通过MCP(模型上下文协议)服务器进行扩展。该项目包括一个即用型基础设施,用于开发、测试和部署具有监控和跟踪功能的人工智能代理。
🎯 特性
- 谷歌ADK集成 -使用业界领先的SDK进行代理开发
- MCP工具支持 -与可扩展工具的模型上下文协议集成
- 文学硕士 -通过单一界面支持各种LLM模型
- 凤凰监控 -可选的监控和执行跟踪
- Docker就绪 -全集装箱化,自动配置
- A2A协议 -代理间通信
- 灵活的配置 -通过环境变量进行配置
📁 结构工程
a2a-adk-mcp-example/
├── agent/ # Agent directory
│ ├── app/ # Main application code
│ │ ├── __main__.py # Click CLI entry point
│ │ ├── agent.py # AgentEvolution class
│ │ └── agent_executor.py # Agent executor
│ ├── .env.example # Sample configuration file
│ ├── pyproject.toml # Project configuration and dependencies
│ └── README.md # Agent documentation
├── mcp-weather/ # MCP Weather Server
│ ├── server.py # Main server
│ ├── Dockerfile # Docker configuration
│ └── README.md # MCP Server Documentation
├── nginx/ # Nginx configuration
├── docker-compose.phoenix.yml # Phoenix configuration
├── docker-compose.yml # Main Docker Compose configuration
├── Makefile # Command automation
└── .gitignore # Ignored files🛠 安装和快速启动
Docker快速入门(推荐)
# Building images
make build
# Starting basic services
make up
# The agent will be available at http://localhost:10002
# The MCP server will be available at http://localhost:8001使用Makefile
# Viewing all available commands
make help
# Starting basic services
make up
# Running with Phoenix monitoring
make phoenix
# Development mode
make dev
# Viewing logs
make logs
# Stopping all services
make down⚙️ 配置
创建环境文件
# Creating a .env file from the example
make env
# Or manually
cp agent/.env.example .env基本环境变量
以下参数可以在 .env 文件:
# Basic settings Agent
AGENT_NAME=jira_mcp_agent
AGENT_DESCRIPTION="Jira MCP agent for managing projects, tasks, sprints, and agile processes"
AGENT_VERSION=1.0.0
# Model Configuration
LLM_MODEL="evolution_inference/model-for-agent-space-test"
LLM_API_BASE="https://your-model-api-base-url/v1"
# MCP Configuration
MCP_URL=http://mcp-weather:8001/sse
# Phoenix Monitoring (optional)
PHOENIX_PROJECT_NAME="ip_agent_adk"
PHOENIX_ENDPOINT="http://phoenix:6006/v1/traces"
# Server Settings
HOST="0.0.0.0"
PORT="10002"
# Monitoring
ENABLE_PHOENIX="false"
ENABLE_MONITORING="true"🚀 用法
启动代理
# Starting the main services
make up
# The agent will be available at http://localhost:10002开发模式
# Running in development mode with live reload
make dev
# Running with Phoenix monitoring for debugging
make dev-phoenix检查状态
# Status of all services
make status
# Health check
make health
# Viewing logs
make logs🧩 项目组成部分
代理人(代理人/)
该项目的主要组成部分是一个基于谷歌ADK的人工智能代理,支持MCP工具。代理实现A2A协议,用于与其他代理交互。
API终点
GET /-代理人信息(代理人卡)POST /tasks-创建新任务GET /tasks/{task_id}-获取任务状态GET /tasks/{task_id}/stream-SSE任务执行流
MCP天气服务器(MCP-Weather/)
服务器提供通过MCP协议检索天气数据的工具。它使用免费的Open-Meteo API。
工具
get_today_weather(city: str)-获取指定城市的当前天气get_weekly_forecast(city: str)-获取指定城市的每周天气预报
端点
- 上海证券交易所:
http://localhost:8001/sse - 消息:
http://localhost:8001/messages/
📊 监控
凤凰追踪
要启用Phoenix监控,请设置环境变量:
ENABLE_PHOENIX=true与Phoenix一起跑步:
make phoenixPhoenix Dashboard将在以下网址提供http://localhost:6006
🐳 Docker命令
# Basic Commands
make build # Build images
make up # Start services
make down # Stop services
make restart # Restart
make logs # View logs
# Phoenix Monitoring
make phoenix # Start with monitoring
make phoenix-down # Stop Phoenix
# Utilities
make shell # Enter the agent container
make clean # Clean up Docker resources📋 需求
- 码头工人:用于集装箱化
- 制造:用于指挥自动化
- MCP服务器:用于工具(可选)
📄 许可证
这个项目是在MIT许可下分发的。请参阅 LICENSE 文件以获取详细信息(如果存在)。
