find(...) is the unified lookup API: search history, wait for future events, or combine both.
Interface
- Python
- TypeScript
Option semantics
pasttrue: search all history (default)false: skip historynumber(ortimedeltain Python): search recent history window
futurefalse: do not wait (default)true: wait indefinitelynumber: wait up to N seconds
where: predicate filterchild_of: match only descendants of the given parent eventevent_fields: strict equality filters on event fields/metadata
past=True, future=False).
Common use cases
1) History lookup only (non-blocking)
- Python
- TypeScript
2) Wait only for future events
- Python
- TypeScript
3) Check recent history, then keep waiting briefly
- Python
- TypeScript
4) Filter by fields + predicate
- Python
- TypeScript
5) Wildcard lookup across all event types
- Python
- TypeScript
6) Find descendants of a specific parent event
- Python
- TypeScript
7) Debounce expensive work
- Python
- TypeScript
Important behavior
find()resolves when an event is emitted, not when handlers finish.- To wait for handler completion, await the returned event (
await eventin Python,await event.done()in TypeScript). - If no match is found (or
futuretimes out),find()returnsNone/null. - If both
pastandfuturearefalse, it returns immediately with no match.