BaseEvent is the typed payload + runtime state object that flows through the bus.
Use subclassing (Python) or BaseEvent.extend(...) (TypeScript) to define event payload fields.
Defining events
- Python
- TypeScript
- Immediate path:
await event(Python) /await event.done()(TypeScript) - Queue-order path:
await event.event_completed()(Python) /await event.eventCompleted()(TypeScript)
Core metadata fields
Common event metadata fields available in both runtimes:event_id: unique UUIDv7event_type: event name/type keyevent_version: payload version markerevent_result_type: expected handler return schema/typeevent_timeout: per-event timeout override (None/nullmeans use the current processing bus default)event_handler_timeout: per-handler timeout cap overrideevent_handler_slow_timeout: per-handler slow warning thresholdevent_concurrency: event scheduling mode override (None/nullmeans use the current processing bus default)event_handler_concurrency: handler scheduling mode override (None/nullmeans use the current processing bus default)event_handler_completion: handler completion strategy override (None/nullmeans use the current processing bus default)
Runtime fields
event_status: pending/started/completedevent_created_at,event_started_at,event_completed_atevent_started_at/event_completed_atareNone(Python) /null(TypeScript) until setevent_parent_idandevent_emitted_by_handler_idareNone/nullwhen unsetevent_path: buses traversedevent_results: per-handler result entries- Child-event tracking (
event_children/descendants)
Completion model
Events are returned in pending state fromemit(), then complete asynchronously.
- Python
- TypeScript
Result access helpers
first()
- Python
- TypeScript
All results
- Python
- TypeScript
Per-handler result entries
You can create/update a specificEventResult entry for a handler (useful for controlled seeding/rehydration flows).
- Python
- TypeScript
Resetting an event
You can create a fresh pending copy for re-emit.- Python
- TypeScript
Serialization
Events are JSON-serializable in both implementations for bridge and cross-runtime workflows.- Python
- TypeScript
Notes
- Reserved names are validated in both runtimes:
busandfirstare reserved runtime APIs and cannot be provided as payload fields.- Unknown
event_*fields are rejected. - Known built-in
event_*fields (for exampleevent_timeout) can still be intentionally overridden in event definitions.
model_*is also reserved:- Python: unknown
model_*fields are rejected, but valid Pydantic namespace overrides (for examplemodel_config) are allowed. - TypeScript: any
model_*field is rejected.
- Python: unknown
event_result_typedrives handler return validation in both runtimes.- Parent-child tracking is automatic when events are emitted from handlers.
Reserved Fields
- Python
- TypeScript