LangGraph Checkpointer is used to persist Agent execution state, supporting HITL (Human-in-the-Loop) interrupt recovery and session persistence.
1. Overview
1.1 Role of Checkpointer
1.2 Differences from Other Components
2. Solution Comparison
2.1 Storage Solution Options
2.2 Recommendation: PostgresSaver
Rationale:- We already have a PostgreSQL database (Supabase/Drizzle), no additional dependencies required
- Officially supported by LangGraph, stable and reliable
- Acceptable latency (5-20ms)
- Checkpoint history can be queried via SQL for easy debugging
3. Implementation Plan
3.1 Replace DrizzleCheckpointSaver with PostgresSaver
Use the official LangGraphAsyncPostgresSaver, connecting to the database via the DATABASE_URL environment variable. During initialization, setup() is automatically called to create the required database tables.
3.2 Database Table Structure
PostgresSaver automatically creates acheckpoints table with the following key fields:
thread_id- Session identifiercheckpoint_id- Checkpoint identifierparent_checkpoint_id- Parent checkpoint identifiercheckpoint- Checkpoint data (JSONB)metadata- Metadata (JSONB)created_at- Creation timestamp
(thread_id, checkpoint_id), with indexes on thread_id and created_at.
4. HITL Workflow
5. Migration Steps
5.1 Migrating from DrizzleCheckpointSaver to PostgresSaver
- Install dependencies - Install
langgraph-checkpoint-postgres>=1.0.0 - Modify base_service.py - Replace DrizzleCheckpointSaver references with AsyncPostgresSaver
- Update get_checkpointer method - Initialize using
AsyncPostgresSaver.from_conn_string() - Run database migration - PostgresSaver will automatically create the required table structure
- Remove old code - Delete DrizzleCheckpointSaver and related Next.js APIs