@langchain/langgraph 0.2.20 → 0.2.22

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/README.md CHANGED
@@ -185,7 +185,7 @@ Is there anything else you'd like to know about the weather in New York or any o
185
185
  <summary>Initialize the model and tools.</summary>
186
186
 
187
187
  - We use `ChatAnthropic` as our LLM. **NOTE:** We need make sure the model knows that it has these tools available to call. We can do this by converting the LangChain tools into the format for Anthropic tool calling using the `.bindTools()` method.
188
- - We define the tools we want to use -- a weather tool in our case. See the documentation [here](https://js.langchain.com/docs/modules/agents/tools/dynamic) on how to create your own tools.
188
+ - We define the tools we want to use -- a weather tool in our case. See the documentation [here](https://js.langchain.com/docs/how_to/custom_tools/) on how to create your own tools.
189
189
  </details>
190
190
 
191
191
  2. <details>
@@ -472,14 +472,23 @@ class Pregel extends runnables_1.Runnable {
472
472
  let checkpointConfig = (0, utils_js_1.patchConfigurable)(config, {
473
473
  checkpoint_ns: config.configurable?.checkpoint_ns ?? "",
474
474
  });
475
- if (saved) {
475
+ if (saved?.config.configurable) {
476
476
  checkpointConfig = (0, utils_js_1.patchConfigurable)(config, saved.config.configurable);
477
477
  }
478
478
  // Find last node that updated the state, if not provided
479
479
  if (values == null && asNode === undefined) {
480
480
  const nextConfig = await checkpointer.put(checkpointConfig, (0, base_js_1.createCheckpoint)(checkpoint, undefined, step), {
481
481
  source: "update",
482
- step,
482
+ step: step + 1,
483
+ writes: {},
484
+ parents: saved?.metadata?.parents ?? {},
485
+ }, {});
486
+ return (0, index_js_1.patchCheckpointMap)(nextConfig, saved ? saved.metadata : undefined);
487
+ }
488
+ if (values == null && asNode === "__copy__") {
489
+ const nextConfig = await checkpointer.put(saved?.parentConfig ?? checkpointConfig, (0, base_js_1.createCheckpoint)(checkpoint, undefined, step), {
490
+ source: "fork",
491
+ step: step + 1,
483
492
  writes: {},
484
493
  parents: saved?.metadata?.parents ?? {},
485
494
  }, {});
@@ -648,7 +657,16 @@ class Pregel extends runnables_1.Runnable {
648
657
  * @param options.debug Whether to print debug information during execution.
649
658
  */
650
659
  async stream(input, options) {
651
- return super.stream(input, options);
660
+ // The ensureConfig method called internally defaults recursionLimit to 25 if not
661
+ // passed directly in `options`.
662
+ // There is currently no way in _streamIterator to determine whether this was
663
+ // set by by ensureConfig or manually by the user, so we specify the bound value here
664
+ // and override if it is passed as an explicit param in `options`.
665
+ const config = {
666
+ recursionLimit: this.config?.recursionLimit,
667
+ ...options,
668
+ };
669
+ return super.stream(input, config);
652
670
  }
653
671
  async prepareSpecs(config, options) {
654
672
  const configForManaged = {
@@ -468,14 +468,23 @@ export class Pregel extends Runnable {
468
468
  let checkpointConfig = patchConfigurable(config, {
469
469
  checkpoint_ns: config.configurable?.checkpoint_ns ?? "",
470
470
  });
471
- if (saved) {
471
+ if (saved?.config.configurable) {
472
472
  checkpointConfig = patchConfigurable(config, saved.config.configurable);
473
473
  }
474
474
  // Find last node that updated the state, if not provided
475
475
  if (values == null && asNode === undefined) {
476
476
  const nextConfig = await checkpointer.put(checkpointConfig, createCheckpoint(checkpoint, undefined, step), {
477
477
  source: "update",
478
- step,
478
+ step: step + 1,
479
+ writes: {},
480
+ parents: saved?.metadata?.parents ?? {},
481
+ }, {});
482
+ return patchCheckpointMap(nextConfig, saved ? saved.metadata : undefined);
483
+ }
484
+ if (values == null && asNode === "__copy__") {
485
+ const nextConfig = await checkpointer.put(saved?.parentConfig ?? checkpointConfig, createCheckpoint(checkpoint, undefined, step), {
486
+ source: "fork",
487
+ step: step + 1,
479
488
  writes: {},
480
489
  parents: saved?.metadata?.parents ?? {},
481
490
  }, {});
@@ -644,7 +653,16 @@ export class Pregel extends Runnable {
644
653
  * @param options.debug Whether to print debug information during execution.
645
654
  */
646
655
  async stream(input, options) {
647
- return super.stream(input, options);
656
+ // The ensureConfig method called internally defaults recursionLimit to 25 if not
657
+ // passed directly in `options`.
658
+ // There is currently no way in _streamIterator to determine whether this was
659
+ // set by by ensureConfig or manually by the user, so we specify the bound value here
660
+ // and override if it is passed as an explicit param in `options`.
661
+ const config = {
662
+ recursionLimit: this.config?.recursionLimit,
663
+ ...options,
664
+ };
665
+ return super.stream(input, config);
648
666
  }
649
667
  async prepareSpecs(config, options) {
650
668
  const configForManaged = {
@@ -420,7 +420,6 @@ class RemoteGraph extends runnables_1.Runnable {
420
420
  xray: config?.xray,
421
421
  });
422
422
  return new graph_1.Graph({
423
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
424
423
  nodes: this._getDrawableNodes(graph.nodes),
425
424
  edges: graph.edges,
426
425
  });
@@ -417,7 +417,6 @@ export class RemoteGraph extends Runnable {
417
417
  xray: config?.xray,
418
418
  });
419
419
  return new DrawableGraph({
420
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
421
420
  nodes: this._getDrawableNodes(graph.nodes),
422
421
  edges: graph.edges,
423
422
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -31,8 +31,8 @@
31
31
  "author": "LangChain",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@langchain/langgraph-checkpoint": "~0.0.10",
35
- "@langchain/langgraph-sdk": "~0.0.20",
34
+ "@langchain/langgraph-checkpoint": "~0.0.12",
35
+ "@langchain/langgraph-sdk": "~0.0.21",
36
36
  "uuid": "^10.0.0",
37
37
  "zod": "^3.23.8"
38
38
  },