Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

withInterruptBinding.md

35 lines1.1 KB

1---
2id: withInterruptBinding
3title: withInterruptBinding
4---
5​
6```ts
7function withInterruptBinding(descriptor, binding): Interrupt;
8```
9​
10Defined in: [packages/ai/src/interrupt-resume.ts:954](https://github.com/TanStack/ai/blob/main/packages/ai/src/interrupt-resume.ts#L954)
11​
12Attach a resume binding to an interrupt descriptor, under
13[INTERRUPT\_BINDING\_METADATA\_KEY](../variables/INTERRUPT_BINDING_METADATA_KEY.md).
14​
15This is the supported way to make an interrupt resumable by this package.
16The descriptor keeps its AG-UI shape; only `metadata` gains the namespaced
17key. Pass the unopened form (no `interruptedRunId` / `generation`) when
18emitting from inside a run — those fields are stamped as the run finishes.
19​
20## Parameters
21​
22### descriptor
23​
24`Interrupt`
25​
26### binding
27​
28 \| [`InterruptBinding`](../type-aliases/InterruptBinding.md)
29 \| `Omit`\<`ResponseSchemaInterruptBindingBase` & `object`, `"interruptedRunId"` \| `"generation"`\>
30 \| `Omit`\<`ResponseSchemaInterruptBindingBase` & `object`, `"interruptedRunId"` \| `"generation"`\>
31 \| `Omit`\<`InterruptBindingBase` & `object`, `"interruptedRunId"` \| `"generation"`\>
32​
33## Returns
34​
35`Interrupt`