LangChain has announced the stable release of LangGraph v0.2, marking a significant update with the introduction of new checkpointer libraries. These libraries aim to simplify the creation and customization of checkpointers, enhancing the resilience and functionality of large language model (LLM) applications, according to the LangChain Blog.
Why LangGraph v0.2 Was Developed
LangGraph's core feature is its built-in persistence layer, implemented through checkpointers. These checkpointers save the state of the graph at each step, enabling capabilities such as session memory, error recovery, human-in-the-loop features, and time travel. Since its inception, LangGraph has been designed to be database-agnostic, allowing users to implement their own checkpointer adapters.
However, there was no clear blueprint for users to create custom checkpointers for popular databases like Postgres, Redis, and MongoDB. LangGraph v0.2 addresses this gap by providing dedicated checkpointer libraries.
New Checkpointer Libraries in LangGraph v0.2
The new release includes a suite of checkpointer libraries, making it easier to create and customize checkpointers:
langgraph_checkpoint
: The base interface for checkpointer savers and serialization/deserialization.langgraph_checkpoint_sqlite
: An SQLite-based checkpointer ideal for local workflows and experimentation.langgraph_checkpoint_postgres
: An optimized Postgres checkpointer for production environments, now open-sourced for community use.
These implementations can be used interchangeably, allowing users to tailor their applications to their specific needs.
LangGraph Postgres Checkpointer for Production
The langgraph_checkpoint_postgres
implementation serves as a blueprint for creating optimized, production-ready checkpointers. It includes several optimizations, such as using Postgres pipeline mode to reduce database roundtrips and storing each channel value separately to minimize storage requirements.
Getting Started with LangGraph v0.2
To get started, users can import the necessary checkpointer interfaces and implementations using:
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.checkpoint.memory import MemorySaver
from langgraph.checkpoint.sqlite import SqliteSaver
from langgraph.checkpoint.postgres import PostgresSaver
SQLite and Postgres checkpointers require separate installations via pip install langgraph-checkpoint-sqlite
and pip install langgraph-checkpoint-postgres
, respectively. LangGraph checkpoint libraries follow semantic versioning, ensuring that breaking changes in the main library will result in corresponding major version updates for the checkpointer libraries.
Run Agents at Scale with LangGraph Cloud
LangGraph v0.2 also introduces LangGraph Cloud, a runtime environment designed for deploying agents at scale. LangGraph Cloud manages task queues, servers, and includes the robust Postgres checkpointer to handle concurrent users and large data states. It supports real-world interaction patterns such as double-texting, async background jobs, and cron jobs.
LangGraph Studio, a desktop app for visualizing and debugging agent trajectories, is now available for all LangSmith users. LangGraph Cloud is currently in open beta for Plus and Enterprise plan users.
Additional Changes in LangGraph v0.2
The latest version also includes several breaking changes and deprecations:
Breaking Changes
- Renaming of
thread_ts
andparent_ts
tocheckpoint_id
andparent_checkpoint_id
. - Re-exported imports are no longer possible due to the use of namespace packages.
- SQLite checkpointers have been moved to a separate library.
Deprecations
- Removal of
langgraph.prebuilt.chat_agent_executor.create_function_calling_executor
. - Removal of
langgraph.prebuilt.agent_executor
.
Conclusion
LangChain expresses gratitude to its community for their feedback and support. With LangGraph v0.2, users can expect easier customization and maintenance of checkpointer implementations, paving the way for more resilient and feature-rich LLM applications.
Image source: Shutterstock