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.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
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"])
import { EventBus, IshClient } from "ish-harness";
const client = new IshClient();
const bus = new EventBus(client);
const sub = bus.subscribe("build.*");
bus.publish("build.api", { status: "complete" }, "builder");
const page = bus.poll(sub);
console.log(page.messages);
bus.close();
client.close();
use ish_harness::EventBus;
let bus = EventBus::new();
let mut rx = bus.subscribe("build.*");
bus.publish_event("build.api", "builder", r#"{"status":"complete"}"#);
if let Ok(msg) = rx.try_recv() {
println!("Received: {msg}");
}
package main
import (
"fmt"
ish "github.com/ish-harness/ish-harness/sdks/go"
)
func main() {
client, err := ish.NewClient()
if err != nil {
panic(err)
}
defer client.Close()
bus, err := ish.NewEventBus(client, nil, 0)
if err != nil {
panic(err)
}
defer bus.Close()
sub, err := bus.Subscribe(ish.StringPtr("build.*"))
if err != nil {
panic(err)
}
if _, err = bus.Publish("build.api", map[string]any{"status": "complete"}, ish.StringPtr("builder")); err != nil {
panic(err)
}
page, err := bus.Poll(sub, nil)
if err != nil {
panic(err)
}
fmt.Println(page)
}
using System.Text.Json;
using Ish.Harness;
using var client = new IshClient();
using var bus = new EventBus(client);
var sub = bus.Subscribe("build.*");
using var payload = JsonDocument.Parse("{\"status\":\"complete\"}");
bus.Publish("build.api", payload.RootElement, source: "builder");
var page = bus.Poll(sub);
Console.WriteLine(page);
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.ishharness.EventBus;
import io.github.ishharness.IshClient;
import java.nio.file.Path;
try (var client = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")));
var bus = new EventBus(client)) {
String sub = bus.subscribe("build.*");
var payload = new ObjectMapper().createObjectNode().put("status", "complete");
bus.publish("build.api", payload, "builder");
var page = bus.poll(sub);
System.out.println(page);
}
| Need | Use | Default lifetime |
|---|---|---|
| Notify subscribers or message an agent in the running process | EventBus | Process memory; subscribers can miss delivery while disconnected |
| Queue messages with a size limit | BoundedMailbox | Process memory; applies the configured overflow policy |
| Keep queued messages across restarts | SqliteMailbox / DurableMailbox | SQLite 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
| Need | Choose | Delivery and recovery | Best for |
|---|---|---|---|
| Notify listeners in one process | EventBus | In-memory; subscribers can miss events while disconnected | Live updates and coordination |
| Queue work with a size limit | BoundedMailbox | Applies the configured overflow policy | Backpressure in a running service |
| Resume queued messages after restart | SqliteMailbox / DurableMailbox | Persists messages and claim state in SQLite | Durable 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.