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§
Sourcefn execute(
&self,
ctx: ExecutorContext,
) -> BoxStream<'static, Result<StreamResponse, A2AError>>
fn execute( &self, ctx: ExecutorContext, ) -> BoxStream<'static, Result<StreamResponse, A2AError>>
Execute a message. Returns a stream of events.
Sourcefn cancel(
&self,
ctx: ExecutorContext,
) -> BoxStream<'static, Result<StreamResponse, A2AError>>
fn cancel( &self, ctx: ExecutorContext, ) -> BoxStream<'static, Result<StreamResponse, A2AError>>
Cancel an in-progress task. Returns a stream of events.