Skip to main content

Tests Build License Python Format PyPi Mypy Ruff security: bandit

system-one

A vendor-neutral SDK for System One models. One contract — ask(state, questions) -> answers — over three question primitives (noul, choice, score). Switching providers is one config object, not a code change.

These are decision models, not chat models: no messages, no streaming, no temperature.

Installation

pip install "system-one[http]"   # hosted providers
pip install "system-one[onnx]"   # local, in-process

Usage

from system_one import SystemOne, TypesafeConfig

with SystemOne(TypesafeConfig()) as agent:  # reads $SYSTEM_ONE_API_KEY
    response = agent.ask(
        "Customer is furious about a double charge.",
        {
            "urgent": {"type": "noul", "instructions": "Does this need a human now?"},
            "topic": {
                "type": "choice",
                "instructions": "Which queue?",
                "criteria": ["billing", "technical", "other"],
            },
            "severity": {
                "type": "score",
                "instructions": "How severe?",
                "criteria": ["minor", "normal", "major", "critical"],
            },
        },
    )

print(response.nouls["urgent"].noul, response.nouls["urgent"].confidence)
print(response.choices["topic"].choice, response.choices["topic"].probabilities)
print(response.scores["severity"].score)

AsyncSystemOne has the same shape and the same method names, awaited: await agent.ask(...), await agent.close(), async with.

Configuration

All settings come from SYSTEM_ONE_* environment variables or a .env file, and any of them can be set in code instead: SystemOne(HTTPConfig(..., timeout=30)).

Variable Default Notes
SYSTEM_ONE_BACKEND http http or onnx
SYSTEM_ONE_MODEL overrides whatever the config would use
SYSTEM_ONE_BASE_URL required by plain http; the presets set their own
SYSTEM_ONE_PATH /v1/systemone
SYSTEM_ONE_API_KEY required by TypesafeConfig / OpenRouterConfig
SYSTEM_ONE_TIMEOUT 10.0 seconds
SYSTEM_ONE_MAX_RETRIES 2 408, 429, 5xx only
SYSTEM_ONE_ONNX_DIR onnx holds <model>.onnx, <model>.json, tokenizer/

Vendor choice is a config class, not a string:

from system_one import (
    HTTPConfig,
    ONNXConfig,
    OpenRouterConfig,
    SystemOne,
    TypesafeConfig,
)

SystemOne(TypesafeConfig())  # hosted jev, $SYSTEM_ONE_API_KEY
SystemOne(OpenRouterConfig())  # same body, different endpoint
SystemOne(HTTPConfig(base_url="https://my-host", model="mine"))
SystemOne(ONNXConfig())  # local graph, no network, no key

Backend-specific calls stay reachable through agent.backend. Tests can inject one directly: SystemOne(using=FakeBackend()).

Running locally

The onnx backend runs a decision model in-process — no network, no API key, no torch at runtime. The weights come from laya (convaiinnovations/laya), in the layout the backend reads:

pip install "system-one[onnx,hub]"
system-one fetch --out-dir onnx   # --variant fp32|int8|fp16, --name sets the base name

That writes onnx/laya.onnx (≈1.6 GB fp32), onnx/laya.json and onnx/tokenizer/ — no torch, no tracing. To use another laya variant or your own model, write a spec and run system-one export examples/export/laya-english.yaml; that needs system-one[export]. Unset, SYSTEM_ONE_MODEL is whatever the backend serves — laya here — so a local run only sets it for a differently named graph. Nothing leaves the machine:

SYSTEM_ONE_BACKEND=onnx
SYSTEM_ONE_ONNX_DIR=onnx   # default
SYSTEM_ONE_MODEL=laya      # the file base name in that directory
with SystemOne(ONNXConfig(model="laya")) as agent:
    response = agent.ask(
        "The site is down.",
        {"outage": {"type": "noul", "instructions": "Is there an outage?"}},
    )

Full walkthrough — fetch vs export, variants, several models in one directory, verification, troubleshooting: docs/usage/local-model.md.

Errors

SystemOneError                 # catch this
├── APIError                   # non-2xx; .status .body .retry_after
│   └── AuthenticationError    # 401/403, never retried
└── APIConnectionError
    └── APITimeoutError

A malformed response body raises pydantic's ValidationError.

Development

uv sync --all-extras
uv run pytest
uv run pre-commit run --all-files

Tests needing the ONNX artifacts skip themselves when onnx/laya.onnx is absent (SYSTEM_ONE_ONNX_DIR and SYSTEM_ONE_MODEL override where they look). scripts/check_onnx_parity.py checks the graph against the reference laya implementation and needs the export extra plus the real weights.

Release files for system-one 0.1.0

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

Source distribution (sdist)

Source distribution for system-one 0.1.0
File Size Uploaded
system_one-0.1.0.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for system-one 0.1.0
File Interpreter ABI Platform
system_one-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.1 kB

Release files / system_one-0.1.0.tar.gz

Download URL system_one-0.1.0.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
09a0b9f1df244fe2a871c03619de91cb9d88c7dd2307bd84cd7761b65abcb853
BLAKE2b-256 checksum
How to use checksums
85116491ed7983f3021f09e054580272af3c7c797ff9b19beee4761feefda42e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / system_one-0.1.0-py3-none-any.whl

Download URL system_one-0.1.0-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
539291a5ca88746cbccf922077544d71a8a6948d65ae197c6fd1b59cabfaf8db
BLAKE2b-256 checksum
How to use checksums
37b72e84b75eaac523ffe2012f5bf973a7fae784b5aeb8693e0acaf7f7ced948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release files

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