EventBus allows external code to subscribe to lifecycle events emitted during the Attesta approval pipeline. Events are fired at key points — risk scoring, trust computation, challenge issuance, approval decisions, and audit logging — enabling integrations like webhooks, metrics, and custom logging.
EventType
TheEventType enum defines all lifecycle events emitted during the approval pipeline.
Import
Values
Event
A single lifecycle event emitted by the pipeline.Import
Fields
Example
EventBus
Publish/subscribe event bus for pipeline lifecycle events. Thread-safe. Supports both sync and async handlers. Errors in handlers are caught and logged — they never break the pipeline.Import
Constructor
EventBus takes no constructor arguments. All state is managed internally.
on()
Subscribe a synchronous callback to an event type. Can be used as a decorator or called directly.Signature
async_on()
Subscribe an async callback to an event type. Works identically toon() but for async handlers.
Signature
off()
Remove a callback from an event type’s subscription list.Signature
emit()
Emit an event to all registered synchronous handlers. Errors in handlers are caught and logged.Signature
async_emit()
Emit an event to both sync and async handlers. Sync handlers are called first, then async handlers are awaited.Signature
clear()
Remove all handlers for all event types.Integration with Attesta
Pass anEventBus to the Attesta constructor to receive pipeline lifecycle events:
Webhooks
Send HTTP notifications for pipeline events
Audit Trail
Every event is also recorded in the audit log