pub trait DelegateFactory: Send + Sync {
// Required method
fn delegate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_kind: &'life1 str,
task: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Trait for executing delegate actions in StateGraph nodes.
This is a lightweight abstraction that avoids a cyclic dependency
with oneai-agent. The oneai-agent crate provides a concrete
implementation that wraps SubAgentFactory.
When no delegate factory is available, use NoopDelegateFactory
which returns an error for all delegate requests.
Required Methods§
Sourcefn delegate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_kind: &'life1 str,
task: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delegate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_kind: &'life1 str,
task: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a delegate action with the given agent kind and task.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".