Checkpointing (persistent memory)
Checkpointing gives an agent persistent conversation memory across separate abt run or abt dispatch invocations. By default every run starts with an empty thread — checkpointing changes that so the second call picks up where the first left off.
Backends
| Name | Description | Extra required |
|---|---|---|
memory |
In-process. Default. Resets on process exit. | (none) |
sqlite |
Persistent local SQLite file. | uv pip install "abt-core[checkpoint-sqlite]" |
bedrock_agentcore |
AWS Bedrock AgentCore memory. ⚠ Don't use it with external approvals: langchain-aws#837 drops pending tool_calls on resume. Use sqlite or dynamodb instead. |
uv pip install "abt-core[checkpoint-bedrock]" |
dynamodb |
AWS DynamoDB. Single unified table, native async, optional TTL/compression/S3 offloading. Recommended for multi-instance deployments. | uv pip install "abt-core[checkpoint-dynamodb]" |
| plugin | Any backend registered via the abt.checkpoint_backends entry-point group. |
plugin package |
For DynamoDB config, Bedrock setup, plugin authoring, and SDK usage: Checkpoint backends.
Quick start: multi-turn chat with SQLite
# Turn 1 — introduce yourself
abt run -s chat -p "My name is Alice and I love jazz." \
--checkpoint-backend sqlite \
--thread-id my-chat-session
# Turn 2 (new process) — the agent remembers you
abt run -s chat -p "What do you know about me?" \
--checkpoint-backend sqlite \
--thread-id my-chat-session
Use the same --thread-id to continue a thread across calls.
execute and checkpoint.is_first_turn() in Jinja
Two Jinja globals are available in agent system prompts and prompts/*.md, borrowed from
dbt-core's execute / is_incremental():
| Global | Meaning |
|---|---|
execute |
True when this compile is for a real invocation (abt run / abt dispatch); False for compile-only commands (abt compile / test / doctor). |
checkpoint.is_first_turn() |
True when the resolved thread has no prior saved checkpoint state. Always True when execute is False. |
checkpoint.exists() |
The inverse of is_first_turn(). |
{% if checkpoint.is_first_turn() %}
Hi! I don't think we've talked before — what can I help with?
{% else %}
Welcome back — picking up where we left off.
{% endif %}
Both globals are resolved once, before compiling — some limitations follow from that:
- Only CLI flags (
--checkpoint-backend,--thread-id,--ephemeral), environment variables, andconfig.checkpoint:inabt.yamlare visible. An agent's owncheckpoint:frontmatter thread-id is parsed later in the workflow, so it's not consulted. - When the thread-id can't be determined this early (e.g. it only comes from a source-derived
key or agent frontmatter),
checkpoint.is_first_turn()defaults toTrue. Same if the backend itself fails to respond — check the console/log for a[checkpoint]error. abt watchis unaffected: it resolves a thread-id up front and passes it toabt dispatchas an explicit--thread-id, which is visible pre-compile.- For
abt dispatch -s <workflow>, a workflow node never writes its checkpoint under the workflow's own bare thread-id — each node keeps its own conversation at{thread_id}::{node}. The peek therefore checks the workflow's entry agent node (the same node the approval-confirmation gate keys off of) instead of the bare thread-id.
CLI flags
Both abt run and abt dispatch accept these flags:
| Flag | Description |
|---|---|
--checkpoint-backend NAME |
Select the backend (memory, sqlite, bedrock_agentcore, dynamodb, or a plugin name). |
--thread-id TEXT |
Explicit thread identifier. Overrides source-derived and YAML values. |
--ephemeral |
Force in-memory (memory) backend for this invocation regardless of other config. |
Environment variables
| Variable | Role |
|---|---|
ABT_CHECKPOINT_BACKEND |
Backend name. Overrides abt.yaml and agent frontmatter. --checkpoint-backend and --ephemeral override it in turn. See precedence. |
ABT_CHECKPOINT_SQLITE_PATH |
Path to the SQLite database file (default: <workspace>/target/checkpoint/checkpoints.sqlite). |
ABT_CHECKPOINT_BEDROCK_MEMORY_ID |
Bedrock AgentCore memory resource ID. |
ABT_CHECKPOINT_BEDROCK_ACTOR_ID |
Bedrock AgentCore actor (user) ID. |
ABT_CHECKPOINT_BEDROCK_REGION |
AWS region for Bedrock AgentCore (overrides AWS_REGION). |
ABT_CHECKPOINT_DYNAMODB_TABLE |
Unified checkpoint table name (DynamoDB backend). |
ABT_CHECKPOINT_DYNAMODB_REGION |
AWS region for the DynamoDB checkpoint table. |
ABT_CHECKPOINT_DYNAMODB_ENDPOINT |
Custom DynamoDB endpoint (e.g. DynamoDB Local, moto). |
ABT_CHECKPOINT_DYNAMODB_TTL_SECONDS |
Seconds until DynamoDB auto-deletes a checkpoint row. |
ABT_CHECKPOINT_DYNAMODB_COMPRESSION |
1 / true to zstd-compress checkpoint payloads. |
Agent frontmatter (checkpoint: block)
Save this as agents/assistant.md:
---
name: assistant
description: A chat assistant that remembers earlier turns.
checkpoint:
backend: sqlite
thread_id: "my-stable-thread" # optional; see thread-id resolution below
primary_source: slack_thread # optional; use only this source's key as thread-id
config:
path: ".checkpoints/assistant.db" # backend-specific config
---
You are a helpful assistant. Answer in one short paragraph.
checkpoint: is an entry-agent-only field — read only from the dispatch
entry agent, never cascaded from an upstream subagents: dependency.
| Field | Description |
|---|---|
backend |
Backend name. Overrides project YAML; overridden by ABT_CHECKPOINT_BACKEND and --checkpoint-backend. |
thread_id |
Explicit thread id. Supports {{ var('…') }} at dispatch time. |
primary_source |
Pin thread-id derivation to this source name only. |
config |
Backend-specific config map. Merged over project YAML config; env-var config wins on conflict. |
Configuration precedence
Layers are merged from lowest to highest priority:
- Built-in default (
memorybackend, no thread-id;abt chatdefaults tosqliteinstead) config.checkpoint:block inabt.yaml(project-level defaults)checkpoint:block in the dispatch entry agent's own frontmatter (entry-agent-only — never cascaded from asubagents:dependency; for a workflow, its first agent node)- Environment variables (
ABT_CHECKPOINT_BACKEND,ABT_CHECKPOINT_SQLITE_PATH, …) - CLI flags (
--checkpoint-backend,--thread-id,--ephemeral)
abt run, abt dispatch and abt chat all resolve through these same layers.
Project-level defaults live under config: like other project settings:
# abt.yaml
config:
checkpoint:
backend: sqlite
config:
path: ".checkpoints/default.db"
Limits on long conversations
Every message on a thread is a new turn, and guardrails start fresh for each one: recursion_limit, model_call_limit, tool_call_limit, run_timeout, loop_detection, progress_tracker and token_budget. These are middleware, configured as described in Middleware — configuration reference. A chatty Slack thread therefore never runs out of budget.
A retried abt watch dispatch counts as a new turn too, as does a workflow node that loops back.
A run that pauses for an approval and resumes is still the same turn: it keeps the tool-call counts and token total it had when it paused.
To cap the whole conversation instead of each turn, use token_budget with scope: thread, token_budget_scope: thread in a workflow, or ABT_TOKEN_BUDGET_SCOPE=thread for every agent. See token_budget.
Thread-id resolution
A thread-id scopes which conversation history is loaded and saved. Resolution (first non-empty wins):
- Explicit —
--thread-idflag orcheckpoint.thread_idin YAML. - Source keys — non-
Nonekeys returned by source adapters, sorted alphabetically and joined with|. Example:slack:C01234567:1234567890.123. - Agent name — used only for the
memorybackend (ephemeral; never persists).
If a persistent backend is selected and no thread-id can be derived, the run fails (after a Python traceback, the last line reads ERROR: Agent invocation failed: Backend 'sqlite' requires a thread_id but none could be derived. Pass --thread-id, declare a source with a thread_key, or use --ephemeral.). Pass --thread-id explicitly, configure a source that provides a thread_key, or pass --ephemeral to fall back to the in-memory backend.
Triggered runs
abt watch dispatches with --thread-id {source_type}:{scope_id}:{thread_id} taken from the event
itself — for Slack the same slack:C01234567:1234567890.123 the slack_thread source would derive.
Being the CLI layer, it outranks a checkpoint.thread_id pinned in YAML. A threadless event (a cron
tick) dispatches --ephemeral instead. See
Watch > Checkpointing triggered runs.
primary_source pin
When an agent has multiple sources, set checkpoint.primary_source: <source_name> to use only that source's key:
checkpoint:
backend: sqlite
primary_source: slack_thread # ignore jira_ticket's key
SQLite backend
checkpoint:
backend: sqlite
config:
path: ".checkpoints/my_agent.db" # relative to project root; or absolute
Or via environment:
ABT_CHECKPOINT_BACKEND=sqlite \
ABT_CHECKPOINT_SQLITE_PATH=.checkpoints/sessions.db \
abt run -s assistant -p "…" --thread-id user-42
If path is omitted, the file is created at <workspace>/target/checkpoint/checkpoints.sqlite.
That path is under target/, so abt clean deletes it, together with the default approval database (target/approvals/approvals.sqlite). Every saved thread and pending approval is lost. A --stateless run keeps the default file in its temporary workspace, which is removed when the run ends. To keep a thread across cleans, set path outside target/, such as .checkpoints/my_agent.db above.