pub struct SpawnOpts {Show 13 fields
pub prompt: String,
pub label: Option<String>,
pub model: Option<String>,
pub capability_mode: CapabilityMode,
pub max_steps: Option<usize>,
pub cancel: CancellationToken,
pub agent_type: Option<String>,
pub output_schema: Option<Value>,
pub fork_context: bool,
pub fork_messages: Option<Vec<Message>>,
pub resume_from: Option<String>,
pub max_output_tokens: Option<u64>,
pub depth: u32,
}Expand description
Options for spawning a nested agent.
Field parity with workflow machi_workflow::AgentOpts for Mode A/B isomorphism.
Fields§
§prompt: StringUser prompt for the child.
label: Option<String>Optional label for logs / result correlation.
model: Option<String>Override model.
capability_mode: CapabilityModeCapability mode for child tools.
max_steps: Option<usize>Max steps for child turn.
cancel: CancellationTokenCancel token for this child.
agent_type: Option<String>Definition name resolved via host agent catalogue.
output_schema: Option<Value>Optional JSON schema for structured child output.
fork_context: boolWhen true, seed the child conversation from Self::fork_messages.
fork_messages: Option<Vec<Message>>Parent messages injected when Self::fork_context is true.
resume_from: Option<String>Replay a completed workflow run id via host WorkflowRunStore (charges budget).
max_output_tokens: Option<u64>Max output tokens hint for the child sample.
depth: u32Nesting depth of this spawn (0 = first level under the host).
Implementations§
Source§impl SpawnOpts
impl SpawnOpts
Sourcepub fn new(prompt: impl Into<String>) -> Self
pub fn new(prompt: impl Into<String>) -> Self
Prompt-only spawn with a fresh cancel token at depth 0.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set label.
Sourcepub const fn with_capability(self, mode: CapabilityMode) -> Self
pub const fn with_capability(self, mode: CapabilityMode) -> Self
Set capability mode.
Sourcepub fn with_cancel(self, cancel: CancellationToken) -> Self
pub fn with_cancel(self, cancel: CancellationToken) -> Self
Set cancel token (often a child of a parent token).
Sourcepub const fn with_max_steps(self, max_steps: usize) -> Self
pub const fn with_max_steps(self, max_steps: usize) -> Self
Set max steps.
Sourcepub const fn with_depth(self, depth: u32) -> Self
pub const fn with_depth(self, depth: u32) -> Self
Set nesting depth.
Sourcepub fn with_agent_type(self, agent_type: impl Into<String>) -> Self
pub fn with_agent_type(self, agent_type: impl Into<String>) -> Self
Set agent type / definition name.
Sourcepub fn with_output_schema(self, schema: Value) -> Self
pub fn with_output_schema(self, schema: Value) -> Self
Set structured output schema for the child.
Sourcepub const fn with_max_output_tokens(self, n: u64) -> Self
pub const fn with_max_output_tokens(self, n: u64) -> Self
Set max output tokens hint.
Sourcepub const fn with_fork_context(self, fork: bool) -> Self
pub const fn with_fork_context(self, fork: bool) -> Self
Request parent conversation fork (requires Self::with_fork_messages).
Sourcepub fn with_fork_messages(self, messages: Vec<Message>) -> Self
pub fn with_fork_messages(self, messages: Vec<Message>) -> Self
Seed child state with parent messages and enable fork mode.
Sourcepub fn with_resume_from(self, id: impl Into<String>) -> Self
pub fn with_resume_from(self, id: impl Into<String>) -> Self
Replay a completed run from the host WorkflowRunStore (still charges agent budget).