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 can_reattach(&self) -> bool { ... }
fn can_reattach_task(&self, task: &SessionTask) -> bool { ... }
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§
fn kind(&self) -> &str
Sourcefn 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,
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§
Sourcefn can_reattach(&self) -> bool
fn can_reattach(&self) -> bool
Whether this executor can re-attach to a running task after worker loss.
Kinds returning true must implement start such that calling it with
a re-attached task snapshot (attempt already bumped by the reaper)
resumes the work idempotently and heartbeats with the new attempt.
Kinds returning false (the default) are failed as orphaned immediately
by the reaper.
Sourcefn can_reattach_task(&self, task: &SessionTask) -> bool
fn can_reattach_task(&self, task: &SessionTask) -> bool
Whether this executor can re-attach to a specific task instance.
Defaults to self.can_reattach(). Override to inspect per-task spec
fields (e.g. whether the spawned tool declared itself idempotent).
The reaper calls this instead of can_reattach() when a task snapshot
is available.
Sourcefn 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 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.
Called by the reaper when re-attaching a task (attempt already bumped).
Implementations must heartbeat using task.attempt so stale writes from
the previous executor are rejected by the fence.
Sourcefn 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 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.
Sourcefn 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,
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".