pub struct RunPolicy {
pub limits: RunLimits,
pub retry: RetryPolicy,
pub fallback: Option<FallbackPolicy>,
pub default_response_format: Option<ResponseFormat>,
pub cache: CachePolicy,
}Expand description
Declarative, run-scoped policy shared by every invocation of an
AgentHarness.
A RunPolicy carries the four cross-cutting concerns the agent loop needs
to bound and steer a run:
limits: hard caps (model calls, tool calls, wall-clock) enforced fail-closed by the loop.retry: exponential-backoff retry policy applied to each model call.fallback: optional ordered chain of model names to try when the current model exhausts its retries.default_response_format: when set, attached to everycrate::harness::model::ModelRequestthe loop builds; aResponseFormat::JsonSchemaalso drives structured output extraction on the final response.
RunPolicy::default yields the crate-default limits and retry policy, no
fallback chain, no response format, and a CachePolicy whose response
caching is enabled — caching only takes effect once a ResponseCache is
actually attached via AgentHarness::with_response_cache, so the default
is safe even without a cache.
Fields§
§limits: RunLimitsHard run limits enforced fail-closed by the agent loop.
retry: RetryPolicyRetry policy applied to each model call.
fallback: Option<FallbackPolicy>Optional ordered model fallback chain.
default_response_format: Option<ResponseFormat>Response format attached to every model request when set.
cache: CachePolicyDefault caching policy for the run.
The loop consults CachePolicy::response_cache_enabled only when a
ResponseCache is attached to the harness and the per-call
crate::harness::model::ModelRequest::cache_policy does not override
it. A request-level cache_policy always wins over this default.