Interface PregelOptions<Nodes, Channels, ConfigurableFieldType>

Configuration options for executing a Pregel graph. These options control how the graph executes, what data is streamed, and how interrupts are handled.

interface PregelOptions<
    Nodes extends StrRecord<string, PregelNode>,
    Channels extends StrRecord<string, BaseChannel | ManagedValueSpec>,
    ConfigurableFieldType extends Record<string, any> = Record<string, any>,
> {
    callbacks?: Callbacks;
    configurable?: ConfigurableFieldType;
    debug?: boolean;
    inputKeys?: keyof Channels | (keyof Channels)[];
    interruptAfter?: "*" | (keyof Nodes)[];
    interruptBefore?: "*" | (keyof Nodes)[];
    maxConcurrency?: number;
    metadata?: Record<string, unknown>;
    outputKeys?: keyof Channels | (keyof Channels)[];
    recursionLimit?: number;
    runId?: string;
    runName?: string;
    signal?: AbortSignal;
    store?: BaseStore;
    streamMode?: StreamMode | StreamMode[];
    subgraphs?: boolean;
    tags?: string[];
    timeout?: number;
}

Type Parameters

Hierarchy

Properties

callbacks?: Callbacks

Callbacks for this call and any sub-calls (eg. a Chain calling an LLM). Tags are passed to all callbacks, metadata is passed to handle*Start callbacks.

configurable?: ConfigurableFieldType

Runtime values for attributes previously made configurable on this Runnable, or sub-Runnables.

debug?: boolean

Enables detailed debug logging during graph execution. When enabled, prints information about:

  • Task execution
  • Channel updates
  • Checkpoint writes
false
inputKeys?: keyof Channels | (keyof Channels)[]

Specifies which channel keys to retrieve from the checkpoint when resuming execution. This is an advanced option that you generally don't need to set manually. The graph will automatically determine the appropriate input keys based on its configuration.

interruptAfter?: "*" | (keyof Nodes)[]

List of nodes where execution should be interrupted AFTER the node runs. Similar to interruptBefore, but interrupts after node completion. Useful when the node's output needs to be reviewed before proceeding.

// Interrupt after specific nodes
interruptAfter: ["generateContent", "analyze"]

// Interrupt after all nodes
interruptAfter: "all"
interruptBefore?: "*" | (keyof Nodes)[]

List of nodes where execution should be interrupted BEFORE the node runs. Can be used for debugging and advanced state manipulation use cases. For human-in-the-loop workflows, developers should prefer the

// Interrupt before specific nodes
interruptBefore: ["humanReview", "qualityCheck"]

// Interrupt before all nodes
interruptBefore: "all"
maxConcurrency?: number

Maximum number of parallel calls to make.

metadata?: Record<string, unknown>

Metadata for this call and any sub-calls (eg. a Chain calling an LLM). Keys should be strings, values should be JSON-serializable.

outputKeys?: keyof Channels | (keyof Channels)[]

Specifies which channel keys to include in the output stream and final result. Use this to filter which parts of the graph state you want to observe.

// Stream only the 'result' channel
outputKeys: "result"

// Stream multiple channels
outputKeys: ["result", "intermediateState"]
recursionLimit?: number

Maximum number of times a call can recurse. If not provided, defaults to 25.

runId?: string

Unique identifier for the tracer run for this call. If not provided, a new UUID will be generated.

runName?: string

Name for the tracer run for this call. Defaults to the name of the class.

signal?: AbortSignal

Abort signal for this call. If provided, the call will be aborted when the signal is aborted.

store?: BaseStore

A shared value store that allows you to store and retrieve state across threads. Useful for implementing long-term memory patterns.

streamMode?: StreamMode | StreamMode[]

Controls what information is streamed during graph execution. Multiple modes can be enabled simultaneously.

Supported modes:

  • "values": Streams complete state after each step
  • "updates": Streams only state changes after each step
  • "messages": Streams messages from within nodes
  • "custom": Streams custom events from within nodes
  • "debug": Streams detailed execution events for tracing & debugging
// Stream only values
streamMode: "values"

// Stream both values and debug info
streamMode: ["values", "debug"]
["values"]
subgraphs?: boolean

Whether to include subgraph execution details in the stream. When true, state updates from nested graphs will also be streamed.

false
tags?: string[]

Tags for this call and any sub-calls (eg. a Chain calling an LLM). You can use these to filter calls.

timeout?: number

Timeout for this call in milliseconds.