产品介绍

Inspect session databases

Read the session index, input/output bindings, and LangGraph checkpoints without changing records, and learn how to read the messages they saved. First confirm which DataAgent Home the running process uses, then inspect its files.

What each database stores

File and table Contents Purpose
runtime/sessions.sqlite → sessions User, thread, title, times, status, last run ID, and checkpoint ID Server session listing and continuation position
Same file → session_bindings output_dir and workspaces for (user_id, thread_id) Input and final output directory bindings
Same file → submitted_runs Only thread_id and run_id Duplicate run submission checks
runtime/checkpoints.sqlite → checkpoints Checkpoint and parent IDs, namespace, serialized graph state, and metadata Graph recovery and state reads
Same file → writes Tasks, channels, and serialized writes associated with checkpoints Intermediate step writes used in recovery

Neither database is a chat-message store. sessions.title is the first submitted text with whitespace collapsed and truncated to 100 characters; subsequent turns retain it. The index has no full conversation body. The checkpointer stores messages and other graph state, while artifacts and offloaded text can live outside SQLite.

Server uses a SQLite checkpointer. Direct SDK usage with create_agent(checkpointer=None) does not automatically create checkpoints.sqlite, although bindings can still be written to sessions.sqlite. The SDK does not maintain the Server's sessions or submitted_runs tables. Check the entry point and persistence settings before treating a missing file or table as an error.

Locate Home and open the files

Use the Server process's DATAAGENT_HOME, defaulting to ~/.dataagent. When the service is ready, conversation.home and conversation.user in GET /healthz help confirm the location. When the client and backend run on different machines, inspect the backend machine. Replace the absolute path below with the actual Home:

agent_home='/absolute/path/to/dataagent-home'
session_db="$agent_home/runtime/sessions.sqlite"
checkpoint_db="$agent_home/runtime/checkpoints.sqlite"
ls -l -- "$session_db" "$checkpoint_db"

The SQLite CLI examples use -readonly so a wrong path cannot create a new database. Replace every replace-with-thread-id and replace-with-checkpoint-id before running SQL. The example user ID is default.

sqlite3 -readonly -header -column "$session_db"

Inspect the actual structure at the prompt:

.tables
.schema sessions
.schema session_bindings
.schema submitted_runs

Inspect sessions, bindings, and submitted runs

List the user's recent sessions:

SELECT user_id, thread_id, title, status, updated_at,
       last_run_id, last_checkpoint_id
FROM sessions
WHERE user_id = 'default'
ORDER BY updated_at DESC, thread_id DESC
LIMIT 20;

Read one session's details and the actual timestamp storage types:

SELECT user_id, thread_id, status, last_run_id, last_checkpoint_id,
       created_at, typeof(created_at) AS created_storage,
       updated_at, typeof(updated_at) AS updated_storage
FROM sessions
WHERE user_id = 'default' AND thread_id = 'replace-with-thread-id';

Both times are UTC ISO 8601 text, such as 2026-11-27T10:00:00+00:00, rather than Unix seconds. Raw states include running, completed, error, interrupted, and waiting_for_input. A2A also uses internal waiting during human feedback; REST presents it as interrupted. A legacy complete value is rewritten to completed the next time the Server starts.

last_checkpoint_id is the recorded continuation position, not necessarily the last fully successful turn. Failure or cancellation can advance it when messages have been saved. last_run_id is a host run ID and cannot replace a checkpoint ID.

Look up bindings by both user and thread:

SELECT user_id, thread_id, output_dir, workspaces,
       typeof(workspaces) AS workspaces_storage
FROM session_bindings
WHERE user_id = 'default' AND thread_id = 'replace-with-thread-id';

workspaces is a JSON text array, for example [{"name":"inputs","path":"/srv/inputs"}]; output_dir is the absolute final output directory. Inspect these bindings without modifying them. An SDK session can have a binding without a Server index row.

List submitted runs:

SELECT thread_id, run_id
FROM submitted_runs
WHERE thread_id = 'replace-with-thread-id'
ORDER BY run_id;

There are no time, status, message, or result columns in this table. Sorting by ID does not establish submission order or conversation order. Also, sessions.thread_id is unique within one Home, so different users cannot occupy the same thread.

Check checkpoint presence and metadata

Exit the first CLI, then open the other database read-only:

.quit
sqlite3 -readonly -header -column "$checkpoint_db"
.tables
.schema checkpoints
.schema writes

The currently locked SQLite saver uses this schema:

Table Columns and key
checkpoints thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata; the first three form the primary key
writes thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value; the first five form the primary key

Count checkpoints for the thread by namespace:

SELECT checkpoint_ns, COUNT(*) AS checkpoint_count
FROM checkpoints
WHERE thread_id = 'replace-with-thread-id'
GROUP BY checkpoint_ns
ORDER BY checkpoint_ns;

The root graph namespace is the empty string ''; subgraphs can have nonempty namespaces. Do not combine their latest rows as though they addressed the same state.

Inspect recent root checkpoints and metadata. This query requires SQLite JSON functions:

SELECT checkpoint_id, parent_checkpoint_id, type,
       typeof(checkpoint) AS checkpoint_storage,
       length(checkpoint) AS checkpoint_bytes,
       typeof(metadata) AS metadata_storage,
       CASE WHEN json_valid(metadata) THEN json(metadata) END AS metadata_json
FROM checkpoints
WHERE thread_id = 'replace-with-thread-id' AND checkpoint_ns = ''
ORDER BY checkpoint_id DESC
LIMIT 10;

The default serializer stores checkpoint as binary data identified by type, usually msgpack. Although metadata is also declared BLOB, the saver writes UTF-8 JSON bytes. Common fields include source, step, and parents. step counts graph execution steps, not user turns. These tables have no separate created_at column.

Do not treat checkpoint or writes.value as JSON with CAST(... AS TEXT). Inspect typeof, the serialization type, and the actual encoding separately. If local SQLite lacks the required JSON functions or rejects JSON bytes, omit the metadata expression to read IDs, types, and lengths, then use the native interfaces below.

Check the index's last_checkpoint_id together with its thread and root namespace:

SELECT EXISTS (
    SELECT 1 FROM checkpoints
    WHERE thread_id = 'replace-with-thread-id'
      AND checkpoint_ns = ''
      AND checkpoint_id = 'replace-with-checkpoint-id'
) AS saved_checkpoint_exists;

1 means the composite key exists; 0 means it does not. A checkpoint ID or run ID alone is insufficient. No ATTACH is needed for this workflow: copy the thread and checkpoint IDs from the index.

Inspect writes for the same composite key without decoding message content:

SELECT task_id, idx, channel, type, length(value) AS value_bytes
FROM writes
WHERE thread_id = 'replace-with-thread-id'
  AND checkpoint_ns = ''
  AND checkpoint_id = 'replace-with-checkpoint-id'
ORDER BY task_id, idx;

These are task/channel writes, not one user message per row. The checkpoint tables have no user_id; SDK callers sharing a checkpointer must isolate threads themselves.

Read saved messages

With an existing Server, prefer session detail. Replace the URL and thread ID:

curl --fail-with-body --silent --show-error \
  http://127.0.0.1:8790/api/v1/sessions/replace-with-thread-id

The response's data contains session fields, AG-UI messages, pendingInteractions, and notice. GET does not start a new model run. It opens bindings, validates dependencies, and assembles the session graph before reading state. The read uses the index's saved checkpoint first, falling back to the latest root state only when no checkpoint ID is recorded. Reads during a run follow the same rule and can still show the preceding continuation. Detail has no message-count limit parameter; the session-list limit does not paginate messages. 404 means the session was not found for the server's user; a binding that cannot be opened can return 409. See the session detail contract.

Within an SDK host already connected to the same persistent checkpointer, let LangGraph reconstruct state. This snippet assumes an existing agent:

thread_id = "replace-with-thread-id"
config = {
    "configurable": {
        "thread_id": thread_id,
        "checkpoint_ns": "",
        "checkpoint_id": "replace-with-checkpoint-id",
    }
}
snapshot = await agent.graph_for(thread_id).aget_state(config)
messages = snapshot.values.get("messages", [])

Omit checkpoint_id to read the thread head when the index has no ID. See the host API for graph_for and its prerequisites. Saver get_tuple / aget_tuple returns the checkpoint, metadata, and pending writes, using the appropriate serializer for type. Raw channel_values can contain channel state requiring reconstruction; they are not necessarily a materialized, complete message list.

Do not create a new saver against a live database merely to inspect it read-only: the first SQLite saver read calls setup(), which includes WAL and table setup. For offline decoding, use a trusted, complete backup with the writer's saver, serializer, and graph definitions.

A checkpoint represents an execution step, not necessarily a finished turn. Summarization, trimming, and offloading also change effective messages. Concatenating every checkpoint's messages is incorrect, and the latest state need not contain a complete conversation transcript. Follow saved file paths for offloaded text. Read context compression alongside sessions and outputs; inspect per-run execution through traces.

Without the SQLite CLI

Python's standard library can open the same file with mode=ro. This lists actual tables and DDL, then queries the index without creating or updating the runtime database:

python3 - "$session_db" <<'PY'
import sqlite3
import sys
from contextlib import closing
from pathlib import Path

path = Path(sys.argv[1]).resolve(strict=True)
with closing(sqlite3.connect(path.as_uri() + "?mode=ro", uri=True)) as db:
    db.row_factory = sqlite3.Row
    for row in db.execute("SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name"):
        print(row["name"], row["sql"])
    for row in db.execute(
        "SELECT user_id, thread_id, status, last_checkpoint_id FROM sessions WHERE user_id=?",
        ("default",),
    ):
        print(dict(row))
PY

For checkpoints.sqlite, pass $checkpoint_db and replace the final query with a checkpoint SELECT above. In Python, replace placeholder IDs with ? and supply a parameter tuple. A bytes result does not imply corruption, nor that the value is JSON.

Consistency and backups

Read-only connections do not change business records, but the running service can still write. Separate queries against the two files are not a single point-in-time, cross-file snapshot. Record the thread, checkpoint, and inspection time rather than treating successive reads as strictly simultaneous.

Before backup or migration, stop backend and SDK writes for that Home first, and retain both databases, bindings, and artifacts referenced by state. checkpoints.sqlite uses WAL; copying only its actively written main file can omit committed data. Do not delete -wal / -shm to fix inspection results. See state and storage.

Implementation: session index, directory bindings, and session reads. The SQLite saver version is pinned in uv.lock.