const events = agent.subscribe(
{
sessionId: "reference-session-001",
eventTypes: ["task.updated"],
},
context,
);
for await (const event of events) {
console.log(event.type, event.sessionId);
}Every subscription must include a session, run, thread, or event filter. The root SDK does not expose an unfiltered global event stream.
| Filter | Use it for |
|---|---|
sessionId | Events associated with one durable session |
runId | One specific run |
threadId | One thread lineage within a session |
eventTypes | Only named event families needed by the observer |
The subscription observes persisted events independently of the browser or request that started the work. It does not replace the live stream used to respond to that request.
Continue with observability or the SDK reference.