client.events

Accessed via client.events.

Methods

list

List events.

TypeScript
list(params?: Omit<ListEventsParams, "filter" | "orderBy"> & { filter?: EventFilter; orderBy?: EventOrderBy[]; } & EventShorthands): Promise<Page<Event>>

Types: ListEventsParams · EventFilter · EventOrderBy · EventShorthands · Page · Event

retrieve

Get an event by ID.

TypeScript
retrieve(params: RetrieveEventParams): Promise<Event>

Types: RetrieveEventParams · Event

stream

Open a real-time WebSocket event stream for a workspace.

Subscribe with .on(type, handler). The type filter supports exact matches ("run.completed"), wildcards ("agent.*"), and the catch-all "*". Connects to /api/ws/events and auto- reconnects with exponential backoff. Call .close() to end.

TypeScript
stream(params: StreamEventsParams & { options?: EventStreamOptions }): EventStream

Types: StreamEventsParams

TypeScript
const stream = client.events.stream({ workspaceId: "wsp_..." });

stream.on("run.completed", (event) => {
  console.log(`Run ${event.subjectId} completed`);
});
stream.on("agent.*", (event) => {
  console.log("agent event:", event.type);
});

// Later, when you're done:
stream.close();