pub struct SubAgentTool { /* private fields */ }Expand description
A tool that delegates work to a child agent loop.
When the parent LLM calls this tool, it spawns a fresh agent_loop() with
its own system prompt, tools, and provider. The sub-agent runs to completion
and its final text output is returned as the tool result.
Implementations§
Source§impl SubAgentTool
impl SubAgentTool
Sourcepub fn new(name: impl Into<String>, model_config: ModelConfig) -> Self
pub fn new(name: impl Into<String>, model_config: ModelConfig) -> Self
Create a new sub-agent tool with a name and model config.
Sourcepub fn with_parent_loop_id(self, id: impl Into<String>) -> Self
pub fn with_parent_loop_id(self, id: impl Into<String>) -> Self
Set the parent loop’s loop_id for child → parent ancestry tracking.
When set, this value is placed in the child AgentContext.parent_loop_id,
which is then emitted in the child’s AgentStart event. This creates a
bidirectional link: the parent sees the child’s loop_id via
ToolExecutionEnd.child_loop_id, and the child records the parent via
AgentStart.parent_loop_id.
Sourcepub fn with_provider_override(self, provider: Arc<dyn StreamProvider>) -> Self
pub fn with_provider_override(self, provider: Arc<dyn StreamProvider>) -> Self
Override the provider used by this sub-agent, bypassing ProviderRegistry dispatch.
Primarily used in tests to inject a MockProvider.