langchain.js
    Preparing search index...

    Interface PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>

    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>,
        ContextType extends Record<string, any> = Record<string, any>,
        TStreamMode extends
            StreamMode | StreamMode[] | undefined =
            | StreamMode
            | StreamMode[]
            | undefined,
        TSubgraphs extends boolean = boolean,
        TEncoding extends
            "text/event-stream" | undefined = "text/event-stream" | undefined,
    > {
        cache?: any;
        checkpointDuring?: boolean;
        context?: ContextType;
        debug?: boolean;
        durability?: Durability;
        encoding?: TEncoding;
        inputKeys?: keyof Channels
        | (keyof Channels)[];
        interruptAfter?: any;
        interruptBefore?: any;
        outputKeys?: keyof Channels | (keyof Channels)[];
        store?: any;
        streamMode?: TStreamMode;
        subgraphs?: TSubgraphs;
    }

    Type Parameters

    • Nodes extends StrRecord<string, PregelNode>

      Mapping of node names to their PregelNode implementations

    • Channels extends StrRecord<string, BaseChannel>

      Mapping of channel names to their BaseChannel implementations

    • ContextType extends Record<string, any> = Record<string, any>

      Type of context that can be passed to the graph

    • TStreamMode extends StreamMode | StreamMode[] | undefined = StreamMode | StreamMode[] | undefined
    • TSubgraphs extends boolean = boolean
    • TEncoding extends "text/event-stream" | undefined = "text/event-stream" | undefined

    Hierarchy

    Index

    Properties

    cache?: any

    Optional cache for the graph, useful for caching tasks.

    checkpointDuring?: boolean

    Whether to checkpoint intermediate steps, defaults to true. If false, only the final checkpoint is saved.

    Use durability instead.

    context?: ContextType

    Static context for the graph run, like userId, dbConnection etc.

    debug?: boolean

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

    • Task execution
    • Channel updates
    • Checkpoint writes
    false
    
    durability?: Durability

    Whether to checkpoint during the run (or only at the end/interruption).

    • "async": Save checkpoint asynchronously while the next step executes (default).
    • "sync": Save checkpoint synchronously before the next step starts.
    • "exit": Save checkpoint only when the graph exits.
    "async"
    
    encoding?: TEncoding

    The encoding to use for the stream.

    • undefined: Use the default format.
    • "text/event-stream": Use the Server-Sent Events format.
    undefined
    
    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?: any

    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?: any

    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"
    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"]
    store?: any

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

    streamMode?: TStreamMode

    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?: TSubgraphs

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

    false