[PR #1355] [CLOSED] feat(checkpoint): add mysql checkpoint #1399

Closed
opened 2026-02-15 20:15:37 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1355
Author: @postbird
Created: 7/7/2025
Status: Closed

Base: mainHead: feat-checkpoint-mysql


📝 Commits (1)

  • f8ea777 feat(checkpoint): add mysql checkpoint

📊 Changes

19 files changed (+2256 additions, -2 deletions)

View changed files

libs/checkpoint-mysql/.env.example (+6 -0)
libs/checkpoint-mysql/.eslintrc.cjs (+68 -0)
libs/checkpoint-mysql/.gitignore (+7 -0)
libs/checkpoint-mysql/.prettierrc (+19 -0)
libs/checkpoint-mysql/.release-it.json (+13 -0)
libs/checkpoint-mysql/LICENSE (+21 -0)
libs/checkpoint-mysql/README.md (+101 -0)
libs/checkpoint-mysql/docker-compose.yml (+16 -0)
libs/checkpoint-mysql/langchain.config.js (+21 -0)
libs/checkpoint-mysql/package.json (+86 -0)
libs/checkpoint-mysql/src/index.ts (+869 -0)
libs/checkpoint-mysql/src/migration.sql (+42 -0)
libs/checkpoint-mysql/src/models.ts (+240 -0)
libs/checkpoint-mysql/src/tests/checkpoints.int.test.ts (+405 -0)
libs/checkpoint-mysql/tsconfig.cjs.json (+9 -0)
libs/checkpoint-mysql/tsconfig.json (+24 -0)
libs/checkpoint-mysql/turbo.json (+12 -0)
libs/checkpoint-mysql/vitest.config.js (+36 -0)
📝 yarn.lock (+261 -2)

📄 Description

Add a new checkpoint implementation based on Mysql.

Follow up the table structure of checkpoint-postgresql, adding the adaptation for mysql.

I passed all the tests using Vitest's test scripts and conducted actual application tests for the local agent (including human-in-the-loop).

For usage:

import { MySQLSaver } from "@langchain/langgraph-checkpoint-mysql";

const writeConfig = {
  configurable: {
    thread_id: "1",
    checkpoint_ns: "",
  },
};
const readConfig = {
  configurable: {
    thread_id: "1",
  },
};

// you can optionally pass a configuration object as the second parameter
const checkpointer = MySQLSaver.fromConnString("mysql://...");

// or you can initialize the sequelize instance first
// const sequelize = new Sequelize({
//   database: 'testdb',
//   username: 'root',
//   password: '123456',
//   host: '127.0.0.1',
//   port: 3306,
//   dialect: 'mysql',
// });

// const checkpointer = new MySQLSaver(sequelize);

// You should call .setup() the first time you use the checkpointer:
await checkpointer.setup();

// or you can set the table manually by using the sql in `/src/migration.sql`

const checkpoint = {
  v: 1,
  ts: "2024-07-31T20:14:19.804150+00:00",
  id: "1ef4f797-8335-6428-8001-8a1503f9b875",
  channel_values: {
    my_key: "meow",
    node: "node",
  },
  channel_versions: {
    __start__: 2,
    my_key: 3,
    "start:node": 3,
    node: 3,
  },
  versions_seen: {
    __input__: {},
    __start__: {
      __start__: 1,
    },
    node: {
      "start:node": 2,
    },
  },
  pending_sends: [],
};

// store checkpoint
await checkpointer.put(writeConfig, checkpoint, {}, {});

// load checkpoint
await checkpointer.get(readConfig);

// list checkpoints
for await (const checkpoint of checkpointer.list(readConfig)) {
  console.log(checkpoint);
}

🔄 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/1355 **Author:** [@postbird](https://github.com/postbird) **Created:** 7/7/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat-checkpoint-mysql` --- ### 📝 Commits (1) - [`f8ea777`](https://github.com/langchain-ai/langgraphjs/commit/f8ea777a9f328dbb7b0e7b8fe195f6c3c290a643) feat(checkpoint): add mysql checkpoint ### 📊 Changes **19 files changed** (+2256 additions, -2 deletions) <details> <summary>View changed files</summary> ➕ `libs/checkpoint-mysql/.env.example` (+6 -0) ➕ `libs/checkpoint-mysql/.eslintrc.cjs` (+68 -0) ➕ `libs/checkpoint-mysql/.gitignore` (+7 -0) ➕ `libs/checkpoint-mysql/.prettierrc` (+19 -0) ➕ `libs/checkpoint-mysql/.release-it.json` (+13 -0) ➕ `libs/checkpoint-mysql/LICENSE` (+21 -0) ➕ `libs/checkpoint-mysql/README.md` (+101 -0) ➕ `libs/checkpoint-mysql/docker-compose.yml` (+16 -0) ➕ `libs/checkpoint-mysql/langchain.config.js` (+21 -0) ➕ `libs/checkpoint-mysql/package.json` (+86 -0) ➕ `libs/checkpoint-mysql/src/index.ts` (+869 -0) ➕ `libs/checkpoint-mysql/src/migration.sql` (+42 -0) ➕ `libs/checkpoint-mysql/src/models.ts` (+240 -0) ➕ `libs/checkpoint-mysql/src/tests/checkpoints.int.test.ts` (+405 -0) ➕ `libs/checkpoint-mysql/tsconfig.cjs.json` (+9 -0) ➕ `libs/checkpoint-mysql/tsconfig.json` (+24 -0) ➕ `libs/checkpoint-mysql/turbo.json` (+12 -0) ➕ `libs/checkpoint-mysql/vitest.config.js` (+36 -0) 📝 `yarn.lock` (+261 -2) </details> ### 📄 Description Add a new checkpoint implementation based on Mysql. Follow up the table structure of `checkpoint-postgresql`, adding the adaptation for mysql. I passed all the tests using Vitest's test scripts and conducted actual application tests for the local agent (including human-in-the-loop). For usage: ```ts import { MySQLSaver } from "@langchain/langgraph-checkpoint-mysql"; const writeConfig = { configurable: { thread_id: "1", checkpoint_ns: "", }, }; const readConfig = { configurable: { thread_id: "1", }, }; // you can optionally pass a configuration object as the second parameter const checkpointer = MySQLSaver.fromConnString("mysql://..."); // or you can initialize the sequelize instance first // const sequelize = new Sequelize({ // database: 'testdb', // username: 'root', // password: '123456', // host: '127.0.0.1', // port: 3306, // dialect: 'mysql', // }); // const checkpointer = new MySQLSaver(sequelize); // You should call .setup() the first time you use the checkpointer: await checkpointer.setup(); // or you can set the table manually by using the sql in `/src/migration.sql` const checkpoint = { v: 1, ts: "2024-07-31T20:14:19.804150+00:00", id: "1ef4f797-8335-6428-8001-8a1503f9b875", channel_values: { my_key: "meow", node: "node", }, channel_versions: { __start__: 2, my_key: 3, "start:node": 3, node: 3, }, versions_seen: { __input__: {}, __start__: { __start__: 1, }, node: { "start:node": 2, }, }, pending_sends: [], }; // store checkpoint await checkpointer.put(writeConfig, checkpoint, {}, {}); // load checkpoint await checkpointer.get(readConfig); // list checkpoints for await (const checkpoint of checkpointer.list(readConfig)) { console.log(checkpoint); } ``` --- <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 20:15:37 -05:00
yindo closed this issue 2026-02-15 20:15:37 -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#1399