Skip to content

Mid-Stream Steering

ox-core exposes a frontend-agnostic steering channel on Agent so callers can inject user guidance while a multi-turn loop is running. For SQLite session schema, sequence ordering, and rewind semantics, see Sessions and Rewind.

Frontends create a connected channel with steering_channel() -> (SteeringSender, SteeringReceiver) and pass the receiver to Agent::run_with_steering. Each message carries a SteeringMode (Queue or Interrupt). Queued blank or whitespace-only strings are ignored.

  • SteeringMode::Queue: drains at the next tool-loop boundary (after appending tool results) or pre-completion check (when the model returns no tool calls and turns < config.max_turns). In the interactive TUI, pressing Enter while the agent is busy queues a steering message.
  • SteeringMode::Interrupt: cancels the active stream or tool batch immediately and injects the steering message before the next turn. In the interactive TUI, pressing Ctrl+Enter (steer-interrupt) interrupts the active turn.

For each injected steering message, Agent:

  1. Persists Message::user(&content) to the attached SessionStore (if configured via Agent::with_session) before emitting the event.
  2. Appends the message to the active conversation history.
  3. Emits AgentEvent::SteeringInjected { content, mode }.