pub struct DefaultStreamingTaskHandler { /* private fields */ }Expand description
Opt-in default message/stream handler wired up by
[A2AServerBuilder::with_default_streaming_task_handler] /
[A2AServerBuilder::with_default_task_handlers].
When an Agent is configured, the handler iterates generate_content_stream
from the inference gateway, parses each OpenAI-style delta, and emits a
TaskArtifactUpdateEvent per non-empty content chunk (append: true,
shared artifact_id) - clients see the reply build up in real time. The
stream terminates with a final last_chunk: true artifact + a
Completed status update.
Without an agent, emits a single instructional artifact + Completed
so the bundled defaults remain usable for examples and tests.
Implementations§
Source§impl DefaultStreamingTaskHandler
impl DefaultStreamingTaskHandler
pub fn new(agent: Option<Arc<Agent>>) -> Self
Sourcepub fn set_enable_usage_metadata(&mut self, enable: bool)
pub fn set_enable_usage_metadata(&mut self, enable: bool)
Override whether terminal tasks carry usage / execution_stats
metadata. A2AServerBuilder calls this to
honour AgentConfig::enable_usage_metadata.
Sourcepub fn is_usage_metadata_enabled(&self) -> bool
pub fn is_usage_metadata_enabled(&self) -> bool
Whether terminal tasks will carry usage/execution metadata.
Trait Implementations§
Source§impl Debug for DefaultStreamingTaskHandler
impl Debug for DefaultStreamingTaskHandler
Source§impl StreamableTaskHandler for DefaultStreamingTaskHandler
impl StreamableTaskHandler for DefaultStreamingTaskHandler
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,
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,
message/stream interaction. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DefaultStreamingTaskHandler
impl !UnwindSafe for DefaultStreamingTaskHandler
impl Freeze for DefaultStreamingTaskHandler
impl Send for DefaultStreamingTaskHandler
impl Sync for DefaultStreamingTaskHandler
impl Unpin for DefaultStreamingTaskHandler
impl UnsafeUnpin for DefaultStreamingTaskHandler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more