#[non_exhaustive]pub enum AgentStreamEvent {
Show 16 variants
ModelStreamUpdate(ModelStreamUpdateEventData),
ContentBlock(ContentBlockEventData),
ModelMessage(ModelMessageEventData),
ToolStreamUpdate(ToolStreamUpdateEventData),
ToolResult(ToolResultEventData),
BeforeInvocation(BeforeInvocationEventData),
AfterInvocation(AfterInvocationEventData),
BeforeModelCall(BeforeModelCallEventData),
AfterModelCall(AfterModelCallEventData),
BeforeTools(BeforeToolsEventData),
AfterTools(AfterToolsEventData),
BeforeToolCall(BeforeToolCallEventData),
AfterToolCall(AfterToolCallEventData),
MessageAdded(MessageAddedEventData),
Interrupt(InterruptEventData),
AgentResult(AgentResult),
}Expand description
One item of an agent stream (AgentStreamEvent): the record of a hook event.
Hook callbacks receive the live events; the stream yields these owned records. Serialization writes the stream-event JSON shared with the other Strands SDKs, and the records read it back.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ModelStreamUpdate(ModelStreamUpdateEventData)
A model stream event.
ContentBlock(ContentBlockEventData)
A finished content block.
ModelMessage(ModelMessageEventData)
A finished model message.
ToolStreamUpdate(ToolStreamUpdateEventData)
A tool progress event.
ToolResult(ToolResultEventData)
A tool result.
BeforeInvocation(BeforeInvocationEventData)
The invocation started.
AfterInvocation(AfterInvocationEventData)
The invocation ended.
BeforeModelCall(BeforeModelCallEventData)
A model call is starting.
AfterModelCall(AfterModelCallEventData)
A model call ended.
BeforeTools(BeforeToolsEventData)
A tool batch is starting.
AfterTools(AfterToolsEventData)
A tool batch ended.
BeforeToolCall(BeforeToolCallEventData)
A tool call is starting.
AfterToolCall(AfterToolCallEventData)
A tool call ended.
MessageAdded(MessageAddedEventData)
A message was added to the history.
Interrupt(InterruptEventData)
The agent stopped for an interrupt.
AgentResult(AgentResult)
The final result, {"type":"agentResultEvent","result":{...}}.
Implementations§
Source§impl AgentStreamEvent
impl AgentStreamEvent
Sourcepub fn event_type(&self) -> &'static str
pub fn event_type(&self) -> &'static str
The type tag of the record, such as "beforeInvocationEvent".
Trait Implementations§
Source§impl Clone for AgentStreamEvent
impl Clone for AgentStreamEvent
Source§impl Debug for AgentStreamEvent
impl Debug for AgentStreamEvent
Source§impl<'de> Deserialize<'de> for AgentStreamEvent
impl<'de> Deserialize<'de> for AgentStreamEvent
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&AfterInvocationEvent<'_>> for AgentStreamEvent
impl From<&AfterInvocationEvent<'_>> for AgentStreamEvent
Source§fn from(event: &AfterInvocationEvent<'_>) -> Self
fn from(event: &AfterInvocationEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&AfterModelCallEvent<'_>> for AgentStreamEvent
impl From<&AfterModelCallEvent<'_>> for AgentStreamEvent
Source§fn from(event: &AfterModelCallEvent<'_>) -> Self
fn from(event: &AfterModelCallEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&AfterToolCallEvent> for AgentStreamEvent
impl From<&AfterToolCallEvent> for AgentStreamEvent
Source§fn from(event: &AfterToolCallEvent) -> Self
fn from(event: &AfterToolCallEvent) -> Self
Converts to this type from the input type.
Source§impl From<&AfterToolsEvent<'_>> for AgentStreamEvent
impl From<&AfterToolsEvent<'_>> for AgentStreamEvent
Source§fn from(event: &AfterToolsEvent<'_>) -> Self
fn from(event: &AfterToolsEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&AgentResultEvent<'_>> for AgentStreamEvent
impl From<&AgentResultEvent<'_>> for AgentStreamEvent
Source§fn from(event: &AgentResultEvent<'_>) -> Self
fn from(event: &AgentResultEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&BeforeInvocationEvent<'_>> for AgentStreamEvent
impl From<&BeforeInvocationEvent<'_>> for AgentStreamEvent
Source§fn from(event: &BeforeInvocationEvent<'_>) -> Self
fn from(event: &BeforeInvocationEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&BeforeModelCallEvent<'_>> for AgentStreamEvent
impl From<&BeforeModelCallEvent<'_>> for AgentStreamEvent
Source§fn from(event: &BeforeModelCallEvent<'_>) -> Self
fn from(event: &BeforeModelCallEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&BeforeToolCallEvent> for AgentStreamEvent
impl From<&BeforeToolCallEvent> for AgentStreamEvent
Source§fn from(event: &BeforeToolCallEvent) -> Self
fn from(event: &BeforeToolCallEvent) -> Self
Converts to this type from the input type.
Source§impl From<&BeforeToolsEvent<'_>> for AgentStreamEvent
impl From<&BeforeToolsEvent<'_>> for AgentStreamEvent
Source§fn from(event: &BeforeToolsEvent<'_>) -> Self
fn from(event: &BeforeToolsEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&ContentBlockEvent<'_>> for AgentStreamEvent
impl From<&ContentBlockEvent<'_>> for AgentStreamEvent
Source§fn from(event: &ContentBlockEvent<'_>) -> Self
fn from(event: &ContentBlockEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&InterruptEvent<'_>> for AgentStreamEvent
impl From<&InterruptEvent<'_>> for AgentStreamEvent
Source§fn from(event: &InterruptEvent<'_>) -> Self
fn from(event: &InterruptEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&MessageAddedEvent<'_>> for AgentStreamEvent
impl From<&MessageAddedEvent<'_>> for AgentStreamEvent
Source§fn from(event: &MessageAddedEvent<'_>) -> Self
fn from(event: &MessageAddedEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&ModelMessageEvent<'_>> for AgentStreamEvent
impl From<&ModelMessageEvent<'_>> for AgentStreamEvent
Source§fn from(event: &ModelMessageEvent<'_>) -> Self
fn from(event: &ModelMessageEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&ModelStreamUpdateEvent<'_>> for AgentStreamEvent
impl From<&ModelStreamUpdateEvent<'_>> for AgentStreamEvent
Source§fn from(event: &ModelStreamUpdateEvent<'_>) -> Self
fn from(event: &ModelStreamUpdateEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&ToolResultEvent> for AgentStreamEvent
impl From<&ToolResultEvent> for AgentStreamEvent
Source§fn from(event: &ToolResultEvent) -> Self
fn from(event: &ToolResultEvent) -> Self
Converts to this type from the input type.
Source§impl From<&ToolStreamUpdateEvent> for AgentStreamEvent
impl From<&ToolStreamUpdateEvent> for AgentStreamEvent
Source§fn from(event: &ToolStreamUpdateEvent) -> Self
fn from(event: &ToolStreamUpdateEvent) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentStreamEvent
impl !UnwindSafe for AgentStreamEvent
impl Freeze for AgentStreamEvent
impl Send for AgentStreamEvent
impl Sync for AgentStreamEvent
impl Unpin for AgentStreamEvent
impl UnsafeUnpin for AgentStreamEvent
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.