Time-series optimized checkpointers for LangGraph using TimescaleDB and QuestDB
Project description
LangGraph Time-Series Checkpointers
Custom LangGraph checkpointer implementations optimized for Time-Series Databases. Drop-in replacements for PostgresSaver that store AI agent state in TimescaleDB or QuestDB for superior performance under concurrent and high-volume workloads.
Why Time-Series Memory?
Standard checkpointers (PostgresSaver) store state using row-level locking and WAL-based durability. This is ideal for simple apps, but becomes a bottleneck when you have:
- ๐ญ Multiple agents writing concurrently (fleet management, parallel pipelines)
- ๐ High-frequency state updates (trading bots, real-time monitoring)
- ๐ Long-running agents accumulating millions of checkpoints over weeks
Time-Series databases are purpose-built for these exact workloads.
Installation
pip install langgraph-checkpoint-timeseries
Supported Backends
1. TimescaleDB (TimescaleDBSaver)
Perfect for relational agent memory interspersed with IoT or metrics data. Uses UNLOGGED tables and pipeline mode for high-throughput.
2. QuestDB (QuestDBSaver)
Extremely high-throughput ingestion using timestamp(ts) PARTITION BY DAY. Ideal for write-heavy, append-only workloads.
Quick Start
TimescaleDB
from langgraph_checkpoint_timeseries import TimescaleDBSaver
# The checkpointer automatically configures database schema and hypertables on setup()
with TimescaleDBSaver.from_conn_string("postgresql://postgres:postgres@localhost:5432/postgres") as saver:
saver.setup()
# app = workflow.compile(checkpointer=saver)
QuestDB
from langgraph_checkpoint_timeseries import QuestDBSaver
with QuestDBSaver.from_conn_string("postgresql://admin:quest@localhost:8812/qdb") as saver:
saver.setup()
# app = workflow.compile(checkpointer=saver)
Benchmarks
Benchmarked against the standard PostgresSaver on the same hardware:
| Scenario | PostgresSaver | TimescaleDB | QuestDB | ๐ Winner |
|---|---|---|---|---|
| Sequential Writes (1K) | 192 ops/s | 179 ops/s | 170 ops/s | PostgresSaver |
| Concurrent Writes (15Tร200) | 186 ops/s | 470 ops/s | 489 ops/s | QuestDB |
| High-Volume Writes (5K) | 183 ops/s | 181 ops/s | 172 ops/s | PostgresSaver |
| History Query (list 100) | 2,569 ops/s | 457 ops/s | 404 ops/s | PostgresSaver |
Concurrent Writes โ Where TSDB Shines
PostgresSaver โโโโโโโโโโโโโโโ 186 ops/s
TimescaleDB โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 470 ops/s
QuestDB โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 489 ops/s
QuestDB is 2.6x faster and TimescaleDB is 2.5x faster than PostgresSaver under 15-thread concurrent write load.
When to Use This
| Use Case | Recommended Backend |
|---|---|
| Simple apps, prototyping | PostgresSaver |
| Multi-agent, high concurrency | TimescaleDBSaver |
| Maximum write throughput (IoT, trading) | QuestDBSaver |
| Full PostgreSQL ecosystem + time-series | TimescaleDBSaver |
๐ญ Multi-Agent / High-Concurrency Systems
When you have multiple AI agents writing state simultaneously (fleet of IoT monitoring agents, parallel customer service bots), TimescaleDB and QuestDB handle write contention far better than standard Postgres. Our benchmarks show ~3x throughput under 15-thread concurrent load.
๐ High-Frequency Decision Agents
Trading bots, real-time bidding agents, or any system making hundreds of decisions per second benefit from the optimized ingestion pipelines of time-series databases. UNLOGGED tables and disabled synchronous commit eliminate WAL overhead entirely.
๐ Long-Running Agents with Data Retention
Agents that run for weeks or months accumulate millions of checkpoints. Time-series databases offer efficient partition-based cleanup (DROP PARTITION) instead of expensive DELETE operations, keeping performance stable over time.
๐ Debugging & Compliance Auditing
When you need to answer "What was the agent thinking at 14:03:22?", time-series databases provide native timestamp-indexed queries. Correlate agent decisions with real-world events stored in the same database.
Examples
See the examples/ directory for practical demos:
- IoT Monitoring Agent (
examples/timescaledb_iot_agent.py) โ Streaming sensor data with time-series checkpointing - Algorithmic Trading Agent (
examples/questdb_trading_agent.py) โ High-frequency state updates and rapid decision preservation
License
MIT โ see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_checkpoint_timeseries-0.1.0.tar.gz.
File metadata
- Download URL: langgraph_checkpoint_timeseries-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee0b50aaa28ce4dc6d7432608246077f85ec56b99da0ff3d8f9052df0697e67
|
|
| MD5 |
9e47d92b8231bda172522361e72a4fc1
|
|
| BLAKE2b-256 |
05793e0964362b6b9b7f1f083d8a3818591f515eb7d235ddc2569996b66b0f4b
|
File details
Details for the file langgraph_checkpoint_timeseries-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_checkpoint_timeseries-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f656e35d80dda0ae75e0c3ead002cf0310d7fe8029c272f4c6cd5566153d8d8
|
|
| MD5 |
5c4f5748bd6667e3b4869e0e9e414cb1
|
|
| BLAKE2b-256 |
74a61507779ea699af13d1f405c4d0386314862af0e213cff02e04da5049a9d8
|