behest-context 0.5.4

Layered context system for the behest agent runtime
Documentation

Layered context traits for the behest agent runtime.

Inspired by ADK-Rust's ReadonlyContext → CallbackContext → InvocationContext hierarchy, this module defines progressively richer context interfaces that give agents, tools, hooks, and memory operations access to exactly the capabilities they need — no more, no less.

Hierarchy

ReadonlyContext         (identity: invocation_id, session_id, user_id, app_name)
  ├── SessionContext    (+ session state, session store)
  │     ├── RunContext  (+ run_id, cancellation, deadline, event sink, budget)
  │     │     └── ToolContext (+ tool_call, emit_progress, search_memory)
  │     └── MemoryContext (+ active_window, demote, compact)
  └── HookContext       (+ current_state, snapshot)

Design constraints

  • Each layer adds specific, well-defined capabilities.
  • Context does not become a "global service locator" — each trait is narrowly scoped to what the consumer needs.
  • Tool can access session info and stream progress, but cannot access internal runtime state.
  • Every trait has clear ownership and lifetime semantics.