Skip to main content

TaskExecutor

Trait TaskExecutor 

Source
pub trait TaskExecutor: Send + Sync {
    // Required methods
    fn kind(&self) -> &str;
    fn cancel<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        task: &'life1 SessionTask,
        context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn start<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        task: &'life1 SessionTask,
        context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn deliver<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        task: &'life1 SessionTask,
        message: &'life2 TaskMessage,
        context: &'life3 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn reconcile<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        task: &'life1 SessionTask,
        context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Control plane for a task kind. The registry/tools call into the executor; the running work pushes into a TaskSink.

Default method bodies return unsupported so kinds implement only what applies (e.g. a background tool rarely accepts inbound messages).

Required Methods§

Source

fn kind(&self) -> &str

Source

fn cancel<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task: &'life1 SessionTask, context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Cooperatively wind down. The task may still end succeeded or failed.

Provided Methods§

Source

fn start<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task: &'life1 SessionTask, context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Begin execution, or re-attach after worker loss.

Source

fn deliver<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, task: &'life1 SessionTask, message: &'life2 TaskMessage, context: &'life3 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Deliver an inbound message (steering or input answer) to the work.

Source

fn reconcile<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task: &'life1 SessionTask, context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Refresh state for polled kinds (e.g. A2A remote tasks). Reports via the registry; no-op by default.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§