#[non_exhaustive]pub struct RunOptions {
pub max_steps: u32,
pub max_history_tokens: usize,
pub max_response_bytes: usize,
pub guardrails: Vec<Arc<dyn Guardrail>>,
pub review_policy: Arc<dyn ReviewPolicy>,
pub checkpoint_kv_bucket: Option<String>,
pub capture_sink: Option<Arc<dyn CaptureSink>>,
}Expand description
Tunables for super::run_steps and super::run_steps_streaming.
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_steps: u32Maximum number of (LLM call + tool dispatch) iterations.
max_history_tokens: usizeMaximum tokens of short-term memory to load into the prompt.
max_response_bytes: usizeCap on bytes accumulated across a single streaming cycle’s
content + serialised tool-call payloads. Exceeding this aborts
the run with a terminal Err. Applies only to
super::run_steps_streaming; super::run_steps is
unaffected (the non-streaming path inherits the provider’s own
limits).
guardrails: Vec<Arc<dyn Guardrail>>Pre/post-LLM validators consulted around every LLM call.
Empty by default — existing callers see no behavioural change.
Each guardrail is invoked in registration order; the first
non-GuardrailOutcome::Pass
outcome short-circuits the run with
Error::Refused or
Error::Handoff. In
super::run_steps_streaming, post-LLM guardrails see the
buffered assistant message at the end of each cycle, and a
non-Pass outcome propagates as a terminal
LlmError::Server("refused: …") or "handoff to <agent>: …"
chunk.
review_policy: Arc<dyn ReviewPolicy>Per-step review policy consulted after each LLM step to decide
whether to pause for human approval (ADR-045). Ok(None) from
the policy proceeds; Ok(Some(reason)) suspends the run and
returns crate::error::Error::Suspended. Defaults to
super::NeverReview, which never pauses.
checkpoint_kv_bucket: Option<String>When Some, suspended-run checkpoints are persisted to this
KvStore bucket so a different process can resume the run via
runtime::resume_from_checkpoint. None keeps the checkpoint
inside the returned crate::error::Error::Suspended only
(within-process resume).
capture_sink: Option<Arc<dyn CaptureSink>>When Some, the run loop records each successful LLM call to this sink
(ADR-048) so a replayable capture can be built. None (default) records
no LLM I/O — today’s behaviour. See
CaptureSink.
Implementations§
Source§impl RunOptions
impl RunOptions
Sourcepub fn with_max_steps(self, steps: u32) -> Self
pub fn with_max_steps(self, steps: u32) -> Self
Overrides Self::max_steps.
Sourcepub fn with_guardrails(self, guardrails: Vec<Arc<dyn Guardrail>>) -> Self
pub fn with_guardrails(self, guardrails: Vec<Arc<dyn Guardrail>>) -> Self
Replaces the guardrail chain; see Self::guardrails for execution semantics.
Sourcepub fn with_review_policy(self, policy: Arc<dyn ReviewPolicy>) -> Self
pub fn with_review_policy(self, policy: Arc<dyn ReviewPolicy>) -> Self
Overrides Self::review_policy.
Sourcepub fn with_checkpoint_bucket(self, bucket: impl Into<String>) -> Self
pub fn with_checkpoint_bucket(self, bucket: impl Into<String>) -> Self
Persists suspend checkpoints to bucket in the agent’s KvStore
(ADR-045), enabling cross-process resume. Without this, the checkpoint
travels only inside the returned crate::error::Error::Suspended.
Sourcepub fn with_capture_sink(self, sink: Arc<dyn CaptureSink>) -> Self
pub fn with_capture_sink(self, sink: Arc<dyn CaptureSink>) -> Self
Records each successful LLM call to sink (ADR-048) so a replayable
capture can be built from a live run.
Trait Implementations§
Source§impl Clone for RunOptions
impl Clone for RunOptions
Source§fn clone(&self) -> RunOptions
fn clone(&self) -> RunOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more