智能RFP/提案代理
多代理系统,使用A2A(代理到代理)编排和MCP(模型上下文协议)自动创建专业商业和技术提案。
______________________________________________________________________
演示直播:https://a2a-mcp-multiagent-smart-rfp.streamlit.app/
它解决了什么问题?
撰写商业和技术提案是 耗时、重复的过程 这涉及:
- 研究潜在客户(公司简介、关键决策者、行业背景)
- 分析RFP文件以提取需求、预算限制和评估标准
- 在内部记录中搜索相关的过去项目和案例研究
- 根据团队组成、复杂性和项目范围估算成本
- 撰写一份结构化的专业提案,将所有内容联系在一起
这个系统 自动化整个管道 --从客户研究到最终交付成果——通过一个对话界面协调四个专门的人工智能代理。传统上需要数天的手工工作被简化为一个互动环节。
______________________________________________________________________
建筑
该系统遵循 A2A(代理人对代理人) 由Claude支持的中央编排器协调四个独立代理的模式,每个代理作为一个 MCP(模型上下文协议) 服务器。
┌─────────────────────────────┐
│ User (CLI Chat) │
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Orchestrator (Claude LLM) │
│ A2A Coordination Engine │
│ Agentic Loop (max 10 iter) │
└──┬───────┬───────┬───────┬───┘
│ │ │ │
┌─────────▼──┐ ┌──▼─────┐ ┌▼──────┐ ┌▼────────┐
│ Client │ │Knowledge│ │Proposal│ │ Pricing │
│ Research │ │ Base │ │ Writer │ │ Agent │
│ Agent │ │ Agent │ │ Agent │ │ │
│ (MCP Srv) │ │(MCP Srv)│ │(MCP Sv)│ │(MCP Srv)│
└────────────┘ └────────┘ └────────┘ └─────────┘运作原理
- 用户通过以下方式提交请求 交互式CLI (例如。, _“为Acme Corp创建移动应用项目提案”_)
- 这 编排器 使用Claude分析请求,并确定要调用哪些代理和工具
- 代理人通过以下方式联系 MCP工具执行 --每个代理都作为一个子进程运行,通过stdio进行通信
- 编排器循环(最多10次迭代),调用工具并累积上下文,直到Claude生成最终的合成响应
- 用户收到 完整、专业的提案 准备好提交给客户
- 可选地,该提案是 导出为.docx文件 带有封面、品牌和专业格式
______________________________________________________________________
代理卡(A2A Discovery)
系统使用 代理卡 以实现A2A发现模式。每个代理发布一张卡(通过Pydantic模型在 agent_cards.py)它声明了它的身份、功能以及如何启动它。编排器在运行时读取这些卡,以发现可用的代理和路由任务。
class AgentCard(BaseModel):
agent_id: str # Unique identifier (e.g., "client_research")
name: str # Human-readable name
description: str # What the agent does
version: str # Semantic version
status: AgentStatus # available | busy | offline
skills: list[AgentSkill] # List of capabilities with MCP tool mappings
mcp_server_command: list[str] # Command to launch the MCP server subprocess
dependencies: list[str] # Other agent IDs this agent depends on每 AgentSkill 的 将高级功能映射到特定的MCP工具,并包括示例查询,帮助编排器了解何时调用它:
| 代理卡 | 技能 | 依赖关系 |
|---|---|---|
client_research | company_research, rfp_analysis, linkedin_research | — |
knowledge_base | project_search, project_details, tech_stack_search, case_studies | — |
proposal_writer | full_proposal, timeline, executive_summary, export_docx | client_research, knowledge_base |
pricing | project_estimation, custom_estimation, rate_card | — |
所有卡片均已注册 AGENT_REGISTRY,使添加新代理变得容易——只需定义一个新代理 AgentCard 并注册它。
______________________________________________________________________
代理
客户研究代理
使用网络搜索和人工智能分析调查潜在客户。
| 工具 | 说明 |
|---|---|
search_company_info | 通过Tavily搜索网络,并使用Claude提取结构化的公司简介 |
analyze_rfp_document | 解析RFP文本以提取需求、预算、时间表和评估标准 |
search_linkedin_company | 通过LinkedIn代理搜索查找关键决策者和公司信息 |
知识库代理
在过去项目的内部数据库中搜索相关经验和案例研究。
| 工具 | 说明 |
|---|---|
search_past_projects | 关键字匹配+内部项目克劳德语义排名 |
get_project_details | 按ID检索特定项目的完整详细信息 |
search_tech_stack | 查找使用特定技术的项目 |
get_case_studies | 检索与客户行业部门相关的案例研究 |
提案撰写代理
生成专业、结构化的提案,并提供双语支持(英语/西班牙语)。
| 工具 | 说明 |
|---|---|
generate_proposal | 根据收集的上下文创建完整的8节提案 |
generate_timeline | 用里程碑和可交付成果构建项目阶段 |
generate_executive_summary | 将提案提炼成关键的高管谈话要点 |
export_proposal_docx | 将降价方案导出到专业Word(.docx)文件 |
建议书章节: 执行摘要、理解、拟议解决方案、方法论、团队、案例研究、投资、下一步
定价代理
使用可配置的团队组成、复杂性乘数和折扣级别估算项目成本。
| 工具 | 说明 |
|---|---|
estimate_project | AI分析范围,推荐团队组成,并计算总成本 |
estimate_from_roles | 基于团队的手动定价,支持自定义角色选择 |
get_rate_card | 返回小时费率、复杂性乘数和折扣规则 |
定价特点:
- 9个预定义的角色,每小时收费(60-100欧元/小时)
- 复杂度乘数:低(0.8倍)到非常高(1.6倍)
- 折扣等级:标准、长期、战略(最高10%)
- 基于阶段的成本分配(发现8%,设计12%,开发50%,测试15%,部署15%)
______________________________________________________________________
技术栈
| 类别 | 技术 | 目的 |
|---|---|---|
| LLM | API人类克劳德 | 推理、分析、内容生成 |
| 代理框架 | MCP(模型上下文协议) /FastMCP | 代理服务器框架和工具注册 |
| 编排 | A2A协议 | 多代理协调和路由 |
| 网页搜索 | 美味API | 公司研究和LinkedIn代理搜索 |
| HTTP客户端 | httpx | 异步HTTP请求到外部API |
| 验证 | Pydantic v2 | 输入/输出数据验证和序列化 |
| 文档导出 | python docx | 将提案导出到专业Word(.docx)文件 |
| 前端 | 溪流 | 基于Web的聊天UI,具有代理可见性 |
| 配置 | python dotenv | 环境变量管理 |
| 语言 | Python 3.10+ | 异步/等待、类型提示、结构模式匹配 |
______________________________________________________________________
项目结构
smart-rfp-agent/
├── agents/
│ ├── client_research/ # Client & RFP research agent
│ │ ├── server.py # MCP server definition & entrypoint
│ │ ├── tools.py # Tool implementations (Tavily + Claude)
│ │ └── models.py # Pydantic input/output models
│ ├── knowledge_base/ # Internal project database agent
│ │ ├── server.py # MCP server definition
│ │ ├── tools.py # Search & ranking logic
│ │ ├── models.py # Pydantic models
│ │ └── data/
│ │ └── projects.json # Past projects database
│ ├── proposal_writer/ # Proposal generation agent
│ │ ├── server.py # MCP server definition
│ │ ├── tools.py # Proposal generation logic
│ │ ├── models.py # Pydantic models (bilingual support)
│ │ └── templates/
│ │ └── proposal_structure.json # 8-section proposal template
│ └── pricing/ # Cost estimation agent
│ ├── server.py # MCP server definition
│ ├── tools.py # Pricing calculation logic
│ ├── models.py # Pydantic models
│ └── data/
│ └── rate_card.json # Rates, multipliers & discounts
├── orchestrator/
│ ├── main.py # Interactive CLI entrypoint
│ ├── orchestrator.py # A2A engine (Claude + agentic loop)
│ ├── agent_cards.py # Agent capability registry
│ └── mcp_client.py # MCP subprocess connection manager
├── streamlit_helpers/
│ ├── async_bridge.py # Async-to-sync bridge (background event loop)
│ └── components.py # Reusable UI components (sidebar, chat, i18n)
├── shared/
│ ├── utils.py # Shared error handling utilities
│ └── docx_exporter.py # Markdown → DOCX converter with branding
├── config/
│ └── settings.py # Environment variables & configuration
├── app.py # Streamlit web frontend
├── requirements.txt
└── .env.example______________________________________________________________________
设置
先决条件
- Python 3.10+
- 无烟煤API键
- Tavilly API密钥 (用于网络搜索)
安装
# Clone the repository
git clone https://github.com/your-username/smart-rfp-agent.git
cd smart-rfp-agent
# Install dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Edit .env and add your API keys环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
ANTHROPIC_API_KEY | 是 | Claude API访问密钥 |
TAVILY_API_KEY | 是 | Tavilly网络搜索API密钥 |
LINKEDIN_CLIENT_ID | 否 | LinkedIn API客户端ID |
LINKEDIN_CLIENT_SECRET | 否 | LinkedIn API客户机密 |
MCP_TRANSPORT | 否 | 传输协议(默认值: stdio) |
MCP_PORT | 无 | 服务器端口(默认值: 8000) |
跑步
Web UI(Streamlit)——推荐:
streamlit run app.py这将打开一个基于浏览器的聊天界面,其中包含:
- 与AI编排器进行实时对话
- 侧栏显示连接的代理及其技能
- 语言选择器(英语/西班牙语)
- 一键DOCX导出和下载
- 新建对话按钮
CLI(终端):
python orchestrator/main.py| 命令 | 描述 |
|---|---|
/new | 开始新的对话 |
/agents | 列出可用的代理及其工具 |
/quit | 退出应用程序 |
独立运行代理
每个代理都可以作为MCP服务器独立运行,以进行测试或集成:
python agents/client_research/server.py
python agents/knowledge_base/server.py
python agents/proposal_writer/server.py
python agents/pricing/server.py______________________________________________________________________
示例用法
> Research Acme Corp and create a proposal for a mobile e-commerce app
[Orchestrator calls Client Research Agent → searches company info]
[Orchestrator calls Knowledge Base Agent → finds similar past projects]
[Orchestrator calls Pricing Agent → estimates project cost]
[Orchestrator calls Proposal Writer Agent → generates full proposal]
✅ Complete 8-section proposal generated with:
- Company analysis and context
- Technical solution architecture
- Relevant case studies from past projects
- Detailed cost breakdown and timeline
- Executive summary and next steps
> Export the proposal to Word
[Proposal Writer Agent → exports to DOCX]
✅ Saved to exports/proposal_acme_corp_20260207_143022.docx______________________________________________________________________
关键设计决策
- MCP over REST:代理通过基于stdio的MCP而不是HTTP进行通信,消除了网络开销并简化了本地部署
- 代理循环:编排器让Claude决定调用哪些工具以及调用顺序,从而实现灵活的多步骤推理
- 双语支持:提案可以通过一个简单的语言参数以英语或西班牙语生成
- 可配置定价:价目表、复杂度乘数和折扣级别存储在JSON文件中,无需更改代码即可轻松定制
- DOCX导出:提案可以通过以下方式导出到具有封面、品牌样式、页眉/页脚和页码的专业Word文档中
python-docx - 代理卡(A2A发现):每个代理发布一张结构化卡片,声明其技能、MCP工具映射和依赖关系,实现动态发现和可扩展性
- 模块化代理:每个代理都是完全独立的,可以在不影响系统其他部分的情况下进行开发、测试或替换
