Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture

Tirea runtime is organized as three layers:

Application -> AgentOs (orchestration + execution engine) -> Thread/State Engine

1. Application Layer

Your application defines tools, agent definitions, and integration endpoints.

Primary call path:

  • Build AgentOs via AgentOsBuilder
  • Submit RunRequest
  • Consume streamed AgentEvent

2. AgentOs (Orchestration + Execution)

AgentOs handles both pre-run orchestration and loop execution:

Orchestration (composition/, runtime/):

  • Resolve agent/model/plugin wiring (plugins implement the AgentBehavior trait)
  • Load or create thread
  • Deduplicate incoming messages
  • Persist pre-run checkpoint
  • Construct RunContext

Execution engine (engine/, runtime/loop_runner/):

Loop is phase-driven:

  • RunStart
  • StepStart -> BeforeInference -> AfterInference -> BeforeToolExecute -> AfterToolExecute -> StepEnd
  • RunEnd

Termination is explicit in RunFinish.termination.

3. Thread + State Engine

State mutation is patch-based:

  • State' = apply_patch(State, Patch)
  • Thread stores base state + patch history + messages
  • RunContext accumulates run delta and emits take_delta() for persistence

Design Intent

  • Deterministic state transitions
  • Append-style persistence with version checks
  • Transport-independent runtime (AgentEvent as core stream)

See Also