代理博士联盟
专注于医疗保健的AI代理仪表板和MCP服务器
该存储库包含一个与Streamlit仪表板配对的模型上下文协议(MCP)FastAPI服务器,旨在编排人工智能驱动的医疗工作流程(预约提醒、跟进电话、账单更新)。它集成了:
- 双子座/CrewAI 用于生成AI响应
- SendGrid (通过单一发件人)用于出站电子邮件
- 提里奥 (测试或直播)用于出站短信
- Gmail API 用于入站电子邮件监控
- \*\*WebSocket\*\*用于实时弹出通知
______________________________________________________________________
流程图
序列图
存储库结构
adrija-crewai-agent/
├── .env.example # Template for environment variables
├── requirements.txt # Python dependencies
└── src/
└── doctoralliance_agent/
├── __init__.py
├── server.py # FastAPI MCP endpoints
├── streamlit_app.py # Streamlit UI
├── crew.py # Optional CrewAI kickoff script
├── persona_resolver.py
├── data_fetcher.py
├── summary_builder.py
├── vault.py
├── agents/
│ ├── __init__.py
│ ├── prompt_builder.py
│ └── gemini_agent.py
├── delivery/
│ ├── __init__.py
│ ├── channel_selector.py
│ ├── email.py
│ ├── sms_gateway.py
│ ├── popup.py
│ └── logger.py
├── escalation/
│ ├── __init__.py
│ ├── reminder_scheduler.py
│ └── retry_agent.py
└── gmail/
├── __init__.py
├── gmail_agent.py
├── nlp_parser.py
└── response_handler.py______________________________________________________________________
快速启动
1.克隆仓库
git clone https://github.com/your-org/adrija-crewai-agent.git
cd mcp-server-for-doctoralliance2.环境变量
复制 .env.example 向 .env 并填写您的凭据:
# Windows PowerShell
Copy-Item .env.example .env
# Linux/macOS
cp .env.example .env编辑 .env:
FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=8000
# Gemini/CrewAI
GEMINI_API_KEY=sk-...
GEMINI_MODEL=gemini-2.0-flash-001
# SendGrid (Single Sender)
SENDGRID_API_KEY=SG-...
FROM_EMAIL=your_verified@domain.com
# Twilio (for SMS testing)
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
TWILIO_FROM_NUMBER=+15005550006
# Gmail (optional)
GMAIL_CREDENTIALS_PATH=./credentials.json
# WebSocket (optional)
WS_URL=ws://localhost:6789放置您的 credentials.json (Gmail OAuth)旁边 .env 如果使用入站电子邮件。
3.安装依赖项
python -m venv venv
# Windows
venv\Scripts\Activate.ps1
# macOS/Linux
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt4.运行MCP服务器
uvicorn doctoralliance_agent.server:app \
--reload --host $FASTAPI_HOST --port $FASTAPI_PORT \
--app-dir src5.启动Streamlit用户界面
streamlit run src/doctoralliance_agent/streamlit_app.py访问 http://localhost:8501 在您的浏览器中。
______________________________________________________________________
MCP端点
- 发布
/mcp/retrieve
- 身体: { "event_type": "appointment_reminder" } - 响应: { "persona": "...", "context": { ... } }
- 发布
/mcp/plan
- 身体:输出 /retrieve - 响应: { "persona": "...", "summary": "..." }
- 发布
/mcp/generate
- 身体:输出 /plan - 响应: { "persona": "...", "response": "..." }
- 发布
/mcp/respond
- 身体: { "event_type":"...", "response":"...", "context":{...} } - 响应:交付结果JSON
______________________________________________________________________
定制
- 角色解析器 (
persona_resolver.py):将事件映射到角色 - 金库 (
vault.py):拦截EHR/Billing/HHA呼叫 - 快速构建器 (
agents/prompt_builder.py):特定于角色的说明 - GeminiAgent (
agents/gemini_agent.py):与CrewAI/Gemini集成 - 交付渠道 (
delivery/):电子邮件、短信、弹出窗口 - 升级 (
escalation/):重试和提醒 - Gmail监听器 (
gmail/):解析入站回复
______________________________________________________________________
测试
- 使用 调用RestMethod 在PowerShell中进行快速API测试
- 使用 test_sms.py 和 test_email.py 隔离信道测试脚本
______________________________________________________________________
