Skip to main content

SubagentDispatcher

Trait SubagentDispatcher 

Source
pub trait SubagentDispatcher:
    Send
    + Sync
    + 'static {
    // Required methods
    fn id(&self) -> SubagentDispatcherId;
    fn definitions(&self) -> Vec<SubagentDefinition>;
    fn dispatch<'life0, 'async_trait>(
        &'life0 self,
        parent_thread_id: ThreadId,
        parent_turn_id: TurnId,
        request: SubagentRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SubagentResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn dispatch_traced<'life0, 'async_trait>(
        &'life0 self,
        parent_thread_id: ThreadId,
        parent_turn_id: TurnId,
        request: SubagentRequest,
        trace_sink: Option<Arc<dyn SubagentTraceSink>>,
    ) -> Pin<Box<dyn Future<Output = Result<SubagentResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn dispatch_with_context<'life0, 'async_trait>(
        &'life0 self,
        parent_thread_id: ThreadId,
        parent_turn_id: TurnId,
        request: SubagentRequest,
        trace_sink: Option<Arc<dyn SubagentTraceSink>>,
        handles: ToolExecutionHandles,
    ) -> Pin<Box<dyn Future<Output = Result<SubagentResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn id(&self) -> SubagentDispatcherId

Source

fn definitions(&self) -> Vec<SubagentDefinition>

Source

fn dispatch<'life0, 'async_trait>( &'life0 self, parent_thread_id: ThreadId, parent_turn_id: TurnId, request: SubagentRequest, ) -> Pin<Box<dyn Future<Output = Result<SubagentResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn dispatch_traced<'life0, 'async_trait>( &'life0 self, parent_thread_id: ThreadId, parent_turn_id: TurnId, request: SubagentRequest, trace_sink: Option<Arc<dyn SubagentTraceSink>>, ) -> Pin<Box<dyn Future<Output = Result<SubagentResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn dispatch_with_context<'life0, 'async_trait>( &'life0 self, parent_thread_id: ThreadId, parent_turn_id: TurnId, request: SubagentRequest, trace_sink: Option<Arc<dyn SubagentTraceSink>>, handles: ToolExecutionHandles, ) -> Pin<Box<dyn Future<Output = Result<SubagentResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dispatch a child carrying the parent tool call’s execution handles (workspace, remote workspace, process runner, context artifacts). This is how a subagent or swarm child operates on the same workspace as the lead thread instead of failing with “workspace handle is not available”.

The default implementation ignores the handles and falls back to Self::dispatch_traced, so non-workspace dispatchers (e.g. remote or fake ones) keep working unchanged.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§