How does Traverse handle events?
Traverse emits structured events at each state machine transition during a capability execution. The emitting_events phase is an explicit step in the state machine — it fires after successful execution and before the runtime returns the result to the caller.
What events carry
Each event includes the capability name and version, the state machine phase that triggered it, a timestamp, and relevant context for that phase. Discovery events include the candidates found. Selection events include which version was chosen and why. Execution events include the input hash and output hash.
The emitting_events phase
After the WASM binary executes and postconditions pass, the runtime enters emitting_events. This is where observers receive the execution result before the state machine moves to completed. Subscribers can inspect the full output without modifying the capability code itself.
Using events for observability
- Log every capability call with input and output hashes for an audit trail
- Count execution times per capability version for performance tracking
- Alert when postcondition failures occur more than expected
- Build an event log of every AI agent action that touched a capability
Trace artifacts
Events are part of what makes up the trace artifact. The artifact is the structured record of a complete execution: every phase, every validation result, and the final output. See what is a trace artifact for more on how traces work.
Events and traces together give you reproducibility. You can reconstruct exactly what happened in any past execution from the trace artifact alone.