HeavenBase 将智能体记忆视为工作区,将智能体动作视为 MCP 工具,将智能体指令视为提示 (Prompt) 行。
1. 智能体技术栈
基于 HeavenBase 的智能体通常包含四部分:hb.LLM负责模型路由、预设 (Preset)、提供商 (Provider)、入口 (Gateway) 与缓存策略heavenbase.utils中的LLMSession负责多轮历史与自动工具循环hb.Prompt与hb.fast_prompt_section负责持久化、可翻译的指令hb.HeavenBase(...).to_mcp(profile="agent")提供模型可检查与变更的工作区工具
2. 工作区记忆
首次运行的智能体请使用工作区预设 (Preset),而非手写后端 (Backend) 配置:agent MCP profile 有意比完整工作区工具集 (Toolkit) 暴露更少工具。从它开始,仅当特定智能体需要更窄的 allowlist 时再传入 tools=[...]。
若智能体只需持久笔记,可用更小的 memory profile:
memory profile 暴露 remember、recall、search_memory、list_memory 与 set_memory。它适用于 Memstate 风格笔记存储,同时仍将数据保留在同一 HeavenBase 工作区内。用 remember 记录摘要或决策,用 recall/list_memory 做精确检索与浏览,用 search_memory 做模糊查找,用 set_memory 做精确键修正。在应用具备保留策略之前,history 与 delete 不在此首次运行 profile 中。
若智能体需要版本化项目记忆,使用 memstate profile:
memstate profile 暴露 memstate_remember、memstate_set、memstate_get、memstate_search、memstate_history 与 memstate_delete。它使用 project.<project_id>.<keypath> 行,并在 HeavenBase 工作区内保留历史。
3. 提示 (Prompt) 指令
在同一工作区注册提示 (Prompt),使智能体指令与任务状态一起迁移:ws=... 的工作区。
4. 带工具的 LLM 会话 (Session)
将工作区 MCP 与外部 MCP 服务器挂到同一会话 (Session):5. 智能体冒烟路径
紧凑的智能体冒烟测试:- 使用
hb.HeavenBase("task", preset="debug")。 - 使用
ws.to_mcp(profile="agent")。 - 任务只需笔记记忆时用
ws.to_mcp(profile="memory");需要版本化项目 keypath 时用profile="memstate"。 - 使用
hb.LLM(preset="chat", gateway="portkey", cache=False)。 - 除非 provider 特定失败证明否则,GLM 工具调用保持原生 OpenAI JSON tools。
- 在 live 调用前用
hb.LLM(...).spec.materialize()检查路由。

