Expand description
§Module: AgentRuntime
§Responsibility
Wire memory, graph, orchestrator, and agent loop into a single coordinator
using a builder pattern. Provides run_agent which executes a ReAct loop,
optionally enriching context from memory and graph lookups.
§Guarantees
- Builder uses a typestate parameter to enforce
agent_configat compile time:build()is only callable oncewith_agent_confighas been called. run_agentis async and returns a typedAgentSessionwith step count, durations, and hits.- Non-panicking: all paths return
Result
§NOT Responsible For
- Actual LLM inference (callers supply a mock/stub inference fn)
- Persistence across process restarts (unless
persistencefeature is enabled)
Structs§
- Agent
Runtime - Unified runtime that coordinates memory, graph, orchestration, and agent loop.
- Agent
Runtime Builder - Builder for
AgentRuntime. - Agent
Session - The result of a single agent run.
- Char
DivToken Estimator - Default heuristic: 1 token ≈ 4 bytes.
- HasConfig
- Builder state: agent config has been provided;
build()is available. - Needs
Config - Builder state: agent config has not been provided yet.
Traits§
- Token
Estimator - Estimates the number of tokens in a string.