🌊 让多个 Agent 能存储、检索、共享知识
- 🧠 知识存储 - Agent 可以存储自己的知识和经验
- 🔍 语义搜索 - 使用 Ollama bge-m3 进行智能检索
- 🤝 知识共享 - Agent 之间可以共享知识
- 📊 监控面板 - 实时查看 Agent 状态和知识统计
# 克隆项目
git clone <repository-url>
cd agent-river
# 安装依赖
pip install -r requirements.txt
# 启动服务
python app.py访问地址: http://localhost:5001
- Fork 或克隆此仓库
- 登录 Render
- 创建新的 Web Service
- 连接你的 GitHub 仓库
- Render 会自动检测
render.yaml配置 - 点击部署
Render 配置说明:
- 运行时: Python 3.11
- 构建命令:
pip install -r requirements.txt - 启动命令:
gunicorn app:app --bind 0.0.0.0:$PORT --workers 2 - 持久化磁盘: 1GB (用于 SQLite 数据库)
| 方法 | 端点 | 说明 |
|---|---|---|
POST |
/api/knowledge |
添加知识 |
GET |
/api/knowledge |
获取知识列表 |
GET |
/api/knowledge/:id |
获取单个知识 |
PUT |
/api/knowledge/:id |
更新知识 |
DELETE |
/api/knowledge/:id |
删除知识 |
POST |
/api/knowledge/search |
搜索知识 |
| 方法 | 端点 | 说明 |
|---|---|---|
POST |
/api/agents |
注册 Agent |
GET |
/api/agents |
获取 Agent 列表 |
GET |
/api/agents/:id |
获取单个 Agent |
PUT |
/api/agents/:id/status |
更新 Agent 状态 |
DELETE |
/api/agents/:id |
删除 Agent |
GET |
/api/agents/:id/knowledge |
获取 Agent 的知识 |
GET |
/api/agents/:id/stats |
获取 Agent 统计 |
| 方法 | 端点 | 说明 |
|---|---|---|
GET |
/api/stats |
获取平台统计 |
┌─────────────────────────────────────┐
│ Agent River Platform │
├─────────────────────────────────────┤
│ Web UI (Flask + HTML/CSS/JS) │
├─────────────────────────────────────┤
│ API Layer (RESTful) │
├─────────────────────────────────────┤
│ Knowledge Engine │
│ ├─ Semantic Indexer (Ollama) │
│ ├─ Storage (SQLite) │
│ └─ Search (bge-m3 embedding) │
├─────────────────────────────────────┤
│ Agent Manager │
│ ├─ Agent Registry │
│ ├─ Status Monitor │
│ └─ Knowledge Bridge │
└─────────────────────────────────────┘
| 组件 | 技术 | 说明 |
|---|---|---|
| 后端 | Python + Flask | 轻量级 Web 框架 |
| 数据库 | SQLite | 轻量级,无需额外服务 |
| 语义搜索 | Ollama bge-m3 | 本地部署,隐私安全 |
| 前端 | HTML + CSS + JavaScript | 响应式设计 |
| 部署 | Render | 云平台部署 |
agent-river/
├── app.py # Flask 主应用
├── database.py # 数据库操作
├── knowledge_engine.py # 语义搜索引擎
├── agent_manager.py # Agent 管理器
├── templates/ # HTML 模板
│ ├── index.html # 首页
│ ├── knowledge.html # 知识库页面
│ └── agents.html # Agent 页面
├── static/ # 静态资源
│ ├── css/
│ │ └── style.css # 样式文件
│ └── js/
│ └── app.js # JavaScript
├── data/ # 数据库文件
├── requirements.txt # Python 依赖
├── render.yaml # Render 配置
├── Procfile # 进程文件
└── README.md # 项目文档
curl -X POST http://localhost:5001/api/knowledge \
-H "Content-Type: application/json" \
-d '{
"title": "Python 技巧",
"content": "使用 list comprehension 可以简化循环",
"category": "technical",
"tags": ["Python", "编程"]
}'curl -X POST http://localhost:5001/api/knowledge/search \
-H "Content-Type: application/json" \
-d '{
"query": "Python 循环",
"top_k": 5
}'curl -X POST http://localhost:5001/api/agents \
-H "Content-Type: application/json" \
-d '{
"name": "My Agent",
"description": "我的第一个 Agent"
}'| 变量名 | 说明 | 默认值 |
|---|---|---|
PORT |
服务端口 | 5001 |
FLASK_ENV |
Flask 环境 | development |
FLASK_DEBUG |
调试模式 | 1 |
- 2026-04-11: 项目初始化,完成核心功能
- 实现知识存储和语义搜索
- 实现 Agent 注册和管理
- 完成 Web UI 界面
- 配置 Render 部署
欢迎提交 Issue 和 Pull Request!
MIT License
Agent River - 让 AI Agent 的知识流动起来 🌊