A powerful memory backend for LangGraph.js that provides short-term and long-term memory for your agents using flexible storage providers.
LangGraph-DB implements the checkpoint interfaces from LangGraph.js, featuring two core components:
Both components are implemented using an adapter pattern, allowing seamless integration with various storage backends while maintaining a consistent API.
npm install langgraph-db
import { RedisStore, RedisSaver } from "langgraph-db";
// Create a Redis store for persistent memory
const store = new RedisStore({
url: "redis://localhost:6379",
ttl: 3600, // Optional TTL in seconds
});
// Create a Redis checkpoint saver
const saver = new RedisSaver({
url: "redis://localhost:6379",
ttl: 3600, // Optional TTL in seconds
});
// Use with LangGraph
import { StateGraph, Checkpoint } from "langchain/langgraph";
const graph = new StateGraph({
channels: {
// Your channels here
},
// Configure with Redis persistence
checkpointer: new Checkpoint({
store,
saver,
}),
});
import { createClient } from "redis";
import { RedisStore, RedisSaver } from "langgraph-db";
// Use your existing Redis client
const redisClient = createClient({
url: "redis://localhost:6379",
});
// Pass the client directly to the store and saver
const store = new RedisStore({ client: redisClient });
const saver = new RedisSaver({ client: redisClient });
Provider | Status |
---|---|
Redis/Upstash | ✅ Available |
MongoDB | 🔜 Coming Soon |
Prisma | 🔜 Coming Soon |
Contributions are welcome! Feel free to open issues or submit pull requests.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)Distributed under the MIT License. See LICENSE
for more information.