Summary
There is currently no event emitter or hook system for lifecycle events like "workflow transitioned", "command started", "command failed", etc. For production use, teams need to wire these into OpenTelemetry traces, structured logging, or metrics.
Proposal
Add an observer/hook pattern at the runtime level with events such as:
workflow.created
workflow.transitioned (with from/to state, event name)
command.started
command.succeeded
command.failed
workflow.completed
workflow.errored
The hook system should be lightweight and non-intrusive — observers should not affect workflow execution.
Benefits
- Enables OpenTelemetry integration for distributed tracing
- Structured logging of workflow lifecycle without polluting command handlers
- Metrics collection (transition counts, command durations, error rates)
- Essential for production readiness
Considerations
- Sync vs async observers (async observers shouldn't block transitions)
- Whether observers receive a read-only view of context/metadata
- Integration patterns with popular observability stacks
Summary
There is currently no event emitter or hook system for lifecycle events like "workflow transitioned", "command started", "command failed", etc. For production use, teams need to wire these into OpenTelemetry traces, structured logging, or metrics.
Proposal
Add an observer/hook pattern at the runtime level with events such as:
workflow.createdworkflow.transitioned(with from/to state, event name)command.startedcommand.succeededcommand.failedworkflow.completedworkflow.erroredThe hook system should be lightweight and non-intrusive — observers should not affect workflow execution.
Benefits
Considerations