Skip to main content

AgentExecutor

Trait AgentExecutor 

Source
pub trait AgentExecutor:
    Send
    + Sync
    + 'static {
    // Required methods
    fn execute(
        &self,
        ctx: ExecutorContext,
    ) -> BoxStream<'static, Result<StreamResponse, A2AError>>;
    fn cancel(
        &self,
        ctx: ExecutorContext,
    ) -> BoxStream<'static, Result<StreamResponse, A2AError>>;
}
Expand description

The user’s business logic entry point.

Implement this trait to handle incoming messages and cancellation requests. The executor returns a stream of events (status updates, artifact updates, messages, or task objects).

Required Methods§

Source

fn execute( &self, ctx: ExecutorContext, ) -> BoxStream<'static, Result<StreamResponse, A2AError>>

Execute a message. Returns a stream of events.

Source

fn cancel( &self, ctx: ExecutorContext, ) -> BoxStream<'static, Result<StreamResponse, A2AError>>

Cancel an in-progress task. Returns a stream of events.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§