pub struct WorkflowEvent {
pub event_type: WorkflowEventType,
pub elapsed_nanos: Option<u64>,
pub metadata: Option<WorkflowEventMetadata>,
pub data: Value,
}Expand description
One smol-workflows event stream envelope.
Serialized events are intended to be written as JSON Lines: one complete
WorkflowEvent per line. The JSON field name for event_type
is type.
Fields§
§event_type: WorkflowEventTypeEvent type discriminator, serialized as the top-level type field.
elapsed_nanos: Option<u64>Nanoseconds since the root workflow stream start.
The root workflow.started event may omit this. All later events,
including child workflow.started events, should include it.
metadata: Option<WorkflowEventMetadata>Optional correlation metadata.
data: ValueEvent payload.
The payload shape is defined by the event type. For
workflow.agent_event, this is raw provider-owned data.
Implementations§
Source§impl WorkflowEvent
impl WorkflowEvent
Sourcepub fn result(
input_tokens: u64,
output_tokens: u64,
total_tokens: u64,
results: Value,
) -> Self
pub fn result( input_tokens: u64, output_tokens: u64, total_tokens: u64, results: Value, ) -> Self
Construct a workflow.result event.
Sourcepub fn error(message: String, details: Option<String>) -> Self
pub fn error(message: String, details: Option<String>) -> Self
Construct a workflow.error event.
Sourcepub fn agent_started(data: Value, metadata: WorkflowEventMetadata) -> Self
pub fn agent_started(data: Value, metadata: WorkflowEventMetadata) -> Self
Construct a workflow.agent_started event.
Sourcepub fn agent_event(data: Value, metadata: WorkflowEventMetadata) -> Self
pub fn agent_event(data: Value, metadata: WorkflowEventMetadata) -> Self
Construct a workflow.agent_event event from raw provider data.
Sourcepub fn agent_completed(data: Value, metadata: WorkflowEventMetadata) -> Self
pub fn agent_completed(data: Value, metadata: WorkflowEventMetadata) -> Self
Construct a workflow.agent_completed event.
Sourcepub fn agent_failed(data: Value, metadata: WorkflowEventMetadata) -> Self
pub fn agent_failed(data: Value, metadata: WorkflowEventMetadata) -> Self
Construct a workflow.agent_failed event.
Trait Implementations§
Source§impl Clone for WorkflowEvent
impl Clone for WorkflowEvent
Source§fn clone(&self) -> WorkflowEvent
fn clone(&self) -> WorkflowEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkflowEvent
impl Debug for WorkflowEvent
Source§impl<'de> Deserialize<'de> for WorkflowEvent
impl<'de> Deserialize<'de> for WorkflowEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for WorkflowEvent
impl PartialEq for WorkflowEvent
Source§fn eq(&self, other: &WorkflowEvent) -> bool
fn eq(&self, other: &WorkflowEvent) -> bool
self and other values to be equal, and is used by ==.