client.export in the Python SDK.
What’s exportable
GET /api/v1/export (with your project’s x-api-key) returns a manifest of every entity with
live row counts. GET /api/v1/export/<entity> streams the rows, one JSON object per line, in
exactly the stored shape (timestamps as ISO-8601):
Connector secrets are redacted. Bearer tokens live in agent-connector header values,
so the export keeps the header keys but replaces every value with
***redacted*** - and
does the same to credentials embedded in the connector URL (userinfo and every query-string
value). After a restore, re-enter the secrets - same as provider API keys, which are
excluded from the export entirely. Webhook URLs in rules, monitor-profiles, and
alert-rules get the same treatment - userinfo, query values, and the path tail after the
first segment are masked - and an alert rule’s PagerDuty routing key is exported masked.
External-scorer URLs in custom-evaluators keep their path (it is the scorer’s route, not a
secret) and only lose userinfo and query values./export manifest:
GET /api/v1/export/project-settings returns the project row’s own behavior knobs (retention,
thresholds, topics sampling, enabled built-in patterns) as one NDJSON line, with the apiKey
stripped - the export stream is never the surface that hands the credential out. Fetch it
alongside the entity dump if you want a complete picture of the project.
Exporting
dump(since=...) moves only the delta for most entities. The one caveat:
signals filters on lastSeenAt, so a long-lived signal that keeps re-firing reappears in
each incremental.
A failed export never truncates silently: if the stream breaks mid-flight the engine destroys
the socket, so the client sees a broken transfer instead of a clean end. Treat a truncated
.ndjson file as a failed backup and re-run the export.
Restore runbook
There are three supported restore paths: database-level restore, replay through ingest, and dataset import. There is deliberately no blind row-level import endpoint: one would bypass the engine’s invariants (span dedupe, id uniqueness, derived agent rows) and could corrupt a live project silently.Path 1: database-level (full instance restore)
In the SQLite and Postgres tiers the engine owns exactly one database; restoring it restores everything, including auth and settings.- SQLite (default): stop the engine, copy
$AGENTX_HOME/agentx.dbback into place, start the engine. For hot backups usesqlite3 agentx.db ".backup backup.db"which is safe while the engine runs. - Postgres: standard
pg_dump/pg_restore(or your provider’s point-in-time recovery). The engine runs its own migrations at boot, so restoring an older dump into a newer engine is supported; the reverse is not. - Enterprise tier (Postgres + ClickHouse): the control plane is the Postgres backup above;
spans live in ClickHouse and are append-only, so incremental strategies work well - a native
format dump (
SELECT * FROM agentx_spans FORMAT Native),clickhouse-backup, or volume snapshots. Restore into a fresh table (the engine creates it on boot) withINSERT INTO agentx_spans FORMAT Native.
Path 2: replay (project-level, cross-instance migration)
NDJSON exports replay through the normal ingest surface into any project on any instance:feedback, outcomes) replays the same way through client.feedback / client.outcomes.
Note what replay preserves and what it does not: content, sessions, span trees, and metadata
survive; engine-assigned row ids and createdAt are newly assigned on the target (the original
timestamps remain inside the exported file if you need them).
Path 3: dataset import & delete
Datasets get a first-class replay path of their own:POST /api/v1/evaluate/datasets/import
takes a row from the datasets NDJSON export, wrapped as {"dataset": {...}}, and recreates
it - cases, grading config, similarity flags - as a new dataset with fresh ids (201). It
is a copy, never an in-place restore, so importing can’t clobber a live dataset:
Suggested schedule
- Nightly:
client.export.dump(dir, since=<24h ago>)to object storage - the incremental NDJSON is your audit-friendly, vendor-neutral copy. - Weekly: database-level backup (SQLite
.backupfile orpg_dump) - the fast full-restore path. - Before upgrades: database-level backup, always; the engine migrates forward only.

