pub enum WorkflowEvent {
StepStarted(WorkflowStepStartedEvent),
StepCompleted(WorkflowStepCompletedEvent),
StepFailed(WorkflowStepFailedEvent),
ApprovalRequired(WorkflowApprovalRequiredEvent),
InputRequired(WorkflowInputRequiredEvent),
AgentStepTokensUsed(WorkflowAgentStepTokensUsedEvent),
}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.
Each variant wraps a dedicated payload struct; the serialized form stays
flat, with type sitting next to the payload fields.
§Examples
use ironflow_engine::notify::{WorkflowEvent, WorkflowStepStartedEvent};
use chrono::Utc;
let event = WorkflowEvent::StepStarted(WorkflowStepStartedEvent {
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)?;
assert!(json.contains("\"type\":\"step_started\""));Variants§
StepStarted(WorkflowStepStartedEvent)
A step began execution.
StepCompleted(WorkflowStepCompletedEvent)
A step completed successfully.
StepFailed(WorkflowStepFailedEvent)
A step failed.
ApprovalRequired(WorkflowApprovalRequiredEvent)
A step requires human approval before the run can continue.
InputRequired(WorkflowInputRequiredEvent)
A step waits for a typed human input before the run can continue.
AgentStepTokensUsed(WorkflowAgentStepTokensUsedEvent)
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 INPUT_REQUIRED: &'static str = "input_required"
pub const INPUT_REQUIRED: &'static str = "input_required"
Event type constant for InputRequired.
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, WorkflowStepStartedEvent};
use chrono::Utc;
let event = WorkflowEvent::StepStarted(WorkflowStepStartedEvent {
step_name: "build".to_string(),
step_index: 0,
timestamp: Utc::now(),
});
assert_eq!(event.event_type(), "step_started");