Skip to main content

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
OptionDefaultWhat it does
--service NAMEmy-extraction-servicethe service name written into the file
--endpoint URLhttp://localhost:8000the Zyonix address written into the file
--path FILEzyonix.yamlwhere to write it
--forceoffoverwrite an existing file
--agentoffwrite ZYONIX_AGENT.md for a coding agent instead; changes no other file
--agent-file FILEZYONIX_AGENT.mdwith --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]
note

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.

KeyWhat it is
setupmodule:function called once before any case runs: build clients, load configuration
config_providermodule:function returning the configuration dict your code uses now (prompts, model settings)
config_argthe name of the step argument that receives that configuration (default config)
python_pathextra 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
OptionWhat it does
--config FILEthe zyonix.yaml to check
--endpoint URLoverride the address
--api-key KEYoverride ZYONIX_API_KEY
--ca-file FILEthe CA bundle to trust
--jsonone JSON document (zyonix.doctor/1): the overall status and every check
--no-color, --debugas 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"}
OptionDefaultWhat it does
PATH(required)the file to import
--formatfrom the file extensionjsonl or csv
--doc-id-fielddoc_idthe field with the document id (required in every record)
--input-fieldinput_textthe document text (for example OCR output)
--output-fieldoutputthe record your pipeline produced (JSON text is parsed)
--time-fieldreceived_atwhen the document was processed (ISO 8601; default: now)
--source-fieldsourcewhere it came from
--schema NAMEnonethe schema name of the output records, for example Invoice
--schema-versionnonethe schema version
--batch-size100runs per request
--dry-runoffread and validate the file, count the runs, send nothing
--legacy-idsoffonly to re-import a file that zyonix 0.1.8 or earlier already imported into this agent
--jsonoffprint the counts as JSON (problems with single records still go to stderr)
--config, --endpoint, --api-key, --ca-fileas 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 capture and redaction in zyonix.yaml. With capture: 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.