Skip to main content

AgentSpawner

Trait AgentSpawner 

Source
pub trait AgentSpawner<R>: Send + Sync {
    type Spawned;
    type Error;

    // Required method
    fn spawn_subagent<'a>(
        &'a self,
        forked_from_thread_id: ThreadId,
        request: R,
    ) -> AgentSpawnFuture<'a, Self::Spawned, Self::Error>;
}
Expand description

Constructor-injected host helper for extensions that need to spawn subagents.

The extension owns the request shape and resulting handle types. The host provides the implementation when it constructs the extension.

Required Associated Types§

Required Methods§

Source

fn spawn_subagent<'a>( &'a self, forked_from_thread_id: ThreadId, request: R, ) -> AgentSpawnFuture<'a, Self::Spawned, Self::Error>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<R, S, E, F> AgentSpawner<R> for F
where F: Fn(ThreadId, R) -> AgentSpawnFuture<'static, S, E> + Send + Sync,