Skip to main content

AgentExecutor

Trait AgentExecutor 

Source
pub trait AgentExecutor: Send + Sync {
    // Required method
    fn execute_step<'life0, 'async_trait>(
        &'life0 self,
        spec: AgentStepSpec,
        event_tx: Option<Sender<AgentEvent>>,
    ) -> Pin<Box<dyn Future<Output = StepOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn concurrency_hint(&self) -> usize { ... }
}
Expand description

Runs agent steps — the seam between the framework’s orchestration grammar and the host’s placement / transport / scheduling.

The in-box TaskExecutor runs every step locally (in-process, tokio). A host such as 书安OS implements this trait to place steps on remote nodes; the orchestration combinators are written purely against the trait and never observe where a step actually ran. The framework deliberately does not own placement, transport, or cross-node scheduling — those are the host’s.

Required Methods§

Source

fn execute_step<'life0, 'async_trait>( &'life0 self, spec: AgentStepSpec, event_tx: Option<Sender<AgentEvent>>, ) -> Pin<Box<dyn Future<Output = StepOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run one step to completion.

Failures are reported as StepOutcome { success: false, .. } rather than a hard error, so a fan-out can continue when one branch fails. event_tx, when present, receives the step’s lifecycle/progress AgentEvents.

Provided Methods§

Source

fn concurrency_hint(&self) -> usize

Advisory ceiling on how many steps the orchestration layer should run concurrently. The local default returns its max_parallel_tasks; a scheduler-backed host may return its cluster-wide target. It is a hint, not a hard local bound — that is what lets orchestration scale past a single process.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl AgentExecutor for TaskExecutor

The local, in-process executor: every step runs as a child AgentLoop on this node’s tokio runtime. This is the default; a host (书安OS) substitutes its own AgentExecutor to place steps across a cluster.