#[non_exhaustive]pub struct RunConfig {
pub max_turns: usize,
pub parallel_tool_dispatch: ParallelDispatchConfig,
pub reset_managers: bool,
pub memory_top_k: usize,
}Expand description
Per-run configuration.
The slice of agent configuration that varies across run() calls on the
same agent (turn/token budgets, compaction policy, dispatch mode, manager
reset). It is owned by the machine so that the machine’s decisions are
self-contained and a serialized machine carries its configuration with
it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_turns: usizeMaximum number of turns before forcing completion.
A safety cap on runaway loops: once the machine has taken this many
turns without the model finishing, the run ends with
MachineOutcome::MaxTurnsExceeded. Defaults to 200. Set it per-run
to bound long-running tool loops.
parallel_tool_dispatch: ParallelDispatchConfigHow independent tool calls within a single turn are dispatched.
Controls whether the driver runs a turn’s independent tool calls
sequentially or in parallel, up to a concurrency limit. See
ParallelDispatchConfig.
reset_managers: boolWhether to reset the fallback, detection, and observer managers to their initial state before this run.
When true, LoopManagers::reset_all is called at the top of
run(), clearing the fallback circuit breaker, loop/convergence
detection history, and per-observer accumulators. Use this when a
run is logically independent from the previous one (different task,
fresh context) and you do not want accumulated state to carry over.
Defaults to false — manager state persists across runs within a
session, which is usually the right behavior (e.g. a tripped
circuit breaker should stay tripped).
memory_top_k: usizeHow many memory entries to retrieve and inject at the top of each turn.
When a LoopMemory backend is configured,
the driver retrieves this many relevant entries before each model call
and appends them as a reference user message. Defaults to 3. Set to
0 to disable memory retrieval entirely for the run.
Implementations§
Source§impl RunConfig
impl RunConfig
Sourcepub fn with_parallel_dispatch(self, config: ParallelDispatchConfig) -> Self
pub fn with_parallel_dispatch(self, config: ParallelDispatchConfig) -> Self
Set the parallel tool-dispatch configuration for the run.
RunConfig is #[non_exhaustive], so this builder is the one
way a host opts a run into
ParallelMode::Parallel
(or back to sequential) — the struct literal is not available
outside the crate.
use loopctl::config::{ParallelDispatchConfig, ParallelMode};
use loopctl::engine::RunConfig;
let config = RunConfig::default().with_parallel_dispatch(
ParallelDispatchConfig {
mode: ParallelMode::Parallel,
..Default::default()
},
);
assert!(matches!(
config.parallel_tool_dispatch.mode,
ParallelMode::Parallel
));Sourcepub fn with_max_turns(self, max_turns: usize) -> Self
pub fn with_max_turns(self, max_turns: usize) -> Self
Set the maximum number of turns for this run.
Builder-style convenience for #[non_exhaustive] compliance.
use loopctl::engine::RunConfig;
let config = RunConfig::default().with_max_turns(50);
assert_eq!(config.max_turns, 50);