macro_rules! agent_executor {
($ty:ty, |$ctx:ident, $queue:ident| async $body:block) => { ... };
($ty:ty,
execute: |$ctx:ident, $queue:ident| async $exec_body:block,
cancel: |$cctx:ident, $cqueue:ident| async $cancel_body:block
) => { ... };
}Expand description
Generates an AgentExecutor implementation from a
closure-like syntax.
§Basic usage (execute only)
use a2a_protocol_server::agent_executor;
struct MyAgent;
agent_executor!(MyAgent, |ctx, queue| async {
// ctx: &RequestContext, queue: &dyn EventQueueWriter
Ok(())
});§With cancel handler
use a2a_protocol_server::agent_executor;
struct CancelableAgent;
agent_executor!(CancelableAgent,
execute: |ctx, queue| async { Ok(()) },
cancel: |ctx, queue| async { Ok(()) }
);