[PR #119] [MERGED] Implement serde, getTuple(), and list() in BaseCheckpointSaver #503

Closed
opened 2026-02-15 18:17:12 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/119
Author: @andrewnguonly
Created: 4/18/2024
Status: Merged
Merged: 4/23/2024
Merged by: @nfcampos

Base: mainHead: migrate-checkpoint


📝 Commits (10+)

  • d5de77f Update BaseCheckpointSaver class with getTuple() and list() functions.
  • c186fb3 Fix bug when selecting max ts (string).
  • 7ed84ef Remove console.log().
  • 588de4b Fix bug in put(). Add unit tests.
  • e840069 Fix format errors.
  • c0cf1a5 Fix lint errors.
  • 6cd62c7 Fix prettier format issues.
  • 2d0a723 Create NoopSerializer for MemorySaver checkpointer.
  • a4c7ec7 Implement SqliteSaver.
  • 4a6fabd Implement put() and list() for SqliteSaver and add unit tests.

📊 Changes

13 files changed (+1554 additions, -772 deletions)

View changed files

📝 langgraph/package.json (+3 -1)
📝 langgraph/src/channels/base.ts (+1 -19)
📝 langgraph/src/checkpoint/base.ts (+75 -6)
📝 langgraph/src/checkpoint/index.ts (+1 -0)
📝 langgraph/src/checkpoint/memory.ts (+92 -22)
langgraph/src/checkpoint/sqlite.ts (+205 -0)
📝 langgraph/src/graph/graph.ts (+2 -1)
📝 langgraph/src/graph/state.ts (+2 -1)
📝 langgraph/src/pregel/index.ts (+7 -5)
📝 langgraph/src/tests/channels.test.ts (+1 -45)
langgraph/src/tests/checkpoints.test.ts (+180 -0)
📝 langgraph/src/tests/pregel.test.ts (+5 -5)
📝 yarn.lock (+980 -667)

📄 Description

Summary

To get checkpointing functionality up to parity with LangGraph's Python implementation, the BaseCheckpointSaver class needs to be updated to define serde, getTuple() and list(). Downstream dependencies (e.g. MemorySaver) are updated accordingly.

Implementation

  1. Move deepCopy() to /checkpoint/base.ts.
  2. Update BaseCheckpointSaver: Define serde attribute. Define getTuple() and list() methods. Update methods to return Promise.
  3. Update MemorySaver: Update storage attribute type. Update method implementations.
  4. Implement SqliteSaver.

To Do

  • Implement serde in MemorySaver.
  • Implement SQLite checkpointer and tests.
  • Add unit tests for getTuple() and list().
  • Clean up the code a bit.
  • Update SQLite schema to use camel_case.
  • Add changes for SqliteSaver from this PR: https://github.com/langchain-ai/langgraph/pull/332

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/119 **Author:** [@andrewnguonly](https://github.com/andrewnguonly) **Created:** 4/18/2024 **Status:** ✅ Merged **Merged:** 4/23/2024 **Merged by:** [@nfcampos](https://github.com/nfcampos) **Base:** `main` ← **Head:** `migrate-checkpoint` --- ### 📝 Commits (10+) - [`d5de77f`](https://github.com/langchain-ai/langgraphjs/commit/d5de77f5485d8812951e89cdc42b1179a9ef3e8a) Update BaseCheckpointSaver class with getTuple() and list() functions. - [`c186fb3`](https://github.com/langchain-ai/langgraphjs/commit/c186fb30c68e7f0c7201f5f724ef5288c84a4c51) Fix bug when selecting max ts (string). - [`7ed84ef`](https://github.com/langchain-ai/langgraphjs/commit/7ed84efbd380e6a034a77fdae42f17b1c12ae7b0) Remove console.log(). - [`588de4b`](https://github.com/langchain-ai/langgraphjs/commit/588de4bf3ee7ba2e84e55dc6feb1e99b69ded33a) Fix bug in put(). Add unit tests. - [`e840069`](https://github.com/langchain-ai/langgraphjs/commit/e840069cd7f78aeffb431ff683fa957f75a548fe) Fix format errors. - [`c0cf1a5`](https://github.com/langchain-ai/langgraphjs/commit/c0cf1a55379d3e140c7562b5567402c3b74fee02) Fix lint errors. - [`6cd62c7`](https://github.com/langchain-ai/langgraphjs/commit/6cd62c7cf1ed4d11f7d495e2d53da9b4d7d4d88b) Fix prettier format issues. - [`2d0a723`](https://github.com/langchain-ai/langgraphjs/commit/2d0a723bb02c556bebb9788fc6c808146b6cf753) Create NoopSerializer for MemorySaver checkpointer. - [`a4c7ec7`](https://github.com/langchain-ai/langgraphjs/commit/a4c7ec76a3d3bab01ec649b1323bfab67107e641) Implement SqliteSaver. - [`4a6fabd`](https://github.com/langchain-ai/langgraphjs/commit/4a6fabd345f1efbadae7edfdcf3c7f88f8b4e0a3) Implement put() and list() for SqliteSaver and add unit tests. ### 📊 Changes **13 files changed** (+1554 additions, -772 deletions) <details> <summary>View changed files</summary> 📝 `langgraph/package.json` (+3 -1) 📝 `langgraph/src/channels/base.ts` (+1 -19) 📝 `langgraph/src/checkpoint/base.ts` (+75 -6) 📝 `langgraph/src/checkpoint/index.ts` (+1 -0) 📝 `langgraph/src/checkpoint/memory.ts` (+92 -22) ➕ `langgraph/src/checkpoint/sqlite.ts` (+205 -0) 📝 `langgraph/src/graph/graph.ts` (+2 -1) 📝 `langgraph/src/graph/state.ts` (+2 -1) 📝 `langgraph/src/pregel/index.ts` (+7 -5) 📝 `langgraph/src/tests/channels.test.ts` (+1 -45) ➕ `langgraph/src/tests/checkpoints.test.ts` (+180 -0) 📝 `langgraph/src/tests/pregel.test.ts` (+5 -5) 📝 `yarn.lock` (+980 -667) </details> ### 📄 Description ### Summary To get checkpointing functionality up to parity with LangGraph's Python implementation, the `BaseCheckpointSaver` class needs to be updated to define `serde`, `getTuple()` and `list()`. Downstream dependencies (e.g. `MemorySaver`) are updated accordingly. ### Implementation 1. Move `deepCopy()` to `/checkpoint/base.ts`. 2. Update `BaseCheckpointSaver`: Define `serde` attribute. Define `getTuple()` and `list()` methods. Update methods to return `Promise`. 3. Update `MemorySaver`: Update `storage` attribute type. Update method implementations. 4. Implement `SqliteSaver`. ### To Do - [x] Implement `serde` in `MemorySaver`. - [x] Implement SQLite checkpointer and tests. - [x] Add unit tests for `getTuple()` and `list()`. - [x] Clean up the code a bit. - [x] Update SQLite schema to use `camel_case`. - [ ] ~Add changes for `SqliteSaver` from this PR: https://github.com/langchain-ai/langgraph/pull/332~ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 18:17:12 -05:00
yindo closed this issue 2026-02-15 18:17:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#503