@langchain/langgraph 1.0.7 → 1.0.12
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.
- package/package.json +7 -7
- package/CHANGELOG.md +0 -286
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/channels/any_value.cjs +0 -46
- package/dist/channels/any_value.cjs.map +0 -1
- package/dist/channels/any_value.d.cts +0 -24
- package/dist/channels/any_value.d.cts.map +0 -1
- package/dist/channels/any_value.d.ts +0 -24
- package/dist/channels/any_value.d.ts.map +0 -1
- package/dist/channels/any_value.js +0 -46
- package/dist/channels/any_value.js.map +0 -1
- package/dist/channels/base.cjs +0 -102
- package/dist/channels/base.cjs.map +0 -1
- package/dist/channels/base.d.cts +0 -79
- package/dist/channels/base.d.cts.map +0 -1
- package/dist/channels/base.d.ts +0 -79
- package/dist/channels/base.d.ts.map +0 -1
- package/dist/channels/base.js +0 -97
- package/dist/channels/base.js.map +0 -1
- package/dist/channels/binop.cjs +0 -49
- package/dist/channels/binop.cjs.map +0 -1
- package/dist/channels/binop.d.cts +0 -22
- package/dist/channels/binop.d.cts.map +0 -1
- package/dist/channels/binop.d.ts +0 -22
- package/dist/channels/binop.d.ts.map +0 -1
- package/dist/channels/binop.js +0 -49
- package/dist/channels/binop.js.map +0 -1
- package/dist/channels/dynamic_barrier_value.cjs +0 -76
- package/dist/channels/dynamic_barrier_value.cjs.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.cts +0 -42
- package/dist/channels/dynamic_barrier_value.d.cts.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.ts +0 -42
- package/dist/channels/dynamic_barrier_value.d.ts.map +0 -1
- package/dist/channels/dynamic_barrier_value.js +0 -76
- package/dist/channels/dynamic_barrier_value.js.map +0 -1
- package/dist/channels/ephemeral_value.cjs +0 -46
- package/dist/channels/ephemeral_value.cjs.map +0 -1
- package/dist/channels/ephemeral_value.d.cts +0 -22
- package/dist/channels/ephemeral_value.d.cts.map +0 -1
- package/dist/channels/ephemeral_value.d.ts +0 -22
- package/dist/channels/ephemeral_value.d.ts.map +0 -1
- package/dist/channels/ephemeral_value.js +0 -46
- package/dist/channels/ephemeral_value.js.map +0 -1
- package/dist/channels/index.cjs +0 -21
- package/dist/channels/index.d.cts +0 -9
- package/dist/channels/index.d.ts +0 -9
- package/dist/channels/index.js +0 -10
- package/dist/channels/last_value.cjs +0 -98
- package/dist/channels/last_value.cjs.map +0 -1
- package/dist/channels/last_value.d.cts +0 -44
- package/dist/channels/last_value.d.cts.map +0 -1
- package/dist/channels/last_value.d.ts +0 -44
- package/dist/channels/last_value.d.ts.map +0 -1
- package/dist/channels/last_value.js +0 -97
- package/dist/channels/last_value.js.map +0 -1
- package/dist/channels/named_barrier_value.cjs +0 -118
- package/dist/channels/named_barrier_value.cjs.map +0 -1
- package/dist/channels/named_barrier_value.d.cts +0 -46
- package/dist/channels/named_barrier_value.d.cts.map +0 -1
- package/dist/channels/named_barrier_value.d.ts +0 -46
- package/dist/channels/named_barrier_value.d.ts.map +0 -1
- package/dist/channels/named_barrier_value.js +0 -116
- package/dist/channels/named_barrier_value.js.map +0 -1
- package/dist/channels/topic.cjs +0 -65
- package/dist/channels/topic.cjs.map +0 -1
- package/dist/channels/topic.d.cts +0 -32
- package/dist/channels/topic.d.cts.map +0 -1
- package/dist/channels/topic.d.ts +0 -32
- package/dist/channels/topic.d.ts.map +0 -1
- package/dist/channels/topic.js +0 -65
- package/dist/channels/topic.js.map +0 -1
- package/dist/constants.cjs +0 -406
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.d.cts +0 -285
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.ts +0 -285
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -362
- package/dist/constants.js.map +0 -1
- package/dist/errors.cjs +0 -163
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -81
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts +0 -81
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -146
- package/dist/errors.js.map +0 -1
- package/dist/func/index.cjs +0 -301
- package/dist/func/index.cjs.map +0 -1
- package/dist/func/index.d.cts +0 -293
- package/dist/func/index.d.cts.map +0 -1
- package/dist/func/index.d.ts +0 -293
- package/dist/func/index.d.ts.map +0 -1
- package/dist/func/index.js +0 -298
- package/dist/func/index.js.map +0 -1
- package/dist/func/types.d.cts +0 -64
- package/dist/func/types.d.cts.map +0 -1
- package/dist/func/types.d.ts +0 -64
- package/dist/func/types.d.ts.map +0 -1
- package/dist/graph/annotation.cjs +0 -101
- package/dist/graph/annotation.cjs.map +0 -1
- package/dist/graph/annotation.d.cts +0 -116
- package/dist/graph/annotation.d.cts.map +0 -1
- package/dist/graph/annotation.d.ts +0 -116
- package/dist/graph/annotation.d.ts.map +0 -1
- package/dist/graph/annotation.js +0 -99
- package/dist/graph/annotation.js.map +0 -1
- package/dist/graph/graph.cjs +0 -423
- package/dist/graph/graph.cjs.map +0 -1
- package/dist/graph/graph.d.cts +0 -132
- package/dist/graph/graph.d.cts.map +0 -1
- package/dist/graph/graph.d.ts +0 -132
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js +0 -420
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.cjs +0 -5
- package/dist/graph/index.js +0 -7
- package/dist/graph/message.cjs +0 -99
- package/dist/graph/message.cjs.map +0 -1
- package/dist/graph/message.d.cts +0 -40
- package/dist/graph/message.d.cts.map +0 -1
- package/dist/graph/message.d.ts +0 -40
- package/dist/graph/message.d.ts.map +0 -1
- package/dist/graph/message.js +0 -95
- package/dist/graph/message.js.map +0 -1
- package/dist/graph/messages_annotation.cjs +0 -110
- package/dist/graph/messages_annotation.cjs.map +0 -1
- package/dist/graph/messages_annotation.d.cts +0 -112
- package/dist/graph/messages_annotation.d.cts.map +0 -1
- package/dist/graph/messages_annotation.d.ts +0 -112
- package/dist/graph/messages_annotation.d.ts.map +0 -1
- package/dist/graph/messages_annotation.js +0 -107
- package/dist/graph/messages_annotation.js.map +0 -1
- package/dist/graph/state.cjs +0 -501
- package/dist/graph/state.cjs.map +0 -1
- package/dist/graph/state.d.cts +0 -236
- package/dist/graph/state.d.cts.map +0 -1
- package/dist/graph/state.d.ts +0 -236
- package/dist/graph/state.d.ts.map +0 -1
- package/dist/graph/state.js +0 -499
- package/dist/graph/state.js.map +0 -1
- package/dist/graph/zod/index.cjs +0 -10
- package/dist/graph/zod/index.d.cts +0 -3
- package/dist/graph/zod/index.d.ts +0 -3
- package/dist/graph/zod/index.js +0 -5
- package/dist/graph/zod/meta.cjs +0 -145
- package/dist/graph/zod/meta.cjs.map +0 -1
- package/dist/graph/zod/meta.d.cts +0 -116
- package/dist/graph/zod/meta.d.cts.map +0 -1
- package/dist/graph/zod/meta.d.ts +0 -116
- package/dist/graph/zod/meta.d.ts.map +0 -1
- package/dist/graph/zod/meta.js +0 -141
- package/dist/graph/zod/meta.js.map +0 -1
- package/dist/graph/zod/plugin.cjs +0 -41
- package/dist/graph/zod/plugin.cjs.map +0 -1
- package/dist/graph/zod/plugin.js +0 -41
- package/dist/graph/zod/plugin.js.map +0 -1
- package/dist/graph/zod/schema.cjs +0 -99
- package/dist/graph/zod/schema.cjs.map +0 -1
- package/dist/graph/zod/schema.d.cts +0 -38
- package/dist/graph/zod/schema.d.cts.map +0 -1
- package/dist/graph/zod/schema.d.ts +0 -38
- package/dist/graph/zod/schema.d.ts.map +0 -1
- package/dist/graph/zod/schema.js +0 -94
- package/dist/graph/zod/schema.js.map +0 -1
- package/dist/graph/zod/zod-registry.cjs +0 -43
- package/dist/graph/zod/zod-registry.cjs.map +0 -1
- package/dist/graph/zod/zod-registry.d.cts +0 -51
- package/dist/graph/zod/zod-registry.d.cts.map +0 -1
- package/dist/graph/zod/zod-registry.d.ts +0 -51
- package/dist/graph/zod/zod-registry.d.ts.map +0 -1
- package/dist/graph/zod/zod-registry.js +0 -41
- package/dist/graph/zod/zod-registry.js.map +0 -1
- package/dist/hash.cjs +0 -271
- package/dist/hash.cjs.map +0 -1
- package/dist/hash.js +0 -269
- package/dist/hash.js.map +0 -1
- package/dist/index.cjs +0 -112
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -26
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/interrupt.cjs +0 -82
- package/dist/interrupt.cjs.map +0 -1
- package/dist/interrupt.d.cts +0 -58
- package/dist/interrupt.d.cts.map +0 -1
- package/dist/interrupt.d.ts +0 -58
- package/dist/interrupt.d.ts.map +0 -1
- package/dist/interrupt.js +0 -81
- package/dist/interrupt.js.map +0 -1
- package/dist/prebuilt/agentName.cjs +0 -153
- package/dist/prebuilt/agentName.cjs.map +0 -1
- package/dist/prebuilt/agentName.d.cts +0 -42
- package/dist/prebuilt/agentName.d.cts.map +0 -1
- package/dist/prebuilt/agentName.d.ts +0 -42
- package/dist/prebuilt/agentName.d.ts.map +0 -1
- package/dist/prebuilt/agentName.js +0 -152
- package/dist/prebuilt/agentName.js.map +0 -1
- package/dist/prebuilt/agent_executor.cjs +0 -44
- package/dist/prebuilt/agent_executor.cjs.map +0 -1
- package/dist/prebuilt/agent_executor.d.cts +0 -58
- package/dist/prebuilt/agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/agent_executor.d.ts +0 -58
- package/dist/prebuilt/agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/agent_executor.js +0 -44
- package/dist/prebuilt/agent_executor.js.map +0 -1
- package/dist/prebuilt/chat_agent_executor.cjs +0 -68
- package/dist/prebuilt/chat_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.cts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.ts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.js +0 -67
- package/dist/prebuilt/chat_agent_executor.js.map +0 -1
- package/dist/prebuilt/index.cjs +0 -15
- package/dist/prebuilt/index.d.cts +0 -8
- package/dist/prebuilt/index.d.ts +0 -8
- package/dist/prebuilt/index.js +0 -8
- package/dist/prebuilt/interrupt.d.cts +0 -61
- package/dist/prebuilt/interrupt.d.cts.map +0 -1
- package/dist/prebuilt/interrupt.d.ts +0 -61
- package/dist/prebuilt/interrupt.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.cjs +0 -344
- package/dist/prebuilt/react_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.cts +0 -230
- package/dist/prebuilt/react_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.ts +0 -230
- package/dist/prebuilt/react_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.js +0 -342
- package/dist/prebuilt/react_agent_executor.js.map +0 -1
- package/dist/prebuilt/tool_executor.cjs +0 -48
- package/dist/prebuilt/tool_executor.cjs.map +0 -1
- package/dist/prebuilt/tool_executor.d.cts +0 -42
- package/dist/prebuilt/tool_executor.d.cts.map +0 -1
- package/dist/prebuilt/tool_executor.d.ts +0 -42
- package/dist/prebuilt/tool_executor.d.ts.map +0 -1
- package/dist/prebuilt/tool_executor.js +0 -47
- package/dist/prebuilt/tool_executor.js.map +0 -1
- package/dist/prebuilt/tool_node.cjs +0 -248
- package/dist/prebuilt/tool_node.cjs.map +0 -1
- package/dist/prebuilt/tool_node.d.cts +0 -182
- package/dist/prebuilt/tool_node.d.cts.map +0 -1
- package/dist/prebuilt/tool_node.d.ts +0 -182
- package/dist/prebuilt/tool_node.d.ts.map +0 -1
- package/dist/prebuilt/tool_node.js +0 -246
- package/dist/prebuilt/tool_node.js.map +0 -1
- package/dist/pregel/algo.cjs +0 -573
- package/dist/pregel/algo.cjs.map +0 -1
- package/dist/pregel/algo.d.cts +0 -13
- package/dist/pregel/algo.d.cts.map +0 -1
- package/dist/pregel/algo.d.ts +0 -13
- package/dist/pregel/algo.d.ts.map +0 -1
- package/dist/pregel/algo.js +0 -567
- package/dist/pregel/algo.js.map +0 -1
- package/dist/pregel/call.cjs +0 -53
- package/dist/pregel/call.cjs.map +0 -1
- package/dist/pregel/call.js +0 -50
- package/dist/pregel/call.js.map +0 -1
- package/dist/pregel/debug.cjs +0 -175
- package/dist/pregel/debug.cjs.map +0 -1
- package/dist/pregel/debug.js +0 -169
- package/dist/pregel/debug.js.map +0 -1
- package/dist/pregel/index.cjs +0 -1170
- package/dist/pregel/index.cjs.map +0 -1
- package/dist/pregel/index.d.cts +0 -546
- package/dist/pregel/index.d.cts.map +0 -1
- package/dist/pregel/index.d.ts +0 -546
- package/dist/pregel/index.d.ts.map +0 -1
- package/dist/pregel/index.js +0 -1168
- package/dist/pregel/index.js.map +0 -1
- package/dist/pregel/io.cjs +0 -140
- package/dist/pregel/io.cjs.map +0 -1
- package/dist/pregel/io.js +0 -135
- package/dist/pregel/io.js.map +0 -1
- package/dist/pregel/loop.cjs +0 -548
- package/dist/pregel/loop.cjs.map +0 -1
- package/dist/pregel/loop.js +0 -547
- package/dist/pregel/loop.js.map +0 -1
- package/dist/pregel/messages.cjs +0 -108
- package/dist/pregel/messages.cjs.map +0 -1
- package/dist/pregel/messages.js +0 -107
- package/dist/pregel/messages.js.map +0 -1
- package/dist/pregel/read.cjs +0 -152
- package/dist/pregel/read.cjs.map +0 -1
- package/dist/pregel/read.d.cts +0 -51
- package/dist/pregel/read.d.cts.map +0 -1
- package/dist/pregel/read.d.ts +0 -51
- package/dist/pregel/read.d.ts.map +0 -1
- package/dist/pregel/read.js +0 -150
- package/dist/pregel/read.js.map +0 -1
- package/dist/pregel/remote.cjs +0 -349
- package/dist/pregel/remote.cjs.map +0 -1
- package/dist/pregel/remote.d.cts +0 -123
- package/dist/pregel/remote.d.cts.map +0 -1
- package/dist/pregel/remote.d.ts +0 -123
- package/dist/pregel/remote.d.ts.map +0 -1
- package/dist/pregel/remote.js +0 -348
- package/dist/pregel/remote.js.map +0 -1
- package/dist/pregel/retry.cjs +0 -92
- package/dist/pregel/retry.cjs.map +0 -1
- package/dist/pregel/retry.js +0 -92
- package/dist/pregel/retry.js.map +0 -1
- package/dist/pregel/runnable_types.d.cts +0 -49
- package/dist/pregel/runnable_types.d.cts.map +0 -1
- package/dist/pregel/runnable_types.d.ts +0 -49
- package/dist/pregel/runnable_types.d.ts.map +0 -1
- package/dist/pregel/runner.cjs +0 -228
- package/dist/pregel/runner.cjs.map +0 -1
- package/dist/pregel/runner.js +0 -228
- package/dist/pregel/runner.js.map +0 -1
- package/dist/pregel/stream.cjs +0 -199
- package/dist/pregel/stream.cjs.map +0 -1
- package/dist/pregel/stream.js +0 -196
- package/dist/pregel/stream.js.map +0 -1
- package/dist/pregel/types.cjs +0 -27
- package/dist/pregel/types.cjs.map +0 -1
- package/dist/pregel/types.d.cts +0 -453
- package/dist/pregel/types.d.cts.map +0 -1
- package/dist/pregel/types.d.ts +0 -453
- package/dist/pregel/types.d.ts.map +0 -1
- package/dist/pregel/types.js +0 -25
- package/dist/pregel/types.js.map +0 -1
- package/dist/pregel/utils/config.cjs +0 -122
- package/dist/pregel/utils/config.cjs.map +0 -1
- package/dist/pregel/utils/config.d.cts +0 -36
- package/dist/pregel/utils/config.d.cts.map +0 -1
- package/dist/pregel/utils/config.d.ts +0 -36
- package/dist/pregel/utils/config.d.ts.map +0 -1
- package/dist/pregel/utils/config.js +0 -115
- package/dist/pregel/utils/config.js.map +0 -1
- package/dist/pregel/utils/index.cjs +0 -103
- package/dist/pregel/utils/index.cjs.map +0 -1
- package/dist/pregel/utils/index.d.cts +0 -51
- package/dist/pregel/utils/index.d.cts.map +0 -1
- package/dist/pregel/utils/index.d.ts +0 -51
- package/dist/pregel/utils/index.d.ts.map +0 -1
- package/dist/pregel/utils/index.js +0 -97
- package/dist/pregel/utils/index.js.map +0 -1
- package/dist/pregel/utils/subgraph.cjs +0 -19
- package/dist/pregel/utils/subgraph.cjs.map +0 -1
- package/dist/pregel/utils/subgraph.js +0 -17
- package/dist/pregel/utils/subgraph.js.map +0 -1
- package/dist/pregel/validate.cjs +0 -45
- package/dist/pregel/validate.cjs.map +0 -1
- package/dist/pregel/validate.js +0 -44
- package/dist/pregel/validate.js.map +0 -1
- package/dist/pregel/write.cjs +0 -97
- package/dist/pregel/write.cjs.map +0 -1
- package/dist/pregel/write.d.cts +0 -35
- package/dist/pregel/write.d.cts.map +0 -1
- package/dist/pregel/write.d.ts +0 -35
- package/dist/pregel/write.d.ts.map +0 -1
- package/dist/pregel/write.js +0 -95
- package/dist/pregel/write.js.map +0 -1
- package/dist/remote.cjs +0 -3
- package/dist/remote.d.cts +0 -2
- package/dist/remote.d.ts +0 -2
- package/dist/remote.js +0 -3
- package/dist/setup/async_local_storage.cjs +0 -12
- package/dist/setup/async_local_storage.cjs.map +0 -1
- package/dist/setup/async_local_storage.js +0 -11
- package/dist/setup/async_local_storage.js.map +0 -1
- package/dist/utils.cjs +0 -88
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -32
- package/dist/utils.d.cts.map +0 -1
- package/dist/utils.d.ts +0 -32
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -81
- package/dist/utils.js.map +0 -1
- package/dist/web.cjs +0 -96
- package/dist/web.d.cts +0 -23
- package/dist/web.d.ts +0 -23
- package/dist/web.js +0 -15
- package/dist/writer.cjs +0 -15
- package/dist/writer.cjs.map +0 -1
- package/dist/writer.d.cts +0 -7
- package/dist/writer.d.cts.map +0 -1
- package/dist/writer.d.ts +0 -7
- package/dist/writer.d.ts.map +0 -1
- package/dist/writer.js +0 -14
- package/dist/writer.js.map +0 -1
package/dist/pregel/index.d.ts
DELETED
|
@@ -1,546 +0,0 @@
|
|
|
1
|
-
import { BaseChannel } from "../channels/base.js";
|
|
2
|
-
import { LangGraphRunnableConfig } from "./runnable_types.js";
|
|
3
|
-
import { RetryPolicy } from "./utils/index.js";
|
|
4
|
-
import { PregelNode } from "./read.js";
|
|
5
|
-
import { Command, CommandInstance } from "../constants.js";
|
|
6
|
-
import { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./types.js";
|
|
7
|
-
import { StrRecord } from "./algo.js";
|
|
8
|
-
import { ChannelWrite } from "./write.js";
|
|
9
|
-
import { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from "@langchain/langgraph-checkpoint";
|
|
10
|
-
import { Runnable, RunnableConfig, RunnableFunc } from "@langchain/core/runnables";
|
|
11
|
-
import * as _langchain_core_runnables_graph0 from "@langchain/core/runnables/graph";
|
|
12
|
-
import { IterableReadableStream } from "@langchain/core/utils/stream";
|
|
13
|
-
import { StreamEvent } from "@langchain/core/tracers/log_stream";
|
|
14
|
-
|
|
15
|
-
//#region src/pregel/index.d.ts
|
|
16
|
-
type WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;
|
|
17
|
-
type StreamEventsOptions = Parameters<Runnable["streamEvents"]>[2];
|
|
18
|
-
/**
|
|
19
|
-
* Utility class for working with channels in the Pregel system.
|
|
20
|
-
* Provides static methods for subscribing to channels and writing to them.
|
|
21
|
-
*
|
|
22
|
-
* Channels are the communication pathways between nodes in a Pregel graph.
|
|
23
|
-
* They enable message passing and state updates between different parts of the graph.
|
|
24
|
-
*/
|
|
25
|
-
declare class Channel {
|
|
26
|
-
/**
|
|
27
|
-
* Creates a PregelNode that subscribes to a single channel.
|
|
28
|
-
* This is used to define how nodes receive input from channels.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* // Subscribe to a single channel
|
|
33
|
-
* const node = Channel.subscribeTo("messages");
|
|
34
|
-
*
|
|
35
|
-
* // Subscribe to multiple channels
|
|
36
|
-
* const node = Channel.subscribeTo(["messages", "state"]);
|
|
37
|
-
*
|
|
38
|
-
* // Subscribe with a custom key
|
|
39
|
-
* const node = Channel.subscribeTo("messages", { key: "chat" });
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @param channel Single channel name to subscribe to
|
|
43
|
-
* @param options Subscription options
|
|
44
|
-
* @returns A PregelNode configured to receive from the specified channels
|
|
45
|
-
* @throws {Error} If a key is specified when subscribing to multiple channels
|
|
46
|
-
*/
|
|
47
|
-
static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a PregelNode that subscribes to multiple channels.
|
|
50
|
-
* This is used to define how nodes receive input from channels.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* // Subscribe to a single channel
|
|
55
|
-
* const node = Channel.subscribeTo("messages");
|
|
56
|
-
*
|
|
57
|
-
* // Subscribe to multiple channels
|
|
58
|
-
* const node = Channel.subscribeTo(["messages", "state"]);
|
|
59
|
-
*
|
|
60
|
-
* // Subscribe with a custom key
|
|
61
|
-
* const node = Channel.subscribeTo("messages", { key: "chat" });
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @param channels Single channel name to subscribe to
|
|
65
|
-
* @param options Subscription options
|
|
66
|
-
* @returns A PregelNode configured to receive from the specified channels
|
|
67
|
-
* @throws {Error} If a key is specified when subscribing to multiple channels
|
|
68
|
-
*/
|
|
69
|
-
static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;
|
|
70
|
-
/**
|
|
71
|
-
* Creates a ChannelWrite that specifies how to write values to channels.
|
|
72
|
-
* This is used to define how nodes send output to channels.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* // Write to multiple channels
|
|
77
|
-
* const write = Channel.writeTo(["output", "state"]);
|
|
78
|
-
*
|
|
79
|
-
* // Write with specific values
|
|
80
|
-
* const write = Channel.writeTo(["output"], {
|
|
81
|
-
* state: "completed",
|
|
82
|
-
* result: calculateResult()
|
|
83
|
-
* });
|
|
84
|
-
*
|
|
85
|
-
* // Write with a transformation function
|
|
86
|
-
* const write = Channel.writeTo(["output"], {
|
|
87
|
-
* result: (x) => processResult(x)
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* @param channels - Array of channel names to write to
|
|
92
|
-
* @param writes - Optional map of channel names to values or transformations
|
|
93
|
-
* @returns A ChannelWrite object that can be used to write to the specified channels
|
|
94
|
-
*/
|
|
95
|
-
static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;
|
|
96
|
-
}
|
|
97
|
-
// This is a workaround to allow Pregel to override `invoke` / `stream` and `withConfig`
|
|
98
|
-
// without having to adhere to the types in the `Runnable` class (thanks to `any`).
|
|
99
|
-
// Alternatively we could mark those methods with @ts-ignore / @ts-expect-error,
|
|
100
|
-
// but these do not get carried over when building via `tsc`.
|
|
101
|
-
declare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
|
|
102
|
-
lc_namespace: string[];
|
|
103
|
-
invoke(_input: RunInput, _options?: Partial<CallOptions>
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
|
-
): Promise<any>;
|
|
106
|
-
// Overriden by `Pregel`
|
|
107
|
-
withConfig(_config: CallOptions): typeof this;
|
|
108
|
-
// Overriden by `Pregel`
|
|
109
|
-
stream(input: RunInput, options?: Partial<CallOptions>
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
-
): Promise<IterableReadableStream<any>>;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model
|
|
115
|
-
* inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).
|
|
116
|
-
* It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.
|
|
117
|
-
*
|
|
118
|
-
* Key features:
|
|
119
|
-
* - Message passing between nodes in discrete "supersteps"
|
|
120
|
-
* - Built-in persistence layer through checkpointers
|
|
121
|
-
* - First-class streaming support for values, updates, and events
|
|
122
|
-
* - Human-in-the-loop capabilities via interrupts
|
|
123
|
-
* - Support for parallel node execution within supersteps
|
|
124
|
-
*
|
|
125
|
-
* The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:
|
|
126
|
-
* - {@link StateGraph}: The main graph class for building agent workflows
|
|
127
|
-
* - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`
|
|
128
|
-
* - Functional API: A declarative approach using tasks and entrypoints
|
|
129
|
-
* - A `Pregel` instance is returned by the {@link entrypoint} function
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* // Using StateGraph API
|
|
134
|
-
* const graph = new StateGraph(annotation)
|
|
135
|
-
* .addNode("nodeA", myNodeFunction)
|
|
136
|
-
* .addEdge("nodeA", "nodeB")
|
|
137
|
-
* .compile();
|
|
138
|
-
*
|
|
139
|
-
* // The compiled graph is a Pregel instance
|
|
140
|
-
* const result = await graph.invoke(input);
|
|
141
|
-
* ```
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```typescript
|
|
145
|
-
* // Using Functional API
|
|
146
|
-
* import { task, entrypoint } from "@langchain/langgraph";
|
|
147
|
-
* import { MemorySaver } from "@langchain/langgraph-checkpoint";
|
|
148
|
-
*
|
|
149
|
-
* // Define tasks that can be composed
|
|
150
|
-
* const addOne = task("add", async (x: number) => x + 1);
|
|
151
|
-
*
|
|
152
|
-
* // Create a workflow using the entrypoint function
|
|
153
|
-
* const workflow = entrypoint({
|
|
154
|
-
* name: "workflow",
|
|
155
|
-
* checkpointer: new MemorySaver()
|
|
156
|
-
* }, async (numbers: number[]) => {
|
|
157
|
-
* // Tasks can be run in parallel
|
|
158
|
-
* const results = await Promise.all(numbers.map(n => addOne(n)));
|
|
159
|
-
* return results;
|
|
160
|
-
* });
|
|
161
|
-
*
|
|
162
|
-
* // The workflow is a Pregel instance
|
|
163
|
-
* const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations
|
|
167
|
-
* @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations
|
|
168
|
-
* @typeParam ContextType - Type of context that can be passed to the graph
|
|
169
|
-
* @typeParam InputType - Type of input values accepted by the graph
|
|
170
|
-
* @typeParam OutputType - Type of output values produced by the graph
|
|
171
|
-
*/
|
|
172
|
-
declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>,
|
|
173
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
-
ContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance,
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
176
|
-
StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {
|
|
177
|
-
/**
|
|
178
|
-
* Name of the class when serialized
|
|
179
|
-
* @internal
|
|
180
|
-
*/
|
|
181
|
-
static lc_name(): string;
|
|
182
|
-
/** @internal Used for type inference */
|
|
183
|
-
"~InputType": InputType;
|
|
184
|
-
/** @internal Used for type inference */
|
|
185
|
-
"~OutputType": OutputType;
|
|
186
|
-
/** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */
|
|
187
|
-
lc_namespace: string[];
|
|
188
|
-
/** @internal Flag indicating this is a Pregel instance - necessary for serialization */
|
|
189
|
-
lg_is_pregel: boolean;
|
|
190
|
-
/** The nodes in the graph, mapping node names to their PregelNode instances */
|
|
191
|
-
nodes: Nodes;
|
|
192
|
-
/** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */
|
|
193
|
-
channels: Channels;
|
|
194
|
-
/**
|
|
195
|
-
* The input channels for the graph. These channels receive the initial input when the graph is invoked.
|
|
196
|
-
* Can be a single channel key or an array of channel keys.
|
|
197
|
-
*/
|
|
198
|
-
inputChannels: keyof Channels | Array<keyof Channels>;
|
|
199
|
-
/**
|
|
200
|
-
* The output channels for the graph. These channels contain the final output when the graph completes.
|
|
201
|
-
* Can be a single channel key or an array of channel keys.
|
|
202
|
-
*/
|
|
203
|
-
outputChannels: keyof Channels | Array<keyof Channels>;
|
|
204
|
-
/** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */
|
|
205
|
-
autoValidate: boolean;
|
|
206
|
-
/**
|
|
207
|
-
* The streaming modes enabled for this graph. Defaults to ["values"].
|
|
208
|
-
* Supported modes:
|
|
209
|
-
* - "values": Streams the full state after each step
|
|
210
|
-
* - "updates": Streams state updates after each step
|
|
211
|
-
* - "messages": Streams messages from within nodes
|
|
212
|
-
* - "custom": Streams custom events from within nodes
|
|
213
|
-
* - "debug": Streams events related to the execution of the graph - useful for tracing & debugging graph execution
|
|
214
|
-
*/
|
|
215
|
-
streamMode: StreamMode[];
|
|
216
|
-
/**
|
|
217
|
-
* Optional channels to stream. If not specified, all channels will be streamed.
|
|
218
|
-
* Can be a single channel key or an array of channel keys.
|
|
219
|
-
*/
|
|
220
|
-
streamChannels?: keyof Channels | Array<keyof Channels>;
|
|
221
|
-
/**
|
|
222
|
-
* Optional array of node names or "all" to interrupt after executing these nodes.
|
|
223
|
-
* Used for implementing human-in-the-loop workflows.
|
|
224
|
-
*/
|
|
225
|
-
interruptAfter?: Array<keyof Nodes> | All;
|
|
226
|
-
/**
|
|
227
|
-
* Optional array of node names or "all" to interrupt before executing these nodes.
|
|
228
|
-
* Used for implementing human-in-the-loop workflows.
|
|
229
|
-
*/
|
|
230
|
-
interruptBefore?: Array<keyof Nodes> | All;
|
|
231
|
-
/** Optional timeout in milliseconds for the execution of each superstep */
|
|
232
|
-
stepTimeout?: number;
|
|
233
|
-
/** Whether to enable debug logging. Defaults to false. */
|
|
234
|
-
debug: boolean;
|
|
235
|
-
/**
|
|
236
|
-
* Optional checkpointer for persisting graph state.
|
|
237
|
-
* When provided, saves a checkpoint of the graph state at every superstep.
|
|
238
|
-
* When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.
|
|
239
|
-
*/
|
|
240
|
-
checkpointer?: BaseCheckpointSaver | boolean;
|
|
241
|
-
/** Optional retry policy for handling failures in node execution */
|
|
242
|
-
retryPolicy?: RetryPolicy;
|
|
243
|
-
/** The default configuration for graph execution, can be overridden on a per-invocation basis */
|
|
244
|
-
config?: LangGraphRunnableConfig;
|
|
245
|
-
/**
|
|
246
|
-
* Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads
|
|
247
|
-
*/
|
|
248
|
-
store?: BaseStore;
|
|
249
|
-
/**
|
|
250
|
-
* Optional cache for the graph, useful for caching tasks.
|
|
251
|
-
*/
|
|
252
|
-
cache?: BaseCache;
|
|
253
|
-
/**
|
|
254
|
-
* Optional interrupt helper function.
|
|
255
|
-
* @internal
|
|
256
|
-
*/
|
|
257
|
-
private userInterrupt?;
|
|
258
|
-
/**
|
|
259
|
-
* The trigger to node mapping for the graph run.
|
|
260
|
-
* @internal
|
|
261
|
-
*/
|
|
262
|
-
private triggerToNodes;
|
|
263
|
-
/**
|
|
264
|
-
* Constructor for Pregel - meant for internal use only.
|
|
265
|
-
*
|
|
266
|
-
* @internal
|
|
267
|
-
*/
|
|
268
|
-
constructor(fields: PregelParams<Nodes, Channels>);
|
|
269
|
-
/**
|
|
270
|
-
* Creates a new instance of the Pregel graph with updated configuration.
|
|
271
|
-
* This method follows the immutable pattern - instead of modifying the current instance,
|
|
272
|
-
* it returns a new instance with the merged configuration.
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* ```typescript
|
|
276
|
-
* // Create a new instance with debug enabled
|
|
277
|
-
* const debugGraph = graph.withConfig({ debug: true });
|
|
278
|
-
*
|
|
279
|
-
* // Create a new instance with a specific thread ID
|
|
280
|
-
* const threadGraph = graph.withConfig({
|
|
281
|
-
* configurable: { thread_id: "123" }
|
|
282
|
-
* });
|
|
283
|
-
* ```
|
|
284
|
-
*
|
|
285
|
-
* @param config - The configuration to merge with the current configuration
|
|
286
|
-
* @returns A new Pregel instance with the merged configuration
|
|
287
|
-
*/
|
|
288
|
-
withConfig(config: Omit<LangGraphRunnableConfig, "store" | "writer" | "interrupt">): typeof this;
|
|
289
|
-
/**
|
|
290
|
-
* Validates the graph structure to ensure it is well-formed.
|
|
291
|
-
* Checks for:
|
|
292
|
-
* - No orphaned nodes
|
|
293
|
-
* - Valid input/output channel configurations
|
|
294
|
-
* - Valid interrupt configurations
|
|
295
|
-
*
|
|
296
|
-
* @returns this - The Pregel instance for method chaining
|
|
297
|
-
* @throws {GraphValidationError} If the graph structure is invalid
|
|
298
|
-
*/
|
|
299
|
-
validate(): this;
|
|
300
|
-
/**
|
|
301
|
-
* Gets a list of all channels that should be streamed.
|
|
302
|
-
* If streamChannels is specified, returns those channels.
|
|
303
|
-
* Otherwise, returns all channels in the graph.
|
|
304
|
-
*
|
|
305
|
-
* @returns Array of channel keys to stream
|
|
306
|
-
*/
|
|
307
|
-
get streamChannelsList(): Array<keyof Channels>;
|
|
308
|
-
/**
|
|
309
|
-
* Gets the channels to stream in their original format.
|
|
310
|
-
* If streamChannels is specified, returns it as-is (either single key or array).
|
|
311
|
-
* Otherwise, returns all channels in the graph as an array.
|
|
312
|
-
*
|
|
313
|
-
* @returns Channel keys to stream, either as a single key or array
|
|
314
|
-
*/
|
|
315
|
-
get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;
|
|
316
|
-
/**
|
|
317
|
-
* Gets a drawable representation of the graph structure.
|
|
318
|
-
* This is an async version of getGraph() and is the preferred method to use.
|
|
319
|
-
*
|
|
320
|
-
* @param config - Configuration for generating the graph visualization
|
|
321
|
-
* @returns A representation of the graph that can be visualized
|
|
322
|
-
*/
|
|
323
|
-
getGraphAsync(config: RunnableConfig): Promise<_langchain_core_runnables_graph0.Graph>;
|
|
324
|
-
/**
|
|
325
|
-
* Gets all subgraphs within this graph.
|
|
326
|
-
* A subgraph is a Pregel instance that is nested within a node of this graph.
|
|
327
|
-
*
|
|
328
|
-
* @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.
|
|
329
|
-
* @param namespace - Optional namespace to filter subgraphs
|
|
330
|
-
* @param recurse - Whether to recursively get subgraphs of subgraphs
|
|
331
|
-
* @returns Generator yielding tuples of [name, subgraph]
|
|
332
|
-
*/
|
|
333
|
-
getSubgraphs(namespace?: string, recurse?: boolean
|
|
334
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
|
-
): Generator<[string, Pregel<any, any>]>;
|
|
336
|
-
/**
|
|
337
|
-
* Gets all subgraphs within this graph asynchronously.
|
|
338
|
-
* A subgraph is a Pregel instance that is nested within a node of this graph.
|
|
339
|
-
*
|
|
340
|
-
* @param namespace - Optional namespace to filter subgraphs
|
|
341
|
-
* @param recurse - Whether to recursively get subgraphs of subgraphs
|
|
342
|
-
* @returns AsyncGenerator yielding tuples of [name, subgraph]
|
|
343
|
-
*/
|
|
344
|
-
getSubgraphsAsync(namespace?: string, recurse?: boolean
|
|
345
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
346
|
-
): AsyncGenerator<[string, Pregel<any, any>]>;
|
|
347
|
-
/**
|
|
348
|
-
* Prepares a state snapshot from saved checkpoint data.
|
|
349
|
-
* This is an internal method used by getState and getStateHistory.
|
|
350
|
-
*
|
|
351
|
-
* @param config - Configuration for preparing the snapshot
|
|
352
|
-
* @param saved - Optional saved checkpoint data
|
|
353
|
-
* @param subgraphCheckpointer - Optional checkpointer for subgraphs
|
|
354
|
-
* @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels
|
|
355
|
-
* @returns A snapshot of the graph state
|
|
356
|
-
* @internal
|
|
357
|
-
*/
|
|
358
|
-
protected _prepareStateSnapshot({
|
|
359
|
-
config,
|
|
360
|
-
saved,
|
|
361
|
-
subgraphCheckpointer,
|
|
362
|
-
applyPendingWrites
|
|
363
|
-
}: {
|
|
364
|
-
config: RunnableConfig;
|
|
365
|
-
saved?: CheckpointTuple;
|
|
366
|
-
subgraphCheckpointer?: BaseCheckpointSaver;
|
|
367
|
-
applyPendingWrites?: boolean;
|
|
368
|
-
}): Promise<StateSnapshot>;
|
|
369
|
-
/**
|
|
370
|
-
* Gets the current state of the graph.
|
|
371
|
-
* Requires a checkpointer to be configured.
|
|
372
|
-
*
|
|
373
|
-
* @param config - Configuration for retrieving the state
|
|
374
|
-
* @param options - Additional options
|
|
375
|
-
* @returns A snapshot of the current graph state
|
|
376
|
-
* @throws {GraphValueError} If no checkpointer is configured
|
|
377
|
-
*/
|
|
378
|
-
getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;
|
|
379
|
-
/**
|
|
380
|
-
* Gets the history of graph states.
|
|
381
|
-
* Requires a checkpointer to be configured.
|
|
382
|
-
* Useful for:
|
|
383
|
-
* - Debugging execution history
|
|
384
|
-
* - Implementing time travel
|
|
385
|
-
* - Analyzing graph behavior
|
|
386
|
-
*
|
|
387
|
-
* @param config - Configuration for retrieving the history
|
|
388
|
-
* @param options - Options for filtering the history
|
|
389
|
-
* @returns An async iterator of state snapshots
|
|
390
|
-
* @throws {Error} If no checkpointer is configured
|
|
391
|
-
*/
|
|
392
|
-
getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;
|
|
393
|
-
/**
|
|
394
|
-
* Apply updates to the graph state in bulk.
|
|
395
|
-
* Requires a checkpointer to be configured.
|
|
396
|
-
*
|
|
397
|
-
* This method is useful for recreating a thread
|
|
398
|
-
* from a list of updates, especially if a checkpoint
|
|
399
|
-
* is created as a result of multiple tasks.
|
|
400
|
-
*
|
|
401
|
-
* @internal The API might change in the future.
|
|
402
|
-
*
|
|
403
|
-
* @param startConfig - Configuration for the update
|
|
404
|
-
* @param updates - The list of updates to apply to graph state
|
|
405
|
-
* @returns Updated configuration
|
|
406
|
-
* @throws {GraphValueError} If no checkpointer is configured
|
|
407
|
-
* @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.
|
|
408
|
-
*/
|
|
409
|
-
bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{
|
|
410
|
-
updates: Array<{
|
|
411
|
-
values?: Record<string, unknown> | unknown;
|
|
412
|
-
asNode?: keyof Nodes | string;
|
|
413
|
-
}>;
|
|
414
|
-
}>): Promise<RunnableConfig>;
|
|
415
|
-
/**
|
|
416
|
-
* Updates the state of the graph with new values.
|
|
417
|
-
* Requires a checkpointer to be configured.
|
|
418
|
-
*
|
|
419
|
-
* This method can be used for:
|
|
420
|
-
* - Implementing human-in-the-loop workflows
|
|
421
|
-
* - Modifying graph state during breakpoints
|
|
422
|
-
* - Integrating external inputs into the graph
|
|
423
|
-
*
|
|
424
|
-
* @param inputConfig - Configuration for the update
|
|
425
|
-
* @param values - The values to update the state with
|
|
426
|
-
* @param asNode - Optional node name to attribute the update to
|
|
427
|
-
* @returns Updated configuration
|
|
428
|
-
* @throws {GraphValueError} If no checkpointer is configured
|
|
429
|
-
* @throws {InvalidUpdateError} If the update cannot be attributed to a node
|
|
430
|
-
*/
|
|
431
|
-
updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;
|
|
432
|
-
/**
|
|
433
|
-
* Gets the default values for various graph configuration options.
|
|
434
|
-
* This is an internal method used to process and normalize configuration options.
|
|
435
|
-
*
|
|
436
|
-
* @param config - The input configuration options
|
|
437
|
-
* @returns A tuple containing normalized values for:
|
|
438
|
-
* - debug mode
|
|
439
|
-
* - stream modes
|
|
440
|
-
* - input keys
|
|
441
|
-
* - output keys
|
|
442
|
-
* - remaining config
|
|
443
|
-
* - interrupt before nodes
|
|
444
|
-
* - interrupt after nodes
|
|
445
|
-
* - checkpointer
|
|
446
|
-
* - store
|
|
447
|
-
* - whether stream mode is single
|
|
448
|
-
* - node cache
|
|
449
|
-
* - whether checkpoint during is enabled
|
|
450
|
-
* @internal
|
|
451
|
-
*/
|
|
452
|
-
_defaults(config: PregelOptions<Nodes, Channels>): [boolean,
|
|
453
|
-
// debug
|
|
454
|
-
StreamMode[],
|
|
455
|
-
// stream mode
|
|
456
|
-
// stream mode
|
|
457
|
-
string | string[],
|
|
458
|
-
// input keys
|
|
459
|
-
// input keys
|
|
460
|
-
string | string[],
|
|
461
|
-
// output keys
|
|
462
|
-
LangGraphRunnableConfig,
|
|
463
|
-
// config without pregel keys
|
|
464
|
-
// config without pregel keys
|
|
465
|
-
All | string[],
|
|
466
|
-
// interrupt before
|
|
467
|
-
// interrupt before
|
|
468
|
-
All | string[],
|
|
469
|
-
// interrupt after
|
|
470
|
-
// interrupt after
|
|
471
|
-
BaseCheckpointSaver | undefined,
|
|
472
|
-
// checkpointer
|
|
473
|
-
// checkpointer
|
|
474
|
-
BaseStore | undefined,
|
|
475
|
-
// store
|
|
476
|
-
boolean,
|
|
477
|
-
// stream mode single
|
|
478
|
-
// stream mode single
|
|
479
|
-
BaseCache | undefined,
|
|
480
|
-
// node cache
|
|
481
|
-
Durability // durability
|
|
482
|
-
];
|
|
483
|
-
/**
|
|
484
|
-
* Streams the execution of the graph, emitting state updates as they occur.
|
|
485
|
-
* This is the primary method for observing graph execution in real-time.
|
|
486
|
-
*
|
|
487
|
-
* Stream modes:
|
|
488
|
-
* - "values": Emits complete state after each step
|
|
489
|
-
* - "updates": Emits only state changes after each step
|
|
490
|
-
* - "debug": Emits detailed debug information
|
|
491
|
-
* - "messages": Emits messages from within nodes
|
|
492
|
-
* - "custom": Emits custom events from within nodes
|
|
493
|
-
* - "checkpoints": Emits checkpoints from within nodes
|
|
494
|
-
* - "tasks": Emits tasks from within nodes
|
|
495
|
-
*
|
|
496
|
-
* @param input - The input to start graph execution with
|
|
497
|
-
* @param options - Configuration options for streaming
|
|
498
|
-
* @returns An async iterable stream of graph state updates
|
|
499
|
-
*/
|
|
500
|
-
stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends "text/event-stream" | undefined>(input: InputType | CommandType | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType, StreamCustom, TEncoding>>>;
|
|
501
|
-
/**
|
|
502
|
-
* @inheritdoc
|
|
503
|
-
*/
|
|
504
|
-
streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {
|
|
505
|
-
version: "v1" | "v2";
|
|
506
|
-
}, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;
|
|
507
|
-
streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {
|
|
508
|
-
version: "v1" | "v2";
|
|
509
|
-
encoding: "text/event-stream";
|
|
510
|
-
}, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;
|
|
511
|
-
/**
|
|
512
|
-
* Validates the input for the graph.
|
|
513
|
-
* @param input - The input to validate
|
|
514
|
-
* @returns The validated input
|
|
515
|
-
* @internal
|
|
516
|
-
*/
|
|
517
|
-
protected _validateInput(input: PregelInputType): Promise<any>;
|
|
518
|
-
/**
|
|
519
|
-
* Validates the context options for the graph.
|
|
520
|
-
* @param context - The context options to validate
|
|
521
|
-
* @returns The validated context options
|
|
522
|
-
* @internal
|
|
523
|
-
*/
|
|
524
|
-
protected _validateContext(context: Partial<LangGraphRunnableConfig["context"]>): Promise<LangGraphRunnableConfig["context"]>;
|
|
525
|
-
/**
|
|
526
|
-
* Internal iterator used by stream() to generate state updates.
|
|
527
|
-
* This method handles the core logic of graph execution and streaming.
|
|
528
|
-
*
|
|
529
|
-
* @param input - The input to start graph execution with
|
|
530
|
-
* @param options - Configuration options for streaming
|
|
531
|
-
* @returns AsyncGenerator yielding state updates
|
|
532
|
-
* @internal
|
|
533
|
-
*/
|
|
534
|
-
_streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;
|
|
535
|
-
/**
|
|
536
|
-
* Run the graph with a single input and config.
|
|
537
|
-
* @param input The input to the graph.
|
|
538
|
-
* @param options The configuration to use for the run.
|
|
539
|
-
*/
|
|
540
|
-
invoke(input: InputType | CommandType | null, options?: Partial<Omit<PregelOptions<Nodes, Channels, ContextType>, "encoding">>): Promise<OutputType>;
|
|
541
|
-
private _runLoop;
|
|
542
|
-
clearCache(): Promise<void>;
|
|
543
|
-
}
|
|
544
|
-
//#endregion
|
|
545
|
-
export { Channel, Pregel, type PregelInputType, type PregelOptions, type PregelOutputType };
|
|
546
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Runnable","RunnableConfig","RunnableFunc","StreamEvent","IterableReadableStream","All","BaseCache","BaseCheckpointSaver","BaseStore","CheckpointListOptions","CheckpointTuple","BaseChannel","Command","CommandInstance","StrRecord","PregelNode","LangGraphRunnableConfig","Durability","GetStateOptions","MultipleChannelSubscriptionOptions","PregelInputType","PregelInterface","PregelOptions","PregelOutputType","PregelParams","SingleChannelSubscriptionOptions","StateSnapshot","StreamMode","StreamOutputMap","RetryPolicy","ChannelWrite","WriteValue","StreamEventsOptions","Parameters","Channel","Record","PartialRunnable","RunInput","RunOutput","CallOptions","Partial","Promise","Pregel","InputType","OutputType","CommandType","Nodes","Channels","ContextType","Array","Omit","_langchain_core_runnables_graph0","Graph","Generator","AsyncGenerator","config","saved","subgraphCheckpointer","applyPendingWrites","AsyncIterableIterator","TStreamMode","TSubgraphs","TEncoding","StreamUpdatesType","StreamValuesType","NodeReturnType","StreamCustom","Uint8Array"],"sources":["../../src/pregel/index.d.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Runnable, RunnableConfig, RunnableFunc } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from \"@langchain/langgraph-checkpoint\";\nimport { BaseChannel } from \"../channels/base.js\";\nimport { Command, type CommandInstance } from \"../constants.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelNode } from \"./read.js\";\nimport { LangGraphRunnableConfig } from \"./runnable_types.js\";\nimport type { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from \"./types.js\";\nimport { RetryPolicy } from \"./utils/index.js\";\nimport { ChannelWrite } from \"./write.js\";\ntype WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;\ntype StreamEventsOptions = Parameters<Runnable[\"streamEvents\"]>[2];\n/**\n * Utility class for working with channels in the Pregel system.\n * Provides static methods for subscribing to channels and writing to them.\n *\n * Channels are the communication pathways between nodes in a Pregel graph.\n * They enable message passing and state updates between different parts of the graph.\n */\nexport declare class Channel {\n /**\n * Creates a PregelNode that subscribes to a single channel.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channel Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a PregelNode that subscribes to multiple channels.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channels Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a ChannelWrite that specifies how to write values to channels.\n * This is used to define how nodes send output to channels.\n *\n * @example\n * ```typescript\n * // Write to multiple channels\n * const write = Channel.writeTo([\"output\", \"state\"]);\n *\n * // Write with specific values\n * const write = Channel.writeTo([\"output\"], {\n * state: \"completed\",\n * result: calculateResult()\n * });\n *\n * // Write with a transformation function\n * const write = Channel.writeTo([\"output\"], {\n * result: (x) => processResult(x)\n * });\n * ```\n *\n * @param channels - Array of channel names to write to\n * @param writes - Optional map of channel names to values or transformations\n * @returns A ChannelWrite object that can be used to write to the specified channels\n */\n static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;\n}\nexport type { PregelInputType, PregelOptions, PregelOutputType };\n// This is a workaround to allow Pregel to override `invoke` / `stream` and `withConfig`\n// without having to adhere to the types in the `Runnable` class (thanks to `any`).\n// Alternatively we could mark those methods with @ts-ignore / @ts-expect-error,\n// but these do not get carried over when building via `tsc`.\ndeclare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {\n lc_namespace: string[];\n invoke(_input: RunInput, _options?: Partial<CallOptions>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any>;\n // Overriden by `Pregel`\n withConfig(_config: CallOptions): typeof this;\n // Overriden by `Pregel`\n stream(input: RunInput, options?: Partial<CallOptions>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<IterableReadableStream<any>>;\n}\n/**\n * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model\n * inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).\n * It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.\n *\n * Key features:\n * - Message passing between nodes in discrete \"supersteps\"\n * - Built-in persistence layer through checkpointers\n * - First-class streaming support for values, updates, and events\n * - Human-in-the-loop capabilities via interrupts\n * - Support for parallel node execution within supersteps\n *\n * The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:\n * - {@link StateGraph}: The main graph class for building agent workflows\n * - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`\n * - Functional API: A declarative approach using tasks and entrypoints\n * - A `Pregel` instance is returned by the {@link entrypoint} function\n *\n * @example\n * ```typescript\n * // Using StateGraph API\n * const graph = new StateGraph(annotation)\n * .addNode(\"nodeA\", myNodeFunction)\n * .addEdge(\"nodeA\", \"nodeB\")\n * .compile();\n *\n * // The compiled graph is a Pregel instance\n * const result = await graph.invoke(input);\n * ```\n *\n * @example\n * ```typescript\n * // Using Functional API\n * import { task, entrypoint } from \"@langchain/langgraph\";\n * import { MemorySaver } from \"@langchain/langgraph-checkpoint\";\n *\n * // Define tasks that can be composed\n * const addOne = task(\"add\", async (x: number) => x + 1);\n *\n * // Create a workflow using the entrypoint function\n * const workflow = entrypoint({\n * name: \"workflow\",\n * checkpointer: new MemorySaver()\n * }, async (numbers: number[]) => {\n * // Tasks can be run in parallel\n * const results = await Promise.all(numbers.map(n => addOne(n)));\n * return results;\n * });\n *\n * // The workflow is a Pregel instance\n * const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]\n * ```\n *\n * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations\n * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations\n * @typeParam ContextType - Type of context that can be passed to the graph\n * @typeParam InputType - Type of input values accepted by the graph\n * @typeParam OutputType - Type of output values produced by the graph\n */\nexport declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {\n /**\n * Name of the class when serialized\n * @internal\n */\n static lc_name(): string;\n /** @internal Used for type inference */\n \"~InputType\": InputType;\n /** @internal Used for type inference */\n \"~OutputType\": OutputType;\n /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */\n lc_namespace: string[];\n /** @internal Flag indicating this is a Pregel instance - necessary for serialization */\n lg_is_pregel: boolean;\n /** The nodes in the graph, mapping node names to their PregelNode instances */\n nodes: Nodes;\n /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */\n channels: Channels;\n /**\n * The input channels for the graph. These channels receive the initial input when the graph is invoked.\n * Can be a single channel key or an array of channel keys.\n */\n inputChannels: keyof Channels | Array<keyof Channels>;\n /**\n * The output channels for the graph. These channels contain the final output when the graph completes.\n * Can be a single channel key or an array of channel keys.\n */\n outputChannels: keyof Channels | Array<keyof Channels>;\n /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */\n autoValidate: boolean;\n /**\n * The streaming modes enabled for this graph. Defaults to [\"values\"].\n * Supported modes:\n * - \"values\": Streams the full state after each step\n * - \"updates\": Streams state updates after each step\n * - \"messages\": Streams messages from within nodes\n * - \"custom\": Streams custom events from within nodes\n * - \"debug\": Streams events related to the execution of the graph - useful for tracing & debugging graph execution\n */\n streamMode: StreamMode[];\n /**\n * Optional channels to stream. If not specified, all channels will be streamed.\n * Can be a single channel key or an array of channel keys.\n */\n streamChannels?: keyof Channels | Array<keyof Channels>;\n /**\n * Optional array of node names or \"all\" to interrupt after executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptAfter?: Array<keyof Nodes> | All;\n /**\n * Optional array of node names or \"all\" to interrupt before executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptBefore?: Array<keyof Nodes> | All;\n /** Optional timeout in milliseconds for the execution of each superstep */\n stepTimeout?: number;\n /** Whether to enable debug logging. Defaults to false. */\n debug: boolean;\n /**\n * Optional checkpointer for persisting graph state.\n * When provided, saves a checkpoint of the graph state at every superstep.\n * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.\n */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** Optional retry policy for handling failures in node execution */\n retryPolicy?: RetryPolicy;\n /** The default configuration for graph execution, can be overridden on a per-invocation basis */\n config?: LangGraphRunnableConfig;\n /**\n * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads\n */\n store?: BaseStore;\n /**\n * Optional cache for the graph, useful for caching tasks.\n */\n cache?: BaseCache;\n /**\n * Optional interrupt helper function.\n * @internal\n */\n private userInterrupt?;\n /**\n * The trigger to node mapping for the graph run.\n * @internal\n */\n private triggerToNodes;\n /**\n * Constructor for Pregel - meant for internal use only.\n *\n * @internal\n */\n constructor(fields: PregelParams<Nodes, Channels>);\n /**\n * Creates a new instance of the Pregel graph with updated configuration.\n * This method follows the immutable pattern - instead of modifying the current instance,\n * it returns a new instance with the merged configuration.\n *\n * @example\n * ```typescript\n * // Create a new instance with debug enabled\n * const debugGraph = graph.withConfig({ debug: true });\n *\n * // Create a new instance with a specific thread ID\n * const threadGraph = graph.withConfig({\n * configurable: { thread_id: \"123\" }\n * });\n * ```\n *\n * @param config - The configuration to merge with the current configuration\n * @returns A new Pregel instance with the merged configuration\n */\n withConfig(config: Omit<LangGraphRunnableConfig, \"store\" | \"writer\" | \"interrupt\">): typeof this;\n /**\n * Validates the graph structure to ensure it is well-formed.\n * Checks for:\n * - No orphaned nodes\n * - Valid input/output channel configurations\n * - Valid interrupt configurations\n *\n * @returns this - The Pregel instance for method chaining\n * @throws {GraphValidationError} If the graph structure is invalid\n */\n validate(): this;\n /**\n * Gets a list of all channels that should be streamed.\n * If streamChannels is specified, returns those channels.\n * Otherwise, returns all channels in the graph.\n *\n * @returns Array of channel keys to stream\n */\n get streamChannelsList(): Array<keyof Channels>;\n /**\n * Gets the channels to stream in their original format.\n * If streamChannels is specified, returns it as-is (either single key or array).\n * Otherwise, returns all channels in the graph as an array.\n *\n * @returns Channel keys to stream, either as a single key or array\n */\n get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;\n /**\n * Gets a drawable representation of the graph structure.\n * This is an async version of getGraph() and is the preferred method to use.\n *\n * @param config - Configuration for generating the graph visualization\n * @returns A representation of the graph that can be visualized\n */\n getGraphAsync(config: RunnableConfig): Promise<import(\"@langchain/core/runnables/graph\").Graph>;\n /**\n * Gets all subgraphs within this graph.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns Generator yielding tuples of [name, subgraph]\n */\n getSubgraphs(namespace?: string, recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Generator<[string, Pregel<any, any>]>;\n /**\n * Gets all subgraphs within this graph asynchronously.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns AsyncGenerator yielding tuples of [name, subgraph]\n */\n getSubgraphsAsync(namespace?: string, recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): AsyncGenerator<[string, Pregel<any, any>]>;\n /**\n * Prepares a state snapshot from saved checkpoint data.\n * This is an internal method used by getState and getStateHistory.\n *\n * @param config - Configuration for preparing the snapshot\n * @param saved - Optional saved checkpoint data\n * @param subgraphCheckpointer - Optional checkpointer for subgraphs\n * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels\n * @returns A snapshot of the graph state\n * @internal\n */\n protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, applyPendingWrites }: {\n config: RunnableConfig;\n saved?: CheckpointTuple;\n subgraphCheckpointer?: BaseCheckpointSaver;\n applyPendingWrites?: boolean;\n }): Promise<StateSnapshot>;\n /**\n * Gets the current state of the graph.\n * Requires a checkpointer to be configured.\n *\n * @param config - Configuration for retrieving the state\n * @param options - Additional options\n * @returns A snapshot of the current graph state\n * @throws {GraphValueError} If no checkpointer is configured\n */\n getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;\n /**\n * Gets the history of graph states.\n * Requires a checkpointer to be configured.\n * Useful for:\n * - Debugging execution history\n * - Implementing time travel\n * - Analyzing graph behavior\n *\n * @param config - Configuration for retrieving the history\n * @param options - Options for filtering the history\n * @returns An async iterator of state snapshots\n * @throws {Error} If no checkpointer is configured\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n /**\n * Apply updates to the graph state in bulk.\n * Requires a checkpointer to be configured.\n *\n * This method is useful for recreating a thread\n * from a list of updates, especially if a checkpoint\n * is created as a result of multiple tasks.\n *\n * @internal The API might change in the future.\n *\n * @param startConfig - Configuration for the update\n * @param updates - The list of updates to apply to graph state\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.\n */\n bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{\n updates: Array<{\n values?: Record<string, unknown> | unknown;\n asNode?: keyof Nodes | string;\n }>;\n }>): Promise<RunnableConfig>;\n /**\n * Updates the state of the graph with new values.\n * Requires a checkpointer to be configured.\n *\n * This method can be used for:\n * - Implementing human-in-the-loop workflows\n * - Modifying graph state during breakpoints\n * - Integrating external inputs into the graph\n *\n * @param inputConfig - Configuration for the update\n * @param values - The values to update the state with\n * @param asNode - Optional node name to attribute the update to\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;\n /**\n * Gets the default values for various graph configuration options.\n * This is an internal method used to process and normalize configuration options.\n *\n * @param config - The input configuration options\n * @returns A tuple containing normalized values for:\n * - debug mode\n * - stream modes\n * - input keys\n * - output keys\n * - remaining config\n * - interrupt before nodes\n * - interrupt after nodes\n * - checkpointer\n * - store\n * - whether stream mode is single\n * - node cache\n * - whether checkpoint during is enabled\n * @internal\n */\n _defaults(config: PregelOptions<Nodes, Channels>): [\n boolean, // debug\n StreamMode[], // stream mode\n // stream mode\n string | string[], // input keys\n // input keys\n string | string[], // output keys\n LangGraphRunnableConfig, // config without pregel keys\n // config without pregel keys\n All | string[], // interrupt before\n // interrupt before\n All | string[], // interrupt after\n // interrupt after\n BaseCheckpointSaver | undefined, // checkpointer\n // checkpointer\n BaseStore | undefined, // store\n boolean, // stream mode single\n // stream mode single\n BaseCache | undefined, // node cache\n Durability // durability\n ];\n /**\n * Streams the execution of the graph, emitting state updates as they occur.\n * This is the primary method for observing graph execution in real-time.\n *\n * Stream modes:\n * - \"values\": Emits complete state after each step\n * - \"updates\": Emits only state changes after each step\n * - \"debug\": Emits detailed debug information\n * - \"messages\": Emits messages from within nodes\n * - \"custom\": Emits custom events from within nodes\n * - \"checkpoints\": Emits checkpoints from within nodes\n * - \"tasks\": Emits tasks from within nodes\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns An async iterable stream of graph state updates\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends \"text/event-stream\" | undefined>(input: InputType | CommandType | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType, StreamCustom, TEncoding>>>;\n /**\n * @inheritdoc\n */\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: \"text/event-stream\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;\n /**\n * Validates the input for the graph.\n * @param input - The input to validate\n * @returns The validated input\n * @internal\n */\n protected _validateInput(input: PregelInputType): Promise<any>;\n /**\n * Validates the context options for the graph.\n * @param context - The context options to validate\n * @returns The validated context options\n * @internal\n */\n protected _validateContext(context: Partial<LangGraphRunnableConfig[\"context\"]>): Promise<LangGraphRunnableConfig[\"context\"]>;\n /**\n * Internal iterator used by stream() to generate state updates.\n * This method handles the core logic of graph execution and streaming.\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns AsyncGenerator yielding state updates\n * @internal\n */\n _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;\n /**\n * Run the graph with a single input and config.\n * @param input The input to the graph.\n * @param options The configuration to use for the run.\n */\n invoke(input: InputType | CommandType | null, options?: Partial<Omit<PregelOptions<Nodes, Channels, ContextType>, \"encoding\">>): Promise<OutputType>;\n private _runLoop;\n clearCache(): Promise<void>;\n}\n"],"mappings":"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"}
|