Multi-Agent SQL Query System with MCP Support
Wellknown found it in public sources; nobody has proven control of it yet. Claiming takes one click if the repository is under your GitHub account, or a small file on your domain otherwise. Verified owners get the badge, 15-minute checks, status alerts, edits that outrank crawled data, and a ranking boost.
Agents can do it too: POST https://wellknown.network/api/v1/claims with {"agent":"iflow-mcp-kerwinmai-multi-agent-exp","method":"well_known_file"} — machine-readable steps at claim.json, guide at /docs/claim.
Everything here was measured by our prober or read from a registry. Nothing is self-reported.
Attributed to the source that supplied each field. Treated as claims, not facts.
# 多智能体数据查询系统 v2.1 > v2.1 新增:内置 Web 前端(Markdown 渲染、即时加载长期记忆)、REST API、启动脚本等。 基于LangGraph的一主两从多智能体架构,实现智能的数据库查询和分析功能,支持长短期记忆。 [https://github.com/user-attachments/assets/3b1b1513-3c92-4952-b8e1-7e62e77630c9](https://github.com/user-attachments/assets/3b1b1513-3c92-4952-b8e1-7e62e77630c9) ## 架构设计 ``` 主智能体 (MasterAgent) ├── 意图识别:判断用户问题类型(结合用户偏好) ├── 任务路由:选择合适的处理路径 ├── 短期记忆:智能压缩对话历史(LLM总结) ├── 长期记忆:跨会话用户偏好和知识 └── 结果汇总:整合子智能体输出 子智能体1 (SQLQueryAgent) └── NL2SQL转换、执行查询 子智能体2 (DataAnalysisAgent) └── 数据分析、生成洞察 ``` ## 核心功能 **1. 意图识别** - 自动判断4种问题类型 - `simple_answer`: 简单问候 - `sql_only`: 数据查询 - `analysis_only`: 分析历史数据 - `sql_and_analysis`: 查询+分析 **2. 智能路由** - 根据意图调用不同智能体 - 主智能体直接回答 / SQL子智能体 / 数据分析子智能体 / 两者协作 **3. 双层记忆系统** ⭐NEW - **短期记忆(MemorySaver)** - 会话内对话历史保留 - 智能压缩:消息>10条或token>1000时LLM自动总结 - 支持引用历史查询结果 - **长期记忆(LongTermMemory)** - 跨会话持久化用户偏好和知识 - 自动提取:对话≥4条消息时自动提取 - 个性化上下文:意图识别时注入用户历史 - SQLite存储:users、user_preferences、user_knowledge **4. 用户会话管理** ⭐NEW - 用户登录系统(user_id) - 会话隔离(session_id) - 智能thread_id生成(user_id_session_id) - 特殊命令:`new`(新会话)、`info`(查看信息) **5. MCP集成** - 通过MCP协议执行SQL - 独立的MCP服务器处理数据库操作 - 支持扩展多数据源 ## 快速开始 ### 1. 安装依赖 ```bash pip install -r requirements.txt ``` ### 2. 设置API密钥 ```bash # Windows set DASHSCOPE_API_KEY=your_api_key # Linux/Mac export DASHSCOPE_API_KEY=your_api_key ``` ### 3. 初始化数据库 ```bash cd intelligent_data_query/data python init_db.py # 初始化业务数据库 python init_memory_db.py # 初始化长期记忆数据库 ``` ### 4. 运行系统(命令行) ```bash cd intelligent_data_query python agent.py ``` 系统会提示输入用户ID,输入后即可开始使用。同一user_id可以在不同会话中保留个人偏好。 ### 5. 启动 Web 前端(v2.1) ```bash # Windows cd intelligent_data_query start_web.bat # Linux/Mac cd intelligent_data_query chmod +x start_web.sh ./start_web.sh ``` 浏览器访问:`http://localhost:5000` 前端特性(v2.1): - Web 聊天界面,支持 Markdown 渲染与代码高亮 - 聊天区滚动优化,输入框固定底部 - 登录后直接从 `long_term_memory.db` 读取并展示用户信息(无需对话总结) - REST API:`/api/login`、`/api/query`、`/api/new_session`、`/api/user_info`、`/api/health` **特殊命令…
Mapped onto the structured taxonomy from declared text and observed tool names. Confidence shown for derived entries.
Every source is kept verbatim. Field changes are logged as events.