pub struct LoopConfig<'a> {Show 15 fields
pub system: String,
pub tools: Vec<Tool>,
pub llm: LlmOpts,
pub stream_fn: StreamFn,
pub hooks: HooksSet,
pub steering: UnboundedReceiver<AgentMessage>,
pub follow_ups: UnboundedReceiver<AgentMessage>,
pub cancel: CancellationToken,
pub working_dir: PathBuf,
pub max_turns: usize,
pub parallel: bool,
pub compaction: CompactionPolicy,
pub ctx_snapshot: Sender<Vec<AgentMessage>>,
pub session: Option<&'a mut Session>,
pub title_after_turns: usize,
}Fields§
§system: String§tools: Vec<Tool>§llm: LlmOpts§stream_fn: StreamFn§hooks: HooksSet§steering: UnboundedReceiver<AgentMessage>§follow_ups: UnboundedReceiver<AgentMessage>§cancel: CancellationToken§working_dir: PathBufWorking directory for tool execution (bash cwd, file resolution).
Plumbed explicitly so embeddings can run against a directory other
than the process cwd; an empty path falls back to current_dir().
max_turns: usizeMaximum number of LLM turns in a single run. A turn is one model call
plus the tool calls it produces. Caps a runaway tool loop (the model
re-issuing tool calls forever) that would otherwise run until cancelled;
the run ends on a completed turn boundary with StopReason::MaxTurns.
Counts every turn in the run, including follow-up-triggered ones.
parallel: boolRun concurrency-safe tool calls in one batch in parallel (see
crate::tool::TypedTool::parallel_safe). false forces the old
strictly-sequential behaviour.
compaction: CompactionPolicyWhen to auto-summarize the older prefix, and how much recent context to
keep (see crate::compaction).
ctx_snapshot: Sender<Vec<AgentMessage>>A read-only window onto the run’s context. The loop republishes the whole
ctx at each turn boundary (see run_loop) so the actor can answer a
mid-run GetHistory/SideAsk without the &mut the run holds.
session: Option<&'a mut Session>Optional session to persist each produced message to as it is pushed into context — incremental, so a crash mid-run loses at most the in-flight message instead of the whole turn.
title_after_turns: usizeAuto-title the session once this many assistant turns exist (W031
D2): 0 disables the auto-titler. Plumbed from
crate::agent::AgentConfig::title_after_turns, which the CLI fills
from [session] title_after_turns / WCODE_TITLE_AFTER_TURNS.
A plain usize, not Option<usize>: the kernel has no “unset” — the
CLI resolves absence to crate::title::DEFAULT_TITLE_AFTER_TURNS, the
same shape as max_turns above.