这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: replace default MemorySaver with sqlite-based checkpointer; add multi-DB support #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ygbingo
Copy link

@ygbingo ygbingo commented Jul 16, 2025

📝 Description

This PR enhances the memory persistence mechanism in the graph builder by:

✅ Default Behavior

  • Replaces the default in-memory MemorySaver with an SQLite-based checkpointer using langgraph-checkpoint-sqlite.
  • SQLite runs in local :memory: mode for dev/testing, ensuring persistence without external services.

🛠️ Multi-Database Support

  • Introduces configurable support for several database backends for checkpointing:
    • PostgreSQL (langgraph-checkpoint-postgres)
    • MongoDB (langgraph-checkpoint-mongodb)
    • Redis (langgraph-checkpoint-redis)
  • Backend selection and connection string setup are now driven by conf.yaml:
    CHECKPOINTER_MEMORY:
      db_type: "postgres"        # or "sqlite", "mongo", "redis"
      db_uri: "postgresql://user:pass@localhost:5432/dbname"

🧱 Code Structure

  • Refactored builder.py to dynamically instantiate checkpointer based on config.
  • Reorganized app.py to use the unified graph builder pattern with the new checkpointer.

📘 Docs & Examples

  • Extended docs/configuration_guide.md with setup instructions for each supported DB.
  • Updated pyproject.toml and dependencies accordingly.

✅ Benefits

  • Persistent agent memory across sessions.
  • Flexible deployment in cloud or local environments.
  • Easy extension for future database types.

@WillemJiang
Copy link
Collaborator

@ygbingo Thanks for the contribution. Please use 'make format' to reformat the code and fix the unit test errors.
BTW, we may need to give the user choice of using in memory store or persistant checkpoint through the configuration.

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.

3 participants