State

Pause. Rewind. Resume.

Every superstep is a checkpoint boundary. That means time-travel debugging, human approval interrupts, and crash-safe agents are not features — they're free.

Backends

from agentmatic.checkpoint import (
    MemorySaver,           # in-process, for dev
    SQLiteSaver,           # single-host durability
    PostgresSaver,         # multi-host, transactional
    RedisSaver,            # fast, ephemeral
    S3Saver,               # cheap, geo-replicated
)

agent = Agent.builder("durable").llm(OpenAI()).checkpoint(S3Saver(bucket="my-agents")).build()

Checkpoint storage strategy: Use SQLite for single-host dev and small prod, Postgres when you need transactions and multi-host reads, Redis if you can lose state on a crash and need ultra-low latency, S3 when archival cost matters more than retrieval latency.

Time-travel

# Fork the graph from any prior superstep.
history = agent.get_state_history(thread_id="run-42")
checkpoint_id = history[3].config["configurable"]["checkpoint_id"]

# Replay from that point with new inputs.
result = agent.invoke(
    {"messages": [HumanMessage("Try again with a different approach.")]},
    config={"configurable": {"thread_id": "run-42", "checkpoint_id": checkpoint_id}},
)

Human-in-the-loop

agent = (Agent.builder("hitl")
    .llm(OpenAI())
    .tools([send_email, transfer_funds])
    .checkpoint(SQLiteSaver("agents.db"))
    .interrupt_before(["transfer_funds"])  # pause before risky tools
    .build())

# Run pauses at transfer_funds; check the proposed call.
state = await agent.ainvoke({"messages": [...]}, config={"configurable": {"thread_id": "t1"}})
print(state.next)  # ('transfer_funds',)

# Human approves; resume.
await agent.ainvoke(None, config={"configurable": {"thread_id": "t1"}})

Branching

Every checkpoint is immutable, so branching is just resuming with a new thread ID. Useful for A/B testing prompt changes against the same state, or letting users explore alternate continuations.

Format compatibility

Memory and SQLite checkpoints are wire-compatible with LangGraph's format — you can read existing LangGraph state in Agentmatic without migration. Postgres requires a one-line schema upgrade we ship in agentmatic.checkpoint.postgres.upgrade().

Ship your next agent in minutes, not weeks.

MIT licensed. Drop-in for LangGraph. Native SDKs in 5 languages. Battle-tested resilience primitives in the box.