Files
more_dots/agent/README.md
T

38 lines
986 B
Markdown
Raw Normal View History

2026-03-24 18:07:22 +08:00
# Agent 模块
## 目录说明
`agent` 负责定义 Agent 运行时状态、节点逻辑与具体代理类型。
```
agent/
├── agents/ # 具体代理实现(ConversationAgent / ToolAgent)
├── core/ # 状态图与共享节点
├── utils.py # Agent 通用工具函数
└── README.md
```
## 核心能力
- 统一的 SQL 工作流编排
- 多轮对话上下文维护
- 节点级状态推进与错误收集
## 关键流程
共享 SQL 主链路:
`process_input -> normalize_input -> classify_query_mode -> match_table -> load_sql_prompt -> build_sql_plan -> generate_sql -> execute_sql -> generate_response`
对话代理会在前后追加:
`analyze_intent` 与 `update_context`
## 文件
- `core/base_agent.py`:共享图注册和节点编排
- `core/nodes.py`:SQL 主流程节点实现
- `core/state.py`:AgentState 与上下文同步
- `agents/conversation.py`:会话型 Agent
- `agents/tool.py`:工具调用型 Agent