> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aion.to/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkpointing

> Checkpoint behavior for LangGraph agents in the Python SDK.

## Default Behavior

* LangGraph adapter uses memory checkpointing by default.
* If `POSTGRES_URL` is configured and database initialization succeeds, the adapter can use
  PostgreSQL-backed checkpointing.
* During plugin initialization, checkpointer tables are set up when needed.

## Operational Guidance

* Use memory checkpointing for local development and simple test flows.
* Use PostgreSQL checkpointing for durable state across restarts and distributed deployments.
* Validate database connectivity before starting production workloads.

## PostgreSQL Setup

Under `aion serve` the adapter attaches the checkpointer itself, and
`[langgraph-server]` covers Postgres checkpointing. Point it at a database and
it switches backends:

```bash theme={null}
# .env
POSTGRES_URL=postgresql://user:password@localhost:5432/dbname
```

Without `POSTGRES_URL` the checkpointer is in-memory. With it set, the
checkpointer is PostgreSQL: if the database cannot be reached or the
checkpointer fails to initialize, startup fails with an error. The startup logs
name the backend it chose.

Return the graph uncompiled — a `StateGraph`, or a callable that returns one.
Aion compiles it and attaches the checkpointer for you. A graph that arrives
already compiled is used as it is, and keeps whichever checkpointer it was
compiled with, so `POSTGRES_URL` has no effect on it.
