Skip to main content

Documentation Index

Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt

Use this file to discover all available pages before exploring further.

find(...) is the unified lookup API: search history, wait for future events, or combine both.

Interface

await bus.find(
    event_type,                            # Event class, event type string, or '*'
    where: Callable[[BaseEvent], bool] | None = None,
    child_of: BaseEvent | None = None,
    past: bool | float | timedelta = True,
    future: bool | float = False,
    **event_fields,                        # equality filters (event_status='completed', request_id='abc', ...)
)

Option semantics

  • past
    • true: search all history (default)
    • false: skip history
    • number (or timedelta in Python): search recent history window
  • future
    • false: do not wait (default)
    • true: wait indefinitely
    • number: wait up to N seconds
  • where: predicate filter
  • child_of: match only descendants of the given parent event
  • event_fields: strict equality filters on event fields/metadata
Default behavior when omitted is history-only lookup (past=True, future=False).

Common use cases

1) History lookup only (non-blocking)

existing = await bus.find(ResponseEvent)

2) Wait only for future events

future = await bus.find(ResponseEvent, past=False, future=5)

3) Check recent history, then keep waiting briefly

match = await bus.find(ResponseEvent, past=5, future=5)

4) Filter by fields + predicate

match = await bus.find(
    ResponseEvent,
    where=lambda e: e.request_id == my_id,
    event_status='completed',
    future=5,
)

5) Wildcard lookup across all event types

any_completed = await bus.find(
    '*',
    where=lambda e: e.event_type.endswith('ResultEvent'),
    event_status='completed',
    future=5,
)

6) Find descendants of a specific parent event

parent_event = await bus.emit(NavigateToUrlEvent(url='https://example.com')).now()
child = await bus.find(TabCreatedEvent, child_of=parent_event, past=5)

7) Debounce expensive work

event = (
    await bus.find(ScreenshotEvent, past=10, future=False)
    or await bus.find(ScreenshotEvent, past=False, future=5)
    or bus.emit(ScreenshotEvent())
)
await event.now()

Important behavior

  • find() resolves when an event is emitted, not when handlers finish.
  • To wait for handler completion, call await event.now() in Python/TypeScript, event.Now() in Go, or event.now().await in Rust.
  • If no match is found (or future times out), find() returns None / null.
  • If both past and future are false, it returns immediately with no match.

Returning multiple matches: filter()

filter() takes the same arguments as find() but returns the list of all matching events (ordered newest to oldest), plus an optional limit argument to cap the number of results. find() is equivalent to filter(..., limit=1) returning the first match (or None / null).
recent = await bus.filter(ResponseEvent, past=10, future=False, limit=5)