pub enum WorkflowEvent {
StepStarted {
step_name: String,
step_index: u32,
timestamp: DateTime<Utc>,
},
StepCompleted {
step_name: String,
step_index: u32,
duration_ms: u64,
output_summary: Option<String>,
},
StepFailed {
step_name: String,
step_index: u32,
error: String,
duration_ms: u64,
},
ApprovalRequired {
step_name: String,
step_index: u32,
approval_id: Uuid,
},
AgentStepTokensUsed {
step_name: String,
tokens: u64,
cost_usd: Decimal,
},
}Expand description
A granular step-level event for real-time workflow monitoring.
Unlike Event which covers the full system lifecycle
(runs, auth, audit), WorkflowEvent tracks individual step transitions
within a single run. Serialized with a type discriminant for UI
consumption.
§Examples
use ironflow_engine::notify::WorkflowEvent;
use chrono::Utc;
let event = WorkflowEvent::StepStarted {
step_name: "deploy".to_string(),
step_index: 0,
timestamp: Utc::now(),
};
assert_eq!(event.event_type(), "step_started");
let json = serde_json::to_string(&event).unwrap();
assert!(json.contains("\"type\":\"step_started\""));Variants§
StepStarted
A step began execution.
Fields
StepCompleted
A step completed successfully.
Fields
StepFailed
A step failed.
Fields
ApprovalRequired
A step requires human approval before the run can continue.
Fields
AgentStepTokensUsed
Token usage report for an agent step.
Implementations§
Source§impl WorkflowEvent
impl WorkflowEvent
Sourcepub const STEP_STARTED: &'static str = "step_started"
pub const STEP_STARTED: &'static str = "step_started"
Event type constant for StepStarted.
Sourcepub const STEP_COMPLETED: &'static str = "step_completed"
pub const STEP_COMPLETED: &'static str = "step_completed"
Event type constant for StepCompleted.
Sourcepub const STEP_FAILED: &'static str = "step_failed"
pub const STEP_FAILED: &'static str = "step_failed"
Event type constant for StepFailed.
Sourcepub const APPROVAL_REQUIRED: &'static str = "approval_required"
pub const APPROVAL_REQUIRED: &'static str = "approval_required"
Event type constant for ApprovalRequired.
Sourcepub const AGENT_STEP_TOKENS_USED: &'static str = "agent_step_tokens_used"
pub const AGENT_STEP_TOKENS_USED: &'static str = "agent_step_tokens_used"
Event type constant for AgentStepTokensUsed.
Sourcepub fn event_type(&self) -> &'static str
pub fn event_type(&self) -> &'static str
Returns the event type as a static string (e.g. "step_started").
§Examples
use ironflow_engine::notify::WorkflowEvent;
use chrono::Utc;
let event = WorkflowEvent::StepStarted {
step_name: "build".to_string(),
step_index: 0,
timestamp: Utc::now(),
};
assert_eq!(event.event_type(), "step_started");Trait Implementations§
Source§impl Clone for WorkflowEvent
impl Clone for WorkflowEvent
Source§fn clone(&self) -> WorkflowEvent
fn clone(&self) -> WorkflowEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WorkflowEvent
impl RefUnwindSafe for WorkflowEvent
impl Send for WorkflowEvent
impl Sync for WorkflowEvent
impl Unpin for WorkflowEvent
impl UnsafeUnpin for WorkflowEvent
impl UnwindSafe for WorkflowEvent
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