HeavenBase treats agent memory as a workspace, agent actions as MCP tools, and agent instructions as prompt rows.
1. Agent stack
A HeavenBase-backed agent usually has four parts:hb.LLMfor the model route, preset, provider, gateway, and cache policyLLMSessionfromheavenbase.utilsfor multi-turn history and automatic tool loopshb.Promptandhb.fast_prompt_sectionfor persisted, translated instructionshb.HeavenBase(...).to_mcp(profile="agent")for workspace tools the model can inspect and mutate
2. Workspace memory
Use a workspace preset instead of hand-writing backend config for first-run agents:agent MCP profile intentionally exposes fewer tools than the full workspace toolkit. Start with it, then pass tools=[...] only when a specific agent needs a narrower allowlist.
If the agent only needs persistent notes, start even smaller with the memory profile:
memory profile exposes remember, recall, search_memory, list_memory, and set_memory. It is useful for Memstate-style note storage while still keeping the data inside the same HeavenBase workspace. Use remember for summaries or decisions, recall/list_memory for exact retrieval and browsing, search_memory for fuzzy lookup, and set_memory for exact-key correction. History and delete stay out of this first-run profile until the application has a retention policy.
If the agent needs versioned project memory, use the memstate profile:
memstate profile exposes memstate_remember, memstate_set, memstate_get, memstate_search, memstate_history, and memstate_delete. It uses project.<project_id>.<keypath> rows and preserves history inside the HeavenBase workspace.
3. Prompt instructions
Register prompts in the same workspace so agent instructions travel with the task state:ws=....
4. LLM session with tools
Attach workspace MCP and external MCP servers to one session:5. Agent smoke path
For a compact agent smoke test:- Use
hb.HeavenBase("task", preset="debug"). - Use
ws.to_mcp(profile="agent"). - Use
ws.to_mcp(profile="memory")when the task only needs note memory, orprofile="memstate"when it needs versioned project keypaths. - Use
hb.LLM(preset="chat", gateway="portkey", cache=False). - Keep GLM tool calls on native OpenAI JSON tools unless a provider-specific failure proves otherwise.
- Use
hb.LLM(...).spec.materialize()for route inspection before live calls.

