Set up: init, doctor, import
These commands prepare a machine and check that it can talk to Zyonix. init and doctor come
with the SDK, so they work even where only zyonix-sdk is installed.
zyonix init
Writes a starter zyonix.yaml in the current folder. With --agent it writes instructions for a
coding agent instead (see Coding agents and MCP).
zyonix init --service invoice-reader --endpoint https://zyonix.example.com
| Option | Default | What it does |
|---|---|---|
--service NAME | my-extraction-service | the service name written into the file |
--endpoint URL | http://localhost:8000 | the Zyonix address written into the file |
--path FILE | zyonix.yaml | where to write it |
--force | off | overwrite an existing file |
--agent | off | write ZYONIX_AGENT.md for a coding agent instead; changes no other file |
--agent-file FILE | ZYONIX_AGENT.md | with --agent: where to write the instructions |
Who may run it: anyone; it does not contact Zyonix (except --agent, which reads what it can).
Output: wrote zyonix.yaml. Set ZYONIX_API_KEY and run zyonix doctor. If the file exists and
you did not pass --force, it stops with exit code 1.
The file it writes is commented. The parts the CLI cares about:
service: invoice-reader
endpoint: https://zyonix.example.com
# ca_file: zyonix-ca.pem # only for a private certificate authority
mode: remote
capture: full # without this line, only content hashes leave your process
redaction:
presets: [email, phone, iban, card_number]
custom_patterns: []
max_payload_bytes: 524288
local_only: true
egress_allow: [zyonix.example.com] # your Zyonix host, when it is not a local address
# replay: # used by `zyonix test`, `zyonix replay` and `zyonix mcp`
# setup: myapp.zyonix_hooks:setup
# config_provider: myapp.zyonix_hooks:current_config
# config_arg: config
# python_path: [src]
The API key is never read from zyonix.yaml. Set it in ZYONIX_API_KEY or sign in with
zyonix auth login.
The replay: section
zyonix test, zyonix replay and the MCP server call your application's replayable step (a
function marked @zyonix.step(..., replayable=True)) on your machine with recorded inputs. The
replay: section tells them how to start your application.
| Key | What it is |
|---|---|
setup | module:function called once before any case runs: build clients, load configuration |
config_provider | module:function returning the configuration dict your code uses now (prompts, model settings) |
config_arg | the name of the step argument that receives that configuration (default config) |
python_path | extra import folders for your code (default: the current folder) |
Each can be overridden per command with --setup, --config-provider and --python-path
(repeatable).
Without config_provider, a recorded case runs with the configuration recorded when it failed, so
it tests the old configuration instead of your checkout. zyonix test refuses to run in that case
unless you pass --use-recorded-config.
zyonix test and zyonix replay send your step's outputs (redacted with your redaction
settings) to Zyonix, which judges them. They need capture: full; with hash_only they stop
before running anything.
zyonix doctor
Checks this machine's setup end to end: the configuration file, capture mode, the address and the data boundary, TLS and the CA file, that Zyonix is reachable, that the key is accepted, which LLM libraries are instrumented, and finally sends a small test trace and checks that it was stored.
zyonix doctor
zyonix doctor --json
| Option | What it does |
|---|---|
--config FILE | the zyonix.yaml to check |
--endpoint URL | override the address |
--api-key KEY | override ZYONIX_API_KEY |
--ca-file FILE | the CA bundle to trust |
--json | one JSON document (zyonix.doctor/1): the overall status and every check |
--no-color, --debug | as everywhere |
Who may run it: anyone. For the full check (the test trace is sent to Zyonix and looked up
there), set a cli or admin key in ZYONIX_API_KEY. The test run then appears in your runs list
with origin doctor (zyonix runs list --origin doctor).
Output: one line per check, marked ok, warning or failed, each failure with what to do, and
all checks passed at the end. The last check prints the test run's id and the command to inspect
it. Exit code 0 when everything passed (warnings included), 1 when a check failed.
With --json, stdout carries only the JSON document. Each check has an id (for example
backend.reachable, api_key, test_trace.stored), a status (ok, warn, fail), a
message and an action.
zyonix import
Backfills historical documents from a JSONL or CSV file as runs, so Zyonix can check them like live
traffic. Each record becomes one run with origin import.
zyonix import history.jsonl --schema Invoice --dry-run
zyonix import history.jsonl --schema Invoice
zyonix import export.csv --doc-id-field id --input-field ocr_text --output-field result
A JSONL line looks like this (the field names are the defaults):
{"doc_id": "INV-1042", "input_text": "Invoice no. 1042 ... Total 1,190.00", "output": {"invoice_no": "1042", "total": 1190.0}, "received_at": "2026-09-14T08:12:00Z", "source": "email"}
| Option | Default | What it does |
|---|---|---|
PATH | (required) | the file to import |
--format | from the file extension | jsonl or csv |
--doc-id-field | doc_id | the field with the document id (required in every record) |
--input-field | input_text | the document text (for example OCR output) |
--output-field | output | the record your pipeline produced (JSON text is parsed) |
--time-field | received_at | when the document was processed (ISO 8601; default: now) |
--source-field | source | where it came from |
--schema NAME | none | the schema name of the output records, for example Invoice |
--schema-version | none | the schema version |
--batch-size | 100 | runs per request |
--dry-run | off | read and validate the file, count the runs, send nothing |
--legacy-ids | off | only to re-import a file that zyonix 0.1.8 or earlier already imported into this agent |
--json | off | print the counts as JSON (problems with single records still go to stderr) |
--config, --endpoint, --api-key, --ca-file | as everywhere |
Who may run it: an API key that can send traces (cli, admin or sdk) in ZYONIX_API_KEY
or --api-key. Your saved session is not used by this command.
Good to know:
- Importing the same file twice creates no duplicates: each run's id is derived from the agent, the document id and the time.
- Data goes through the same redaction as live traffic, following
captureandredactioninzyonix.yaml. Withcapture: hash_only, only hashes are sent and the imported documents cannot be checked.
Output: imported 120 run(s); 0 failed; 0 invalid record(s) (or validated ... with
--dry-run), then a Next block pointing to zyonix runs --origin import and zyonix findings.
Each record that could not be read is reported on stderr as record N: skipped: <reason>.
Exit code: 0 when every record was sent, 1 when some records were invalid or could not be
sent (or tracing is off because no key is set), 2 when the file could not be read or the key was
rejected.