# MyAgent **Repository Path**: MayLight/my-agent ## Basic Information - **Project Name**: MyAgent - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-06 - **Last Updated**: 2025-12-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Multi-Agent 项目 支持 LangGraph Agent 和 DeepAgent 的多智能体系统,可动态切换不同类型的 Agent。 ## 项目结构 ``` demoagent/ ├── agents/ # Agent核心模块 │ ├── __init__.py │ └── agent.py # LangGraph Agent实现 ├── tools/ # 工具模块 │ ├── __init__.py │ └── calculator.py # 计算器工具示例 ├── config.py # 配置文件 ├── main.py # 主入口文件 ├── requirements.txt # 项目依赖 └── README.md # 项目说明 ``` ## 安装 1. 安装依赖: ```bash pip install -r requirements.txt ``` 2. 配置环境变量: 创建 `.env` 文件,添加: ``` OPENAI_API_KEY=your_api_key_here OPENAI_BASE_URL=your_base_url_here # 可选 TAVILY_API_KEY=your_tavily_key_here # DeepAgent 需要 # 环境配置(development 或 production) ENV=development # 开发环境使用 http://localhost:5080/ # ENV=production # 生产环境使用 https://ecgs.fowep.com/prod-api # 后端API地址(可选,会覆盖默认配置) # BACKEND_API_BASE_URL=http://localhost:5080 # 开发环境 # BACKEND_API_BASE_URL=https://ecgs.fowep.com/prod-api # 生产环境 ``` ## 使用 运行主程序: ```bash python main.py ``` 然后可以与 Agent 对话,例如: - "计算 15 + 27" - "100 除以 4 是多少?" - "帮我算一下 8 * 7" ## 架构说明 - **agents/**: 包含 LangGraph Agent 的核心实现 - **tools/**: 包含可调用的工具定义,易于扩展 - **config.py**: 集中管理配置项 - **main.py**: 简单的交互式入口 ## Agent 类型 ### LangGraph Agent - 支持自定义工具 - 基于 LangGraph 的传统 Agent 架构 - 适合需要精确控制工具调用的场景 ### DeepAgent - 自动规划能力 - 内置文件系统工具 - 支持子 Agent 委托 - 适合复杂研究和报告生成任务 - 自带 `internet_search` 工具(需配置 TAVILY_API_KEY) ## 数据库迁移 如果从旧版本升级,需要执行数据库迁移: ```bash mysql -u your_user -p your_database < migrations/add_agent_type.sql ``` ## 扩展工具 在 `tools/` 目录下添加新的工具文件,然后在 `tools/__init__.py` 中导出即可。