> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmodus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# runs

## Methods

### active()

```typescript
active(options?: { pageSize: number; pageToken: string }): Promise<Page<ActiveConversationRun>>
```

List active conversation runs across the organization.

#### Parameters

<ResponseField name={"options"} type={"{ pageSize: number; pageToken: string }"} />

#### Returns

`Promise<Page<ActiveConversationRun>>`

A page of active runs with session and status metadata.

### activeBySession()

```typescript
activeBySession(sessionIds: readonly string[]): Promise<ActiveConversationRun[]>
```

Look up active runs for specific conversation sessions.

#### Parameters

<ResponseField name={"sessionIds"} type={"readonly string[]"} required>
  Up to 100 session ids.
</ResponseField>

#### Returns

`Promise<ActiveConversationRun[]>`

Active runs matching any of the given sessions.

### cancel()

```typescript
cancel(runId: string): Promise<void>
```

Cancel a run that is still in progress.

#### Parameters

<ResponseField name={"runId"} type={"string"} required>
  Run id to cancel.
</ResponseField>

#### Returns

`Promise<void>`

### create()

```typescript
create(workflowId: string | number, body: object, options?: { idempotencyKey: string }): AgentRunStream
```

Start a workflow run and stream run events.

```ts
const stream = client.workflows.runs.create(workflowId, {
  message: 'Summarize yesterday\'s sales',
  sessionId: 'conv-abc',
})
for await (const event of stream) {
  if (event.type === 'token') process.stdout.write(event.content)
  if (event.type === 'done') break
}
```

#### Parameters

<ResponseField name={"workflowId"} type={"string | number"} required>
  Workflow id or slug to run.
</ResponseField>

<ResponseField name={"body"} type={"object"} required>
  Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
</ResponseField>

<ResponseField name={"options"} type={"{ idempotencyKey: string }"} />

#### Returns

`AgentRunStream`

A stream of run events (tokens, completion, errors, and related signals).

### createModus()

```typescript
createModus(body: object, options?: { idempotencyKey: string }): AgentRunStream
```

Start a Modus assistant run and stream run events.

#### Parameters

<ResponseField name={"body"} type={"object"} required>
  Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
</ResponseField>

<ResponseField name={"options"} type={"{ idempotencyKey: string }"} />

#### Returns

`AgentRunStream`

A stream of run events.

### createScope()

```typescript
createScope(scopeId: string | number, body: object, options?: { idempotencyKey: string }): AgentRunStream
```

Start a scope run and stream run events.

#### Parameters

<ResponseField name={"scopeId"} type={"string | number"} required>
  Scope id to run.
</ResponseField>

<ResponseField name={"body"} type={"object"} required>
  Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
</ResponseField>

<ResponseField name={"options"} type={"{ idempotencyKey: string }"} />

#### Returns

`AgentRunStream`

A stream of run events.

### editQueued()

```typescript
editQueued(runId: string): Promise<void>
```

Move a queued run back into an editable state before it starts.

#### Parameters

<ResponseField name={"runId"} type={"string"} required>
  Queued run id.
</ResponseField>

#### Returns

`Promise<void>`

### events()

```typescript
events(runId: string): Promise<unknown>
```

Fetch stored run events for a run.

#### Parameters

<ResponseField name={"runId"} type={"string"} required>
  Run id.
</ResponseField>

#### Returns

`Promise<unknown>`

Run event history for replay or inspection.

### get()

```typescript
get(workflowId: string | number, runId: string, options?: { temporalRunId: string }): Promise<object>
```

Retrieve a workflow run by id.

#### Parameters

<ResponseField name={"workflowId"} type={"string | number"} required>
  Workflow id or slug the run belongs to.
</ResponseField>

<ResponseField name={"runId"} type={"string"} required>
  Run id.
</ResponseField>

<ResponseField name={"options"} type={"{ temporalRunId: string }"} />

#### Returns

`Promise<object>`

Run details including status and output.

### interrupt()

```typescript
interrupt(runId: string): Promise<void>
```

Request a graceful stop for a running execution.

#### Parameters

<ResponseField name={"runId"} type={"string"} required>
  Run id to interrupt.
</ResponseField>

#### Returns

`Promise<void>`

### list()

```typescript
list(workflowId: string | number, options?: { pageSize: number; pageToken: string; status: RunStatus; timeframe: RunTimeframe; approvalScope: ApprovalScope; search: string }): Promise<Page<object>>
```

List runs for a workflow.

#### Parameters

<ResponseField name={"workflowId"} type={"string | number"} required>
  Workflow id or slug.
</ResponseField>

<ResponseField name={"options"} type={"{ pageSize: number; pageToken: string; status: RunStatus; timeframe: RunTimefra…"} />

#### Returns

`Promise<Page<object>>`

A page of run summaries.

### resume()

```typescript
resume(runId: string, body: object, options?: { idempotencyKey: string }): AgentRunStream
```

Resume an interrupted run and stream run events.

#### Parameters

<ResponseField name={"runId"} type={"string"} required>
  Run id to resume.
</ResponseField>

<ResponseField name={"body"} type={"object"} required>
  Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
</ResponseField>

<ResponseField name={"options"} type={"{ idempotencyKey: string }"} />

#### Returns

`AgentRunStream`

A stream of run events.

### stream()

```typescript
stream(runId: string, options?: { lastEventId: string }): AgentRunStream
```

Reconnect to an in-progress run and stream run events.

```ts
const stream = client.workflows.runs.stream(runId, { lastEventId: checkpoint })
for await (const event of stream) {
  if (event.type === 'token') process.stdout.write(event.content)
}
```

#### Parameters

<ResponseField name={"runId"} type={"string"} required>
  Run id to follow.
</ResponseField>

<ResponseField name={"options"} type={"{ lastEventId: string }"} />

#### Returns

`AgentRunStream`

A stream of run events from the current execution point.
