Skip to main content

zyonix-sdk

The Python SDK for Zyonix, a reliability layer for AI pipelines that produce structured results. The SDK records what your pipeline does (one trace per item, one span per step) and sends it to a Zyonix backend, which checks the results, explains failures and groups them into issues.

You need a running Zyonix backend, its address, and an sdk API key. Python 3.10 or newer.

Install

pip install zyonix-sdk                 # the SDK and the `zyonix doctor` / `zyonix init` commands
pip install "zyonix-sdk[openai]"       # + automatic recording of your LLM library's calls
pip install zyonix-cli                 # + the terminal commands that read results

If you received the packages as files or from another index, use the install commands that came with them instead, so that pip does not mix sources.

Extras for LLM libraries: openai, anthropic, langchain, llama-index, litellm, bedrock. Without one, steps, inputs, outputs and timing are still recorded, but model calls and token counts are not.

The SDK needs pydantic 2, httpx 0.27+ and OpenTelemetry 1.45+. In an existing environment run pip install --dry-run "zyonix-sdk[openai]" first: pip upgrades older versions without asking.

Quick start

import zyonix

zyonix.init(service="invoice-extractor", release="2026-10-13-a")  # once, at process start


@zyonix.step("ocr")
def ocr(document: dict) -> str:
    return document["content"]


@zyonix.step("extract", replayable=True)  # exactly one replayable step: the model call
def extract(document_text: str, config: dict) -> dict:
    return {"total": 120.0}  # your model call goes here


@zyonix.run(doc_id=lambda message: message["id"], source="example")  # one trace per item
def process(message: dict) -> dict:
    record = extract(ocr(message), {"model": "my-model"})
    zyonix.output(record, schema="Invoice", schema_version=1)  # the result that is checked
    return record


process({"id": "DOC-1", "content": "Total: 120.00"})
zyonix.flush(10)  # a short script must flush: telemetry is sent in the background

Configuration

zyonix.init() reads its settings from the environment, so no secret goes in your code:

Variable Meaning
ZYONIX_API_KEY an sdk key of your Zyonix deployment (without it, tracing is off)
ZYONIX_ENDPOINT the https:// address of the deployment
ZYONIX_CA_FILE a CA certificate (PEM) to trust for that address, for a private CA
ZYONIX_MODE remote (default with a key), local (write a JSONL file), console, off

Arguments to init() take precedence over ZYONIX_* variables, which take precedence over a zyonix.yaml file (zyonix init writes a commented starter). Check a setup with zyonix doctor.

Behaviour you can rely on

  • Fail-open. The SDK never raises into your code. If the backend is unreachable, your pipeline's output is identical and the telemetry is dropped and counted. An exception raised by your own code propagates unchanged.
  • Redaction before sending. E-mail addresses, phone numbers, IBANs and card numbers are masked in your process by default; add your own patterns in zyonix.yaml. capture: hash_only sends content hashes instead of content.
  • Fails closed on content. Full capture is never a default: content is sent only when a valid zyonix.yaml says capture: full or the code calls zyonix.init(capture="full"). No file, or a file that does not set capture, means hash-only; an invalid file disables tracing until it is fixed (zyonix doctor says why).
  • Bounded. Payloads, requests and the in-memory queue are capped in bytes.
  • OpenTelemetry-friendly. If your application already has a tracer provider, the SDK joins it and exports only its own traces.

Public API

init, run, step, tool, output, check, flag, feedback, flush, shutdown, current_trace_id, and for runtime repair guard, observe, RepairHint, GuardHold, GuardReport, last_guard_report (runtime repair needs the detection engine, which is not part of this package: without it the Guard stays inert and says so once).

  • @zyonix.tool("send_email"): a function that acts on the world (an API, a database, a message). zyonix test / zyonix replay never run it.
  • zyonix.check("saved", row is not None) and zyonix.flag("duplicate", detail): problems your own code noticed, reported under their own name. Anything whose name starts with an underscore is internal and may change.

What Zyonix is

A closed loop around AI pipelines: observe, detect failures with deterministic checks, diagnose a root cause, verify a fix on recorded cases, and monitor for recurrence. This package is the client side only; the backend is deployed separately.

Metadata

Release files for zyonix-sdk 0.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for zyonix-sdk 0.1.13
File Interpreter ABI Platform Actions
zyonix_sdk-0.1.13-py3-none-any.whl Python 3 none any Details for zyonix_sdk-0.1.13-py3-none-any.whl

Release files / zyonix_sdk-0.1.13-py3-none-any.whl

Download URL zyonix_sdk-0.1.13-py3-none-any.whl
Size 59.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccf865ddabcbceb04e8916620dadc4eefa37510b8c04911562ea751471ac8a51
BLAKE2b-256 checksum
How to use checksums
64582f778c7d5adcc8ae3c25634038eab75af495cd3d238cdb1052028a82c304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for zyonix-sdk 0.1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page