Skip to main content

Messaging

Messaging is a delivery channel agents can use to exchange context. Use EventBus to notify live subscribers or send an agent an inbox message; use a mailbox when work needs queueing, and choose SQLite-backed delivery when it must survive a process restart. Unlike ContextStore, messaging delivers events instead of exposing shared named values that agents can query or update. For example, update a shared deployment record in ContextStore, then publish an event telling the reviewer agent to re-check it.

from ish import EventBus

bus = EventBus()
sub = bus.subscribe("build.*")
bus.publish_sync("build.api", {"status": "complete"}, source="builder")
page = bus.poll(sub)
print(page["messages"])
NeedUseDefault lifetime
Notify subscribers or message an agent in the running processEventBusProcess memory; subscribers can miss delivery while disconnected
Queue messages with a size limitBoundedMailboxProcess memory; applies the configured overflow policy
Keep queued messages across restartsSqliteMailbox / DurableMailboxSQLite database when configured

EventBus delivers notifications and targeted inbox messages; it does not hold shared mutable state. Use ContextStore for shared facts and documents. Choose the SQLite mailbox only for queued messages that need to survive restart.

How event delivery works​

Choose an event or mailbox​

NeedChooseDelivery and recoveryBest for
Notify listeners in one processEventBusIn-memory; subscribers can miss events while disconnectedLive updates and coordination
Queue work with a size limitBoundedMailboxApplies the configured overflow policyBackpressure in a running service
Resume queued messages after restartSqliteMailbox / DurableMailboxPersists messages and claim state in SQLiteDurable background work

An event communicates that something happened or asks another agent to act. It is not a shared key-value document: use ContextStore for state that agents need to read and update. EventBus subscriptions and inboxes are process-local; SqliteMailbox persists queued messages and claim state across restarts.

See Messaging Details for publishing, subscriptions, agent inboxes, bounded queues, and durable delivery.