pub struct AgentSessionConfig {Show 44 fields
pub max_tool_iterations: usize,
pub max_tool_retries: usize,
pub max_retry_duration_secs: u64,
pub retry_base_ms: u64,
pub retry_max_ms: u64,
pub parameter_reformat_provider: String,
pub tool_repeat_threshold: usize,
pub tool_summarization: bool,
pub tool_call_cutoff: usize,
pub max_tool_calls_per_session: Option<u32>,
pub overflow_config: OverflowConfig,
pub permission_policy: PermissionPolicy,
pub model_name: String,
pub embed_model: String,
pub semantic_cache_enabled: bool,
pub semantic_cache_threshold: f32,
pub semantic_cache_max_candidates: u32,
pub budget_tokens: usize,
pub soft_compaction_threshold: f32,
pub hard_compaction_threshold: f32,
pub compaction_preserve_tail: usize,
pub compaction_cooldown_turns: u8,
pub prune_protect_tokens: usize,
pub redact_credentials: bool,
pub security: SecurityConfig,
pub timeouts: TimeoutConfig,
pub learning: LearningConfig,
pub document_config: DocumentConfig,
pub graph_config: GraphConfig,
pub persona_config: PersonaConfig,
pub trajectory_config: TrajectoryConfig,
pub category_config: CategoryConfig,
pub tree_config: TreeConfig,
pub microcompact_config: MicrocompactConfig,
pub autodream_config: AutoDreamConfig,
pub magic_docs_config: MagicDocsConfig,
pub anomaly_config: AnomalyConfig,
pub result_cache_config: ResultCacheConfig,
pub utility_config: UtilityScoringConfig,
pub orchestration_config: OrchestrationConfig,
pub debug_config: DebugConfig,
pub server_compaction: bool,
pub budget_hint_enabled: bool,
pub secrets: Arc<[(String, Secret)]>,
}Expand description
All config-derived fields needed to configure an Agent session.
This is the single source of truth for config → agent wiring. Adding a new config field requires exactly three changes:
- Add the field here.
- Map it in
AgentSessionConfig::from_config. - Apply it in
super::Agent::apply_session_config(destructure triggers a compile error if you forget step 3 — see the S4 note in the critic handoff).
§What is NOT here
- Shared runtime objects (
provider,registry,memory,mcp_manager, etc.) — these are expensive to create and shared across sessions; they stay inSharedAgentDeps. - ACP-specific fields (
acp_max_sessions, bearer token, etc.) — transport-level, not agent-level. - Optional runtime providers (
summary_provider,judge_provider,quarantine_provider) — these contain HTTP client pools (AnyProvider) that carry runtime state; callers wire them separately viawith_summary_provider/with_judge_provider/apply_quarantine_provider. mcp_config— passed alongside runtime MCP objects inwith_mcp(); separating it frommcp_tools/mcp_managerwould make the call site awkward.- Runner-only fields (
compression,routing,autosave,hybrid_search,trust_config,disambiguation_threshold,logging_config,subagent,experiment,instruction,lsp_hooks,response_cache,cost_tracker) — not used in ACP sessions; keeping them out avoids unused-field noise and prevents inadvertent ACP behavior changes. - Scheduler runtime objects (
scheduler_executor, broadcast senders) — runtime state, not config-derived values.
Fields§
§max_tool_iterations: usize§max_tool_retries: usize§max_retry_duration_secs: u64§retry_base_ms: u64§retry_max_ms: u64§parameter_reformat_provider: String§tool_repeat_threshold: usize§tool_summarization: bool§tool_call_cutoff: usize§max_tool_calls_per_session: Option<u32>§overflow_config: OverflowConfig§permission_policy: PermissionPolicy§model_name: String§embed_model: String§semantic_cache_enabled: bool§semantic_cache_threshold: f32§semantic_cache_max_candidates: u32§budget_tokens: usize§soft_compaction_threshold: f32§hard_compaction_threshold: f32§compaction_preserve_tail: usize§compaction_cooldown_turns: u8§prune_protect_tokens: usize§redact_credentials: bool§security: SecurityConfig§timeouts: TimeoutConfig§learning: LearningConfig§document_config: DocumentConfig§graph_config: GraphConfig§persona_config: PersonaConfig§trajectory_config: TrajectoryConfig§category_config: CategoryConfig§tree_config: TreeConfig§microcompact_config: MicrocompactConfig§autodream_config: AutoDreamConfig§magic_docs_config: MagicDocsConfig§anomaly_config: AnomalyConfig§result_cache_config: ResultCacheConfig§utility_config: UtilityScoringConfig§orchestration_config: OrchestrationConfig§debug_config: DebugConfig§server_compaction: bool§budget_hint_enabled: boolInject <budget> XML into the volatile system prompt section (#2267).
secrets: Arc<[(String, Secret)]>Custom secrets from config.
Stored as Arc because Secret intentionally does not implement Clone —
the wrapper prevents accidental duplication. Iteration produces new Secret
values via Secret::new(v.expose()) on the consumption side.
Implementations§
Source§impl AgentSessionConfig
impl AgentSessionConfig
Sourcepub fn from_config(config: &Config, budget_tokens: usize) -> Self
pub fn from_config(config: &Config, budget_tokens: usize) -> Self
Build from a resolved Config snapshot and a pre-computed budget_tokens.
budget_tokens is passed as a parameter because its computation (auto_budget_tokens)
depends on the active provider and must happen before AgentSessionConfig is constructed.
Trait Implementations§
Source§impl Clone for AgentSessionConfig
impl Clone for AgentSessionConfig
Source§fn clone(&self) -> AgentSessionConfig
fn clone(&self) -> AgentSessionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentSessionConfig
impl RefUnwindSafe for AgentSessionConfig
impl Send for AgentSessionConfig
impl Sync for AgentSessionConfig
impl Unpin for AgentSessionConfig
impl UnsafeUnpin for AgentSessionConfig
impl UnwindSafe for AgentSessionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request