Skip to main content

StreamableTaskHandler

Trait StreamableTaskHandler 

Source
pub trait StreamableTaskHandler:
    Send
    + Sync
    + Debug {
    // Required method
    fn handle_streaming_task<'life0, 'async_trait>(
        &'life0 self,
        task: Task,
        message: Option<A2AMessage>,
        emitter: StreamEmitter,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Handler invoked by the server for message/stream requests.

The server is responsible for parsing the request, persisting the initial Submitted task, and emitting the first event (the Task wrapper). The handler then drives the task to a terminal state by emitting StreamResponse events via StreamEmitter. The last emitted event must carry a TaskStatusUpdateEvent with final: true; otherwise callers will treat the stream as unterminated.

Required Methods§

Source

fn handle_streaming_task<'life0, 'async_trait>( &'life0 self, task: Task, message: Option<A2AMessage>, emitter: StreamEmitter, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drive a message/stream interaction.

task is the freshly-built task already persisted in storage at TaskStateSubmitted. The handler should emit subsequent events (typically Working → optional artifact(s) → Completed).

Implementors§