@langchain/langgraph 0.2.46 → 0.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,9 +25,20 @@ const stream_js_1 = require("./stream.cjs");
25
25
  function isString(value) {
26
26
  return typeof value === "string";
27
27
  }
28
+ /**
29
+ * Utility class for working with channels in the Pregel system.
30
+ * Provides static methods for subscribing to channels and writing to them.
31
+ *
32
+ * Channels are the communication pathways between nodes in a Pregel graph.
33
+ * They enable message passing and state updates between different parts of the graph.
34
+ */
28
35
  class Channel {
29
36
  static subscribeTo(channels, options) {
30
- const { key, tags } = options ?? {};
37
+ const { key, tags } = {
38
+ key: undefined,
39
+ tags: undefined,
40
+ ...(options ?? {}),
41
+ };
31
42
  if (Array.isArray(channels) && key !== undefined) {
32
43
  throw new Error("Can't specify a key when subscribing to multiple channels");
33
44
  }
@@ -50,7 +61,32 @@ class Channel {
50
61
  tags,
51
62
  });
52
63
  }
53
- static writeTo(channels, kwargs) {
64
+ /**
65
+ * Creates a ChannelWrite that specifies how to write values to channels.
66
+ * This is used to define how nodes send output to channels.
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * // Write to multiple channels
71
+ * const write = Channel.writeTo(["output", "state"]);
72
+ *
73
+ * // Write with specific values
74
+ * const write = Channel.writeTo(["output"], {
75
+ * state: "completed",
76
+ * result: calculateResult()
77
+ * });
78
+ *
79
+ * // Write with a transformation function
80
+ * const write = Channel.writeTo(["output"], {
81
+ * result: (x) => processResult(x)
82
+ * });
83
+ * ```
84
+ *
85
+ * @param channels - Array of channel names to write to
86
+ * @param writes - Optional map of channel names to values or transformations
87
+ * @returns A ChannelWrite object that can be used to write to the specified channels
88
+ */
89
+ static writeTo(channels, writes) {
54
90
  const channelWriteEntries = [];
55
91
  for (const channel of channels) {
56
92
  channelWriteEntries.push({
@@ -59,7 +95,7 @@ class Channel {
59
95
  skipNone: false,
60
96
  });
61
97
  }
62
- for (const [key, value] of Object.entries(kwargs ?? {})) {
98
+ for (const [key, value] of Object.entries(writes ?? {})) {
63
99
  if (runnables_1.Runnable.isRunnable(value) || typeof value === "function") {
64
100
  channelWriteEntries.push({
65
101
  channel: key,
@@ -80,109 +116,222 @@ class Channel {
80
116
  }
81
117
  }
82
118
  exports.Channel = Channel;
119
+ /**
120
+ * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model
121
+ * inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).
122
+ * It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.
123
+ *
124
+ * Key features:
125
+ * - Message passing between nodes in discrete "supersteps"
126
+ * - Built-in persistence layer through checkpointers
127
+ * - First-class streaming support for values, updates, and events
128
+ * - Human-in-the-loop capabilities via interrupts
129
+ * - Support for parallel node execution within supersteps
130
+ *
131
+ * The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:
132
+ * - {@link StateGraph}: The main graph class for building agent workflows
133
+ * - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`
134
+ * - Functional API: A declarative approach using tasks and entrypoints
135
+ * - A `Pregel` instance is returned by the {@link entrypoint} function
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * // Using StateGraph API
140
+ * const graph = new StateGraph(annotation)
141
+ * .addNode("nodeA", myNodeFunction)
142
+ * .addEdge("nodeA", "nodeB")
143
+ * .compile();
144
+ *
145
+ * // The compiled graph is a Pregel instance
146
+ * const result = await graph.invoke(input);
147
+ * ```
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * // Using Functional API
152
+ * import { task, entrypoint } from "@langchain/langgraph";
153
+ * import { MemorySaver } from "@langchain/langgraph-checkpoint";
154
+ *
155
+ * // Define tasks that can be composed
156
+ * const addOne = task("add", async (x: number) => x + 1);
157
+ *
158
+ * // Create a workflow using the entrypoint function
159
+ * const workflow = entrypoint({
160
+ * name: "workflow",
161
+ * checkpointer: new MemorySaver()
162
+ * }, async (numbers: number[]) => {
163
+ * // Tasks can be run in parallel
164
+ * const results = await Promise.all(numbers.map(n => addOne(n)));
165
+ * return results;
166
+ * });
167
+ *
168
+ * // The workflow is a Pregel instance
169
+ * const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]
170
+ * ```
171
+ *
172
+ * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations
173
+ * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations
174
+ * @typeParam ConfigurableFieldType - Type of configurable fields that can be passed to the graph
175
+ * @typeParam InputType - Type of input values accepted by the graph
176
+ * @typeParam OutputType - Type of output values produced by the graph
177
+ */
83
178
  class Pregel extends runnables_1.Runnable {
179
+ /**
180
+ * Name of the class when serialized
181
+ * @internal
182
+ */
84
183
  static lc_name() {
85
184
  return "LangGraph";
86
185
  }
186
+ /**
187
+ * Constructor for Pregel - meant for internal use only.
188
+ *
189
+ * @internal
190
+ */
87
191
  constructor(fields) {
88
192
  super(fields);
89
- // Because Pregel extends `Runnable`.
193
+ /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */
90
194
  Object.defineProperty(this, "lc_namespace", {
91
195
  enumerable: true,
92
196
  configurable: true,
93
197
  writable: true,
94
198
  value: ["langgraph", "pregel"]
95
199
  });
200
+ /** @internal Flag indicating this is a Pregel instance - necessary for serialization */
96
201
  Object.defineProperty(this, "lg_is_pregel", {
97
202
  enumerable: true,
98
203
  configurable: true,
99
204
  writable: true,
100
205
  value: true
101
206
  });
207
+ /** The nodes in the graph, mapping node names to their PregelNode instances */
102
208
  Object.defineProperty(this, "nodes", {
103
209
  enumerable: true,
104
210
  configurable: true,
105
211
  writable: true,
106
212
  value: void 0
107
213
  });
214
+ /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */
108
215
  Object.defineProperty(this, "channels", {
109
216
  enumerable: true,
110
217
  configurable: true,
111
218
  writable: true,
112
219
  value: void 0
113
220
  });
221
+ /**
222
+ * The input channels for the graph. These channels receive the initial input when the graph is invoked.
223
+ * Can be a single channel key or an array of channel keys.
224
+ */
114
225
  Object.defineProperty(this, "inputChannels", {
115
226
  enumerable: true,
116
227
  configurable: true,
117
228
  writable: true,
118
229
  value: void 0
119
230
  });
231
+ /**
232
+ * The output channels for the graph. These channels contain the final output when the graph completes.
233
+ * Can be a single channel key or an array of channel keys.
234
+ */
120
235
  Object.defineProperty(this, "outputChannels", {
121
236
  enumerable: true,
122
237
  configurable: true,
123
238
  writable: true,
124
239
  value: void 0
125
240
  });
241
+ /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */
126
242
  Object.defineProperty(this, "autoValidate", {
127
243
  enumerable: true,
128
244
  configurable: true,
129
245
  writable: true,
130
246
  value: true
131
247
  });
248
+ /**
249
+ * The streaming modes enabled for this graph. Defaults to ["values"].
250
+ * Supported modes:
251
+ * - "values": Streams the full state after each step
252
+ * - "updates": Streams state updates after each step
253
+ * - "messages": Streams messages from within nodes
254
+ * - "custom": Streams custom events from within nodes
255
+ * - "debug": Streams events related to the execution of the graph - useful for tracing & debugging graph execution
256
+ */
132
257
  Object.defineProperty(this, "streamMode", {
133
258
  enumerable: true,
134
259
  configurable: true,
135
260
  writable: true,
136
261
  value: ["values"]
137
262
  });
263
+ /**
264
+ * Optional channels to stream. If not specified, all channels will be streamed.
265
+ * Can be a single channel key or an array of channel keys.
266
+ */
138
267
  Object.defineProperty(this, "streamChannels", {
139
268
  enumerable: true,
140
269
  configurable: true,
141
270
  writable: true,
142
271
  value: void 0
143
272
  });
273
+ /**
274
+ * Optional array of node names or "all" to interrupt after executing these nodes.
275
+ * Used for implementing human-in-the-loop workflows.
276
+ */
144
277
  Object.defineProperty(this, "interruptAfter", {
145
278
  enumerable: true,
146
279
  configurable: true,
147
280
  writable: true,
148
281
  value: void 0
149
282
  });
283
+ /**
284
+ * Optional array of node names or "all" to interrupt before executing these nodes.
285
+ * Used for implementing human-in-the-loop workflows.
286
+ */
150
287
  Object.defineProperty(this, "interruptBefore", {
151
288
  enumerable: true,
152
289
  configurable: true,
153
290
  writable: true,
154
291
  value: void 0
155
292
  });
293
+ /** Optional timeout in milliseconds for the execution of each superstep */
156
294
  Object.defineProperty(this, "stepTimeout", {
157
295
  enumerable: true,
158
296
  configurable: true,
159
297
  writable: true,
160
298
  value: void 0
161
299
  });
300
+ /** Whether to enable debug logging. Defaults to false. */
162
301
  Object.defineProperty(this, "debug", {
163
302
  enumerable: true,
164
303
  configurable: true,
165
304
  writable: true,
166
305
  value: false
167
306
  });
307
+ /**
308
+ * Optional checkpointer for persisting graph state.
309
+ * When provided, saves a checkpoint of the graph state at every superstep.
310
+ * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.
311
+ */
168
312
  Object.defineProperty(this, "checkpointer", {
169
313
  enumerable: true,
170
314
  configurable: true,
171
315
  writable: true,
172
316
  value: void 0
173
317
  });
318
+ /** Optional retry policy for handling failures in node execution */
174
319
  Object.defineProperty(this, "retryPolicy", {
175
320
  enumerable: true,
176
321
  configurable: true,
177
322
  writable: true,
178
323
  value: void 0
179
324
  });
325
+ /** The default configuration for graph execution, can be overridden on a per-invocation basis */
180
326
  Object.defineProperty(this, "config", {
181
327
  enumerable: true,
182
328
  configurable: true,
183
329
  writable: true,
184
330
  value: void 0
185
331
  });
332
+ /**
333
+ * Optional long-term memory store for the graph, allows for persistance & retrieval of data across threads
334
+ */
186
335
  Object.defineProperty(this, "store", {
187
336
  enumerable: true,
188
337
  configurable: true,
@@ -213,6 +362,25 @@ class Pregel extends runnables_1.Runnable {
213
362
  this.validate();
214
363
  }
215
364
  }
365
+ /**
366
+ * Creates a new instance of the Pregel graph with updated configuration.
367
+ * This method follows the immutable pattern - instead of modifying the current instance,
368
+ * it returns a new instance with the merged configuration.
369
+ *
370
+ * @example
371
+ * ```typescript
372
+ * // Create a new instance with debug enabled
373
+ * const debugGraph = graph.withConfig({ debug: true });
374
+ *
375
+ * // Create a new instance with a specific thread ID
376
+ * const threadGraph = graph.withConfig({
377
+ * configurable: { thread_id: "123" }
378
+ * });
379
+ * ```
380
+ *
381
+ * @param config - The configuration to merge with the current configuration
382
+ * @returns A new Pregel instance with the merged configuration
383
+ */
216
384
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
217
385
  // @ts-ignore Remove ignore when we remove support for 0.2 versions of core
218
386
  withConfig(config) {
@@ -220,6 +388,16 @@ class Pregel extends runnables_1.Runnable {
220
388
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
221
389
  return new this.constructor({ ...this, config: mergedConfig });
222
390
  }
391
+ /**
392
+ * Validates the graph structure to ensure it is well-formed.
393
+ * Checks for:
394
+ * - No orphaned nodes
395
+ * - Valid input/output channel configurations
396
+ * - Valid interrupt configurations
397
+ *
398
+ * @returns this - The Pregel instance for method chaining
399
+ * @throws {GraphValidationError} If the graph structure is invalid
400
+ */
223
401
  validate() {
224
402
  (0, validate_js_1.validateGraph)({
225
403
  nodes: this.nodes,
@@ -232,6 +410,13 @@ class Pregel extends runnables_1.Runnable {
232
410
  });
233
411
  return this;
234
412
  }
413
+ /**
414
+ * Gets a list of all channels that should be streamed.
415
+ * If streamChannels is specified, returns those channels.
416
+ * Otherwise, returns all channels in the graph.
417
+ *
418
+ * @returns Array of channel keys to stream
419
+ */
235
420
  get streamChannelsList() {
236
421
  if (Array.isArray(this.streamChannels)) {
237
422
  return this.streamChannels;
@@ -243,6 +428,13 @@ class Pregel extends runnables_1.Runnable {
243
428
  return Object.keys(this.channels);
244
429
  }
245
430
  }
431
+ /**
432
+ * Gets the channels to stream in their original format.
433
+ * If streamChannels is specified, returns it as-is (either single key or array).
434
+ * Otherwise, returns all channels in the graph as an array.
435
+ *
436
+ * @returns Channel keys to stream, either as a single key or array
437
+ */
246
438
  get streamChannelsAsIs() {
247
439
  if (this.streamChannels) {
248
440
  return this.streamChannels;
@@ -251,10 +443,25 @@ class Pregel extends runnables_1.Runnable {
251
443
  return Object.keys(this.channels);
252
444
  }
253
445
  }
446
+ /**
447
+ * Gets a drawable representation of the graph structure.
448
+ * This is an async version of getGraph() and is the preferred method to use.
449
+ *
450
+ * @param config - Configuration for generating the graph visualization
451
+ * @returns A representation of the graph that can be visualized
452
+ */
254
453
  async getGraphAsync(config) {
255
454
  return this.getGraph(config);
256
455
  }
257
- /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */
456
+ /**
457
+ * Gets all subgraphs within this graph.
458
+ * A subgraph is a Pregel instance that is nested within a node of this graph.
459
+ *
460
+ * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.
461
+ * @param namespace - Optional namespace to filter subgraphs
462
+ * @param recurse - Whether to recursively get subgraphs of subgraphs
463
+ * @returns Generator yielding tuples of [name, subgraph]
464
+ */
258
465
  *getSubgraphs(namespace, recurse
259
466
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
467
  ) {
@@ -292,11 +499,29 @@ class Pregel extends runnables_1.Runnable {
292
499
  }
293
500
  }
294
501
  }
502
+ /**
503
+ * Gets all subgraphs within this graph asynchronously.
504
+ * A subgraph is a Pregel instance that is nested within a node of this graph.
505
+ *
506
+ * @param namespace - Optional namespace to filter subgraphs
507
+ * @param recurse - Whether to recursively get subgraphs of subgraphs
508
+ * @returns AsyncGenerator yielding tuples of [name, subgraph]
509
+ */
295
510
  async *getSubgraphsAsync(namespace, recurse
296
511
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
297
512
  ) {
298
513
  yield* this.getSubgraphs(namespace, recurse);
299
514
  }
515
+ /**
516
+ * Prepares a state snapshot from saved checkpoint data.
517
+ * This is an internal method used by getState and getStateHistory.
518
+ *
519
+ * @param config - Configuration for preparing the snapshot
520
+ * @param saved - Optional saved checkpoint data
521
+ * @param subgraphCheckpointer - Optional checkpointer for subgraphs
522
+ * @returns A snapshot of the graph state
523
+ * @internal
524
+ */
300
525
  async _prepareStateSnapshot({ config, saved, subgraphCheckpointer, }) {
301
526
  if (saved === undefined) {
302
527
  return {
@@ -372,7 +597,13 @@ class Pregel extends runnables_1.Runnable {
372
597
  };
373
598
  }
374
599
  /**
375
- * Get the current state of the graph.
600
+ * Gets the current state of the graph.
601
+ * Requires a checkpointer to be configured.
602
+ *
603
+ * @param config - Configuration for retrieving the state
604
+ * @param options - Additional options
605
+ * @returns A snapshot of the current graph state
606
+ * @throws {GraphValueError} If no checkpointer is configured
376
607
  */
377
608
  async getState(config, options) {
378
609
  const checkpointer = config.configurable?.[constants_js_1.CONFIG_KEY_CHECKPOINTER] ?? this.checkpointer;
@@ -406,7 +637,17 @@ class Pregel extends runnables_1.Runnable {
406
637
  return snapshot;
407
638
  }
408
639
  /**
409
- * Get the history of the state of the graph.
640
+ * Gets the history of graph states.
641
+ * Requires a checkpointer to be configured.
642
+ * Useful for:
643
+ * - Debugging execution history
644
+ * - Implementing time travel
645
+ * - Analyzing graph behavior
646
+ *
647
+ * @param config - Configuration for retrieving the history
648
+ * @param options - Options for filtering the history
649
+ * @returns An async iterator of state snapshots
650
+ * @throws {Error} If no checkpointer is configured
410
651
  */
411
652
  async *getStateHistory(config, options) {
412
653
  const checkpointer = config.configurable?.[constants_js_1.CONFIG_KEY_CHECKPOINTER] ?? this.checkpointer;
@@ -442,9 +683,20 @@ class Pregel extends runnables_1.Runnable {
442
683
  }
443
684
  }
444
685
  /**
445
- * Update the state of the graph with the given values, as if they came from
446
- * node `as_node`. If `as_node` is not provided, it will be set to the last node
447
- * that updated the state, if not ambiguous.
686
+ * Updates the state of the graph with new values.
687
+ * Requires a checkpointer to be configured.
688
+ *
689
+ * This method can be used for:
690
+ * - Implementing human-in-the-loop workflows
691
+ * - Modifying graph state during breakpoints
692
+ * - Integrating external inputs into the graph
693
+ *
694
+ * @param inputConfig - Configuration for the update
695
+ * @param values - The values to update the state with
696
+ * @param asNode - Optional node name to attribute the update to
697
+ * @returns Updated configuration
698
+ * @throws {GraphValueError} If no checkpointer is configured
699
+ * @throws {InvalidUpdateError} If the update cannot be attributed to a node
448
700
  */
449
701
  async updateState(inputConfig, values, asNode) {
450
702
  const checkpointer = inputConfig.configurable?.[constants_js_1.CONFIG_KEY_CHECKPOINTER] ?? this.checkpointer;
@@ -697,6 +949,24 @@ class Pregel extends runnables_1.Runnable {
697
949
  }
698
950
  return (0, index_js_1.patchCheckpointMap)(nextConfig, saved ? saved.metadata : undefined);
699
951
  }
952
+ /**
953
+ * Gets the default values for various graph configuration options.
954
+ * This is an internal method used to process and normalize configuration options.
955
+ *
956
+ * @param config - The input configuration options
957
+ * @returns A tuple containing normalized values for:
958
+ * - debug mode
959
+ * - stream modes
960
+ * - input keys
961
+ * - output keys
962
+ * - remaining config
963
+ * - interrupt before nodes
964
+ * - interrupt after nodes
965
+ * - checkpointer
966
+ * - store
967
+ * - whether stream mode is single
968
+ * @internal
969
+ */
700
970
  _defaults(config) {
701
971
  const { debug, streamMode, inputKeys, outputKeys, interruptAfter, interruptBefore, ...rest } = config;
702
972
  let streamModeSingle = true;
@@ -756,19 +1026,20 @@ class Pregel extends runnables_1.Runnable {
756
1026
  ];
757
1027
  }
758
1028
  /**
759
- * Stream graph steps for a single input.
760
- * @param input The input to the graph.
761
- * @param options The configuration to use for the run.
762
- * @param options.streamMode The mode to stream output. Defaults to value set on initialization.
763
- * Options are "values", "updates", and "debug". Default is "values".
764
- * values: Emit the current values of the state for each step.
765
- * updates: Emit only the updates to the state for each step.
766
- * Output is a dict with the node name as key and the updated values as value.
767
- * debug: Emit debug events for each step.
768
- * @param options.outputKeys The keys to stream. Defaults to all non-context channels.
769
- * @param options.interruptBefore Nodes to interrupt before.
770
- * @param options.interruptAfter Nodes to interrupt after.
771
- * @param options.debug Whether to print debug information during execution.
1029
+ * Streams the execution of the graph, emitting state updates as they occur.
1030
+ * This is the primary method for observing graph execution in real-time.
1031
+ *
1032
+ * Stream modes:
1033
+ * - "values": Emits complete state after each step
1034
+ * - "updates": Emits only state changes after each step
1035
+ * - "debug": Emits detailed debug information
1036
+ * - "messages": Emits messages from within nodes
1037
+ *
1038
+ * For more details, see the [Streaming how-to guides](../../how-tos/#streaming_1).
1039
+ *
1040
+ * @param input - The input to start graph execution with
1041
+ * @param options - Configuration options for streaming
1042
+ * @returns An async iterable stream of graph state updates
772
1043
  */
773
1044
  async stream(input, options) {
774
1045
  // The ensureConfig method called internally defaults recursionLimit to 25 if not
@@ -782,6 +1053,17 @@ class Pregel extends runnables_1.Runnable {
782
1053
  };
783
1054
  return super.stream(input, config);
784
1055
  }
1056
+ /**
1057
+ * Prepares channel specifications and managed values for graph execution.
1058
+ * This is an internal method used to set up the graph's communication channels
1059
+ * and managed state before execution.
1060
+ *
1061
+ * @param config - Configuration for preparing specs
1062
+ * @param options - Additional options
1063
+ * @param options.skipManaged - Whether to skip initialization of managed values
1064
+ * @returns Object containing channel specs and managed value mapping
1065
+ * @internal
1066
+ */
785
1067
  async prepareSpecs(config, options) {
786
1068
  const configForManaged = {
787
1069
  ...config,
@@ -826,6 +1108,15 @@ class Pregel extends runnables_1.Runnable {
826
1108
  managed,
827
1109
  };
828
1110
  }
1111
+ /**
1112
+ * Internal iterator used by stream() to generate state updates.
1113
+ * This method handles the core logic of graph execution and streaming.
1114
+ *
1115
+ * @param input - The input to start graph execution with
1116
+ * @param options - Configuration options for streaming
1117
+ * @returns AsyncGenerator yielding state updates
1118
+ * @internal
1119
+ */
829
1120
  async *_streamIterator(input, options) {
830
1121
  const streamSubgraphs = options?.subgraphs;
831
1122
  const inputConfig = (0, config_js_1.ensureLangGraphConfig)(this.config, options);
@@ -975,16 +1266,6 @@ class Pregel extends runnables_1.Runnable {
975
1266
  * Run the graph with a single input and config.
976
1267
  * @param input The input to the graph.
977
1268
  * @param options The configuration to use for the run.
978
- * @param options.streamMode The mode to stream output. Defaults to value set on initialization.
979
- * Options are "values", "updates", and "debug". Default is "values".
980
- * values: Emit the current values of the state for each step.
981
- * updates: Emit only the updates to the state for each step.
982
- * Output is a dict with the node name as key and the updated values as value.
983
- * debug: Emit debug events for each step.
984
- * @param options.outputKeys The keys to stream. Defaults to all non-context channels.
985
- * @param options.interruptBefore Nodes to interrupt before.
986
- * @param options.interruptAfter Nodes to interrupt after.
987
- * @param options.debug Whether to print debug information during execution.
988
1269
  */
989
1270
  async invoke(input, options) {
990
1271
  const streamMode = options?.streamMode ?? "values";