pub struct SubagentContextOverrides {Show 13 fields
pub options: Option<ToolUseContextOptions>,
pub agent_id: Option<String>,
pub agent_type: Option<String>,
pub messages: Option<Vec<Message>>,
pub read_file_state: Option<Arc<FileStateCache>>,
pub abort_controller: Option<Arc<AbortController>>,
pub get_app_state: Option<Arc<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
pub share_set_app_state: bool,
pub share_set_response_length: bool,
pub share_abort_controller: bool,
pub critical_system_reminder_experimental: Option<String>,
pub require_can_use_tool: Option<bool>,
pub content_replacement_state: Option<Arc<dyn Any + Send + Sync>>,
}Expand description
Options for creating a subagent context.
By default, all mutable state is isolated to prevent interference with the parent. Use these options to:
- Override specific fields (e.g., custom options, agent_id, messages)
- Explicitly opt-in to sharing specific callbacks (for interactive subagents)
Fields§
§options: Option<ToolUseContextOptions>Override the options object (e.g., custom tools, model)
agent_id: Option<String>Override the agent_id (for subagents with their own ID)
agent_type: Option<String>Override the agent_type (for subagents with a specific type)
messages: Option<Vec<Message>>Override the messages array
read_file_state: Option<Arc<FileStateCache>>Override the read_file_state (e.g., fresh cache instead of clone)
abort_controller: Option<Arc<AbortController>>Override the abort_controller
get_app_state: Option<Arc<dyn Fn() -> Box<dyn Any> + Send + Sync>>Override the get_app_state function
Explicit opt-in to share parent’s set_app_state callback. Use for interactive subagents that need to update shared state. @default false (isolated no-op)
Explicit opt-in to share parent’s set_response_length callback. Use for subagents that contribute to parent’s response metrics. @default false (isolated no-op)
Explicit opt-in to share parent’s abort_controller. Use for interactive subagents that should abort with parent. Note: Only applies if abort_controller override is not provided. @default false (new controller linked to parent)
critical_system_reminder_experimental: Option<String>Critical system reminder to re-inject at every user turn
require_can_use_tool: Option<bool>When true, can_use_tool must always be called even when hooks auto-approve. Used by speculation for overlay file path rewriting.
content_replacement_state: Option<Arc<dyn Any + Send + Sync>>Override content_replacement_state — used by resumeAgentBackground to thread state reconstructed from the resumed sidechain so the same results are re-replaced (prompt cache stability).
Trait Implementations§
Source§impl Clone for SubagentContextOverrides
impl Clone for SubagentContextOverrides
Source§fn clone(&self) -> SubagentContextOverrides
fn clone(&self) -> SubagentContextOverrides
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more