Documentation Index
Fetch the complete documentation index at: https://docs.orxhestra.com/llms.txt
Use this file to discover all available pages before exploring further.
Runner is the main entry point for session-managed execution. It wires an agent, a session service, and the invocation context together.
Runner automatically:
- Fetches or creates the session
- Persists the user’s message as a
USER_MESSAGEevent - Builds an
Contextwith the session reference - Persists every agent event to the session via
append_event() - Applies
EventActions.state_deltato the session state
LlmAgent rebuilds LangChain message history from session.events on each turn, so the LLM sees the full conversation context.
Using sessions directly
Database-backed sessions
For production persistence, useDatabaseSessionService (requires pip install orxhestra[database]):
Session Compaction
Long conversations accumulate events that eventually exceed the LLM’s context window. The Runner supports automatic compaction — summarizing old events into a single condensed event while keeping recent events intact.char_threshold:
- The most recent events totalling
retention_charscharacters are kept as-is - Older events are summarized into a single compaction event
- The compaction event is appended to the session — originals are preserved
LlmAgent applies apply_compaction() at the view layer to swap compacted ranges for their summaries when building LLM context.
If model is provided, the summary is generated via an LLM call. Otherwise, a simple text extraction fallback is used.
Safety
- Compaction never runs mid-stream — only after all agent events have been yielded
- Events with unresolved tool calls are never compacted
- Re-compaction is guarded by a timestamp boundary — previously compacted events are not re-summarized
Compaction events
Compaction events are regularAGENT_MESSAGE events with an EventActions.compaction field:
LlmAgent automatically detects compaction events and includes the summary in the LLM context via apply_compaction() from orxhestra.events.filters. This filter replaces raw events in the compacted range with the summary, while preserving all events after the compaction boundary.
Composer YAML
Enable compaction in therunner section: