Open Agent Loops
API Reference

Dispatcher

@open-agent-loops/core


Defined in: channels/dispatcher.ts:101

Turns submit(sessionId, message) calls into throttled runAgent runs. See the module:channels/dispatcher | module docs for the model.

Accessors

inFlight

Get Signature

get inFlight(): number;

Defined in: channels/dispatcher.ts:145

Runs currently in flight across all sessions.

Returns

number

Constructors

Constructor

new Dispatcher(options): Dispatcher;

Defined in: channels/dispatcher.ts:108

Parameters

ParameterType
optionsDispatcherOptions

Returns

Dispatcher

Methods

addSessionListener()

addSessionListener(listener): void;

Defined in: channels/dispatcher.ts:140

Attach a session-aware event listener after construction. This is what lets a caller own the dispatcher and still hand it to a ChannelBridge (which attaches its reply router this way) — both observe every run's events, tagged with their sessionId.

Parameters

ParameterTypeDescription
listenerSessionEventListenerCalled for every event of every run.

Returns

void


stats()

stats(): DispatcherStats;

Defined in: channels/dispatcher.ts:150

Aggregate backpressure readings — what an adaptive controller acts on.

Returns

DispatcherStats


submit()

submit(sessionId, ...messages): void;

Defined in: channels/dispatcher.ts:171

Enqueue one or more messages for a session and ensure it is being pumped. Non-blocking: always returns immediately so the caller (a socket handler) can keep draining its transport. Backpressure is applied at the buffer, never here.

Parameters

ParameterTypeDescription
sessionIdstringThe session/thread the messages belong to.
...messagesMessage[]The inbound message(s).

Returns

void

On this page