<lifecycle>
<lifecycle> contains observational hooks for run and step events.
Why use it
Use it for logging, metrics, alerts, and notifications that should observe an outcome without changing the business DAG or rewriting the workflow result.
Common use cases
- Notify operators after a workflow fails.
- Record step-start or step-completion observations.
- Run final cleanup observations after any outcome.
Syntax
WOML
<lifecycle>
<on-error>
<script>
console.error(lifecycle.failure?.code);
</script>
</on-error>
<on-complete>
<script>console.log(lifecycle.workflow.outcome);</script>
</on-complete>
</lifecycle>Rules and behavior
- A workflow has at most one lifecycle block.
- Each supported hook may occur once and contains one or more source-ordered
<script>or<notify>actions. - Lifecycle failures become durable warnings and do not rewrite the business outcome.
- Reusable definitions support only
<on-success>,<on-error>, and<on-complete>, with script-only observational hooks.