# hecong_agent6 **Repository Path**: hecong9402/hecong_agent6 ## Basic Information - **Project Name**: hecong_agent6 - **Description**: 第六版aiagent代码仓库。使用python语言。跟第五版相比,rag功能和task规划,更为完善。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-19 - **Last Updated**: 2026-08-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # hecong_python_agent 一个 AI Agent 程序 ## 项目结构 ``` hecong_python_agent/ ├── docs/ │ └── index.md ├── src/ │ └── hecong_python_agent/ │ ├── core/ # AI Agent 核心代码 │ │ ├── task/ # 任务调度 — TaskNode + TaskManager │ │ ├── memory/ # 记忆存储与加载(文件日志 + RAG/Chroma) │ │ ├── agent/ # Agent 单步执行 + 提示词组装 + 匹配策略 │ │ │ └── config/ # Agent 配置文件读取(YAML) │ │ ├── tools/ # 工具定义与注册 │ │ │ ├── file_tools/ # 文件系统工具(4 个) │ │ │ ├── task_tools/ # 任务调度工具(4 个) │ │ │ └── web_tools/ # Web 工具(1 个) │ │ ├── context.pyi # 执行上下文类型定义 │ │ ├── context.py # 执行上下文实现 │ │ └── __init__.py # core 模块聚合入口 │ ├── interface/ # AI Agent 界面代码(CLI/Web) │ └── workspace_manager/ # 🆕 工作空间管理 │ ├── agentspace_manager/ # Agent 空间管理 │ ├── taskspace_manager/ # 任务空间管理 │ └── knowledgespace_manager/ # 知识空间管理 ├── tests/ ├── requirements.txt ├── pyproject.toml └── README.md ``` ## 模块说明 | 模块 | 说明 | |------|------| | `core/` | AI Agent 核心代码,见 [core/README.md](src/hecong_python_agent/core/README.md) | | `core/task/` | 任务调度与状态机管理 — `TaskNode` + `TaskManager`,见 [task/README.md](src/hecong_python_agent/core/task/README.md) | | `core/memory/` | 记忆存储与加载(文件日志 + RAG),见 [memory/README.md](src/hecong_python_agent/core/memory/README.md) | | `core/agent/` | Agent 单步执行 + 提示词组装 + 匹配策略,见 [agent/README.md](src/hecong_python_agent/core/agent/README.md) | | `core/agent/config/` | Agent 配置文件读取(config.yaml + preferences.yaml),见 [config/README.md](src/hecong_python_agent/core/agent/config/README.md) | | `core/tools/` | 工具定义与注册(9 个内置工具 + 工厂模式),见 [tools/README.md](src/hecong_python_agent/core/tools/README.md) | | `interface/` | 界面代码(CLI/Web),见 [interface/README.md](src/hecong_python_agent/interface/README.md) | | `workspace_manager/` 🆕 | 工作空间管理,见 [workspace_manager/README.md](src/hecong_python_agent/workspace_manager/README.md) | | `workspace_manager/agentspace_manager/` 🆕 | Agent 空间管理,见 [agentspace_manager/README.md](src/hecong_python_agent/workspace_manager/agentspace_manager/README.md) | | `workspace_manager/taskspace_manager/` 🆕 | 任务空间管理,见 [taskspace_manager/README.md](src/hecong_python_agent/workspace_manager/taskspace_manager/README.md) | | `workspace_manager/knowledgespace_manager/` 🆕 | 知识空间管理,见 [knowledgespace_manager/README.md](src/hecong_python_agent/workspace_manager/knowledgespace_manager/README.md) | ## 核心设计原则 ### 构造时不绑定,运行时注入 工具构造时不绑定 task_id 或 agent。同一 Agent 实例可能被多个 TaskNode 共享。 调用者信息通过 `ExecutionContext` 在运行时注入: - Agent._execute_tool_calls() 遍历工具前设置 `tool._ctx = ctx` - 工具通过 `self._ctx.task_id` / `self._ctx.agent_name` 获取调用者 ### LLM 显式标记终端态 Agent 不再自动判定任务完成(SUCCESS)。LLM 输出纯文本后统一进入 WAITING_USER_INPUT, LLM 必须通过 `modify_task(action="mark_success")` 显式标记任务达成。 这解决了框架无法区分"完成了"和"选 A 还是 B?"的问题。 ### 分治-汇总模式 父任务通过 `add_task` 创建子任务后挂起(WAITING_CHILDREN), 所有子任务终结后 TaskManager 一次性收集结果注入父任务上下文, 唤醒父任务验收,支持打回重做,通过后递归向上通知。 ## 快速开始 ```bash # 安装依赖 pip install -r requirements.txt # 运行项目 python -m hecong_python_agent ``` > ⚠️ 本项目当前为骨架阶段,不含业务逻辑代码。 ## 作者 hecong ## 许可证 本项目无许可证,保留所有权利。