Open History to see the last commit
1---
2id: requestRunCancel
3title: requestRunCancel
4---
5
6```ts
7function requestRunCancel(runs, runId): Promise<void>;
8```
9
10Defined in: [packages/ai/src/activities/chat/cancel.ts:48](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/cancel.ts#L48)
11
12Record an explicit cancel on the run record.
13
14Deliberately does NOT set a status. The driver is the only actor that knows
15when the agent has actually stopped and the sandbox has been torn down, so it
16owns the transition to `'aborted'`. Writing a terminal status here would tell
17every reader the run is over while the agent is still burning tokens.
18
19A no-op for an unknown `runId`, inheriting `RunStore.update`'s documented
20invariant.
21
22## Parameters
23
24### runs
25
26[`RunStore`](../interfaces/RunStore.md)
27
28### runId
29
30`string`
31
32## Returns
33
34`Promise`\<`void`\>