Skip to main content

Module runtime

Module runtime 

Source
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_config at compile time: build() is only callable once with_agent_config has been called.
  • run_agent is async and returns a typed AgentSession with 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 persistence feature is enabled)

Structs§

AgentRuntime
Unified runtime that coordinates memory, graph, orchestration, and agent loop.
AgentRuntimeBuilder
Builder for AgentRuntime.
AgentSession
The result of a single agent run.
CharDivTokenEstimator
Default heuristic: 1 token ≈ 4 bytes.
HasConfig
Builder state: agent config has been provided; build() is available.
NeedsConfig
Builder state: agent config has not been provided yet.

Traits§

TokenEstimator
Estimates the number of tokens in a string.