Skip to main content

AgentDelegate

Trait AgentDelegate 

Source
pub trait AgentDelegate: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn delegate<'life0, 'async_trait>(
        &'life0 self,
        task: AgentTask,
    ) -> Pin<Box<dyn Future<Output = Result<AgentResult, AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn capabilities(&self) -> AgentCapabilities { ... }
    fn cancel<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<AgentTaskStatus, AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

The trait every specialist agent implements.

Required Methods§

Source

fn name(&self) -> &str

Stable identifier registered with the registry.

Source

fn delegate<'life0, 'async_trait>( &'life0 self, task: AgentTask, ) -> Pin<Box<dyn Future<Output = Result<AgentResult, AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Hand off a task. Blocks until the delegate finishes, fails, or hits task.timeout_secs.

Provided Methods§

Source

fn capabilities(&self) -> AgentCapabilities

Declared capabilities — used by the orchestrator to pick a delegate.

Source

fn cancel<'life0, 'life1, 'async_trait>( &'life0 self, _task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Best-effort cancellation. Default is no-op.

Source

fn status<'life0, 'life1, 'async_trait>( &'life0 self, _task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<AgentTaskStatus, AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Best-effort status poll. Most implementations don’t keep per-task state and return Running during delegate via other channels.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cheap liveness probe — the registry calls this during startup and before routing to mark the delegate healthy/unhealthy. Default is “assume healthy” so stateless delegates don’t have to implement it.

Implementors§