Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langgraph_checkpoint_timeseries-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langgraph_checkpoint_timeseries-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_checkpoint_timeseries-0.1.0.tar.gz.

File metadata

File hashes

Hashes for langgraph_checkpoint_timeseries-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aee0b50aaa28ce4dc6d7432608246077f85ec56b99da0ff3d8f9052df0697e67
MD5 9e47d92b8231bda172522361e72a4fc1
BLAKE2b-256 05793e0964362b6b9b7f1f083d8a3818591f515eb7d235ddc2569996b66b0f4b

See more details on using hashes here.

File details

Details for the file langgraph_checkpoint_timeseries-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_checkpoint_timeseries-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f656e35d80dda0ae75e0c3ead002cf0310d7fe8029c272f4c6cd5566153d8d8
MD5 5c4f5748bd6667e3b4869e0e9e414cb1
BLAKE2b-256 74a61507779ea699af13d1f405c4d0386314862af0e213cff02e04da5049a9d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page