Skip to content

feat: add LangGraph checkpointer with OceanBase persistence support#63

Open
knqiufan wants to merge 2 commits intooceanbase:mainfrom
knqiufan:feat/langgraph-checkpointer
Open

feat: add LangGraph checkpointer with OceanBase persistence support#63
knqiufan wants to merge 2 commits intooceanbase:mainfrom
knqiufan:feat/langgraph-checkpointer

Conversation

@knqiufan
Copy link

Summary

This PR implements the LangGraph checkpointer for OceanBase, migrating from the deprecated ChatMessageHistory pattern to the modern state-based persistence approach.

close #46

Changes

1. New OceanBaseCheckpointSaver class (langchain_oceanbase/checkpointer.py)

  • Implements BaseCheckpointSaver interface from LangGraph
  • Core methods: put(), get(), get_tuple(), list(), put_writes()
  • MySQL-compatible SQL adapted for OceanBase
  • 4 database tables: checkpoint_migrations, checkpoints, checkpoint_blobs, checkpoint_writes
  • Supports serialization/deserialization via JsonPlusSerializer

2. Deprecation warning for OceanBaseChatMessageHistory

  • Added DeprecationWarning in __init__ method
  • Points users to migration guide

3. Documentation (docs/migration_guide.md)

  • Explains why to migrate (state-based vs message-based)
  • Step-by-step migration instructions
  • Code comparison (old vs new pattern)
  • API reference and troubleshooting

4. Example (examples/langgraph_agent.py)

  • Demonstrates persistent conversation memory
  • Shows state recovery after restart
  • Multi-thread session isolation

5. Integration tests (tests/integration_tests/test_checkpointer.py)

  • Setup and table creation
  • Put/Get operations
  • List with filtering and limits
  • Delete thread
  • Version ID generation
  • Full LangGraph integration tests

Dependencies

  • Added langgraph-checkpoint >= 2.1.0, < 5.0.0 to pyproject.toml

@xxsc0529
Copy link
Contributor

@knqiufan Thank you for your contribution. Can you resolve the PR conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate ChatMessageHistory, migrate to LangGraph checkpointer

2 participants