Skip to main content

Module global

Module global 

Source
Expand description

Process-wide shared reference to the active AgentBus.

Spawned sub-agent sessions (created via the spawn tool) need to publish on the same bus as their parent, but the tool trait’s [execute] method takes only a serde_json::Value — there is no way to thread the parent bus through the call chain without changing every tool.

Entrypoints (CLI run, serve, tui, ralph) call set_global once after constructing their bus; factories that build child sessions call global to attach the same bus.

The global is set at most once per process. Subsequent calls to set_global are no-ops.

Functions§

global
Return a clone of the process-wide bus, if one has been installed.
set_global
Install the process-wide bus. Idempotent — first writer wins.