# bubus | Browser Use | Knowledge Base | Instagit

📢 Production-ready python event bus library with support for async and sync handlers, forwarding betwen busses w/ parent event tracking + loop prevention,  FIFO and concurrency options, and WAL persistence. Powers the browser-use library.

GitHub Stars: 95

Repository: https://github.com/browser-use/bubus

---

## Articles

### [How to Debug Event Flow Using log_tree() in bubus](/browser-use/bubus/how-to-debug-event-flow-using-log-tree-in-bubus)

Debug event flow in bubus using the log_tree() function. Generate a formatted string of the complete event-handler hierarchy, timing data, and error states for efficient troubleshooting.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Handle Concurrent Event Dispatch Without Race Conditions in bubus](/browser-use/bubus/how-to-handle-concurrent-event-dispatch-without-race-conditions-in-bubus)

Safely handle concurrent event dispatch in bubus. Learn how bubus uses a global lock and custom asyncio queue to prevent race conditions while enabling parallel handler execution for robust event processing.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Merge Dict Results from Multiple Handlers in bubus](/browser-use/bubus/how-to-merge-dict-results-from-multiple-handlers-in-bubus)

Combine bubus dict results from multiple handlers using await event.event_results_flat_dict(). Detect and filter conflicts easily.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Filter Event Results with Include/Exclude Predicates in bubus](/browser-use/bubus/how-to-filter-event-results-with-include-exclude-predicates-in-bubus)

Master filtering event results with bubus include/exclude predicates. Learn to refine incoming events and handler outcomes for precise control.

- Tags: how-to-guide
- Published: 2026-02-26

### [How Event Path Tracking Works Across Multiple Bubus Buses](/browser-use/bubus/how-does-event-path-tracking-work-across-multiple-bubus-buses)

Understand how Bubus event path tracking automatically records eventBus history preventing infinite loops in your browserUse/bubus repository for hierarchical routing.

- Tags: internals
- Published: 2026-02-26

### [How to Use Class Methods and Static Methods as Event Handlers in Bubus](/browser-use/bubus/how-to-use-class-methods-and-static-methods-as-event-handlers-in-bubus)

Learn how to use class methods and static methods as event handlers in Bubus. Discover how Bubus automatically detects handler protocols and passes class or treats static methods as functions.

- Tags: how-to-guide
- Published: 2026-02-26

### [How Event Parent-Child Relationships Are Tracked in Bubus: A Deep Dive into the EventBus Tree](/browser-use/bubus/how-are-event-parent-child-relationships-tracked-in-bubus)

Discover how Bubus tracks event parent-child relationships using event_parent_id metadata and context-aware dispatch logic for seamless event management. Learn more about the EventBus tree.

- Tags: deep-dive
- Published: 2026-02-26

### [How to Stop and Clean Up an EventBus Instance in bubus: Complete Guide](/browser-use/bubus/how-to-stop-and-clean-up-an-event-bus-instance-in-bubus)

Learn how to stop and clean up an EventBus instance in bubus. Gracefully shut down, cancel operations, and purge internal state with our complete guide.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Configure Event Timeouts in Bubus: A Complete Guide](/browser-use/bubus/how-to-configure-event-timeouts-in-bubus)

Master Bubus event timeouts with this guide. Learn to set default, instance, or handler-specific limits for reliable event management in your browser-use/bubus project.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Use Wildcard Event Subscriptions in Bubus](/browser-use/bubus/how-to-use-wildcard-event-subscriptions-in-bubus)

Master Bubus wildcard event subscriptions with bus.on('*', handler) to capture all events. Learn to manage every event dispatched through the bus effectively.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Aggregate Results from Multiple Handlers in Bubus: A Complete Guide](/browser-use/bubus/how-to-aggregate-results-from-multiple-handlers-in-bubus)

Learn to aggregate handler results in Bubus. Easily collect, filter, and merge outputs using EventResult helper methods after all handlers complete. Get your complete guide now.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Handle Errors and Exceptions in Bubus Event Handlers: A Complete Guide](/browser-use/bubus/how-to-handle-errors-and-exceptions-in-bubus-event-handlers)

Master Bubus error and exception handling. Learn how Bubus converts exceptions to EventResults, surfaces them, and cancels child events for leak prevention. Get the complete guide.

- Tags: how-to-guide
- Published: 2026-02-26

### [How FIFO Event Processing Works in bubus: Queue Architecture and Event Flow](/browser-use/bubus/how-does-fifo-event-processing-work-in-bubus)

Discover how bubus ensures FIFO event processing using CleanShutdownQueue and a single run loop. Learn about its queue architecture and event flow for reliable order.

- Tags: deep-dive
- Published: 2026-02-26

### [How to Enforce Handler Return Value Types with BaseEvent[T] in bubus](/browser-use/bubus/how-to-enforce-handler-return-value-types-with-base-event-t-in-bubus)

Learn how to enforce handler return value types with BaseEvent[T] in bubus. Automatically validate handler outputs against expected types using Pydantic for robust data handling.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Track Event Status (Pending, Started, Completed) in bubus](/browser-use/bubus/how-to-track-event-status-pending-started-completed-in-bubus)

Learn how to track event status pending started or completed in bubus. Discover how the event_status property on BaseEvent instances provides real-time lifecycle insights.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Enable Parallel Handler Execution in Bubus: Configuration Guide and Trade-offs](/browser-use/bubus/how-to-enable-parallel-handler-execution-and-its-trade-offs-in-bubus)

Enable parallel handler execution in Bubus by setting parallel_handlers=True. Learn configuration and trade-offs for minimized latency and nondeterministic execution order.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Define Type-Safe Events with Pydantic BaseEvent in bubus](/browser-use/bubus/how-to-define-type-safe-events-with-pydantic-base-event-in-bubus)

Learn to define type-safe events in bubus using Pydantic BaseEvent. Ensure your event handler return values are automatically validated and cast to your specified Pydantic models or built-in types. Boost your development with r...

- Tags: tutorial
- Published: 2026-02-26

### [How to Set Up Write-Ahead Logging (WAL) for JSONL Event Persistence in bubus](/browser-use/bubus/how-to-set-up-write-ahead-logging-wal-to-persist-events-to-jsonl-in-bubus)

Learn how to set up write-ahead logging WAL in bubus. Persist completed events as JSONL by providing a wal_path to the EventBus constructor. Ensure reliable event persistence.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Use the Retry Decorator with Different Semaphore Scopes in bubus](/browser-use/bubus/how-to-use-the-retry-decorator-with-different-semaphore-scopes-in-bubus)

Master the bubus retry decorator with global, class, self, and multiprocess semaphore scopes. Implement robust automatic retries and concurrency control for your Python applications.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Configure Memory Management with max_history_size in bubus](/browser-use/bubus/how-to-configure-memory-management-with-max-history-size-in-bubus)

Learn how to configure memory management in bubus using max_history_size. Control in-memory event history by setting a limit or allowing unlimited growth for efficient resource usage.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Use the `expect()` Method to Wait for Events in Bubus](/browser-use/bubus/how-to-use-the-expect-method-to-wait-for-events-in-bubus)

Learn how to use the expect() method in Bubus to wait for specific events on the EventBus. This guide covers automatic cleanup and timeout handling for efficient asynchronous operations.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Handle Nested Child Events in bubus](/browser-use/bubus/how-to-handle-nested-child-events-in-bubus)

Learn how to handle nested child events in bubus. bubus automatically links events and ensures parents complete only after all descendants finish. Master event management.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Forward Events Between Multiple EventBus Instances in Bubus](/browser-use/bubus/how-to-use-event-forwarding-between-multiple-event-bus-instances)

Learn to forward events between multiple EventBus instances in Bubus using wildcards. Easily route events universally while preventing loops. Explore simple and effective event bus management today.

- Tags: how-to-guide
- Published: 2026-02-26

### [How to Implement Retry Logic with Semaphore Concurrency Control in bubus](/browser-use/bubus/how-to-implement-retry-logic-with-semaphore-concurrency-control-in-bubus)

Implement robust retry logic with semaphore concurrency control in bubus. Use the @retry decorator to manage retries and limit concurrent operations effectively.

- Tags: how-to-guide
- Published: 2026-02-26

