---
title: "client.events"
description: ""
section: "Libraries"
group: "SDK resources"
order: 205
---

Accessed via `client.events`.

## Methods

### `list`

List events.

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

**Types:** [ListEventsParams](/types/list-events-params) · [EventFilter](/types/event-filter) · [EventOrderBy](/types/event-order-by) · [EventShorthands](/types/event-shorthands) · [Page](/types/page) · [Event](/types/event)

### `retrieve`

Get an event by ID.

```ts
retrieve(params: RetrieveEventParams): Promise<Event>
```

**Types:** [RetrieveEventParams](/types/retrieve-event-params) · [Event](/types/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.

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

**Types:** [StreamEventsParams](/types/stream-events-params)

```ts
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();
```
