Skip to main content

sq-system-one Python SDK

Typed sync/async clients for native System One APIs (Jev, Drex, Laya) and the sq local relay. Python 3.11+.

uv add sq-system-one
export TYPESAFE_API_KEY=...
from systemone_sq import Client, Choice, Noul

questions = {
    "team": Choice("Who should handle this?", {
        "billing": "Payments and refunds",
        "support": "Technical problems",
    }),
    "urgent": Noul("Does this need immediate attention?"),
}
with Client(provider="jev") as client:
    result = client.evaluate("I was charged twice", questions)
    print(result.answers["team"])
    for result in client.batch(["Charged twice", "App crashed"], questions):
        print(result.answers)

Score("How severe?", ["Cosmetic", "Workaround available", "Blocking"] ) returns ScoreAnswer.score on 0..2; .scaled(100) explicitly rescales it. result.passes("team", confidence=0.9) gates on reported confidence. result.passes("urgent", threshold=0.8) gates on P(true); Noul has no confidence.

import asyncio
from systemone_sq import AsyncClient, Noul

async def main():
    async with AsyncClient(provider="drex") as client:
        async for result in client.batch(["urgent", "routine"], {"urgent": Noul("Is it urgent?")}):
            print(result.answers)

asyncio.run(main())

Both clients read the CLI's TOML at ~/.config/sq/config.toml on Linux, or config="path.toml". Environment overrides: SQ_CONFIG, SQ_PROVIDER, SQ_BASE_URL, SQ_MODEL. Credentials: TYPESAFE_API_KEY, NACE_API_KEY, LAYA_API_KEY, or configured api_key_env. api_key= is also supported for a direct primary provider. Supply an origin without a path for base_url=. The SDK supports string instructions and string/null choice descriptions, string score levels, and optional true/false Noul criteria.

from systemone_sq import Client, default_socket

with Client(socket=default_socket()) as client:
    result = client.evaluate("some input", questions)
# TCP instead: Client(daemon_url="http://127.0.0.1:7979")
# Authenticated relay: add daemon_token_env="SQ_RELAY_TOKEN"

Batch iterators preserve order and bound pending work to concurrency (default 8). They do not buffer the entire source. Closing a sync batch waits for already running HTTP requests; async batch closure cancels pending tasks. Close clients only after their batch iterators finish. A client semaphore also limits concurrent individual calls. timeout=, retries=, concurrency= override TOML defaults.

Fallback uses the configured provider order; round_robin rotates the first provider. Every provider uses its own model and credential. HTTP 429/5xx, transport and malformed-response errors retry, then fall back. Other HTTP errors fail immediately. Retry-After integer seconds is honored up to 30s. Retried inference may be billed again. Only configured fallback providers receive data. The timeout is per HTTP operation in httpx, rather than a whole batch deadline.

SqError exposes status_code for terminal HTTP errors. Response bodies and credentials are excluded from its messages. Native response extensions and usage are available through result.raw. Responses are bounded to 8 MiB and validated against requested labels/levels before use. transport= accepts an httpx mock transport for offline testing.

Development / publishing:

uv sync --frozen
uv run pytest -q
uv run ruff check src tests
uv run mypy src
uv build -q
uv publish -q  # requires PyPI credentials or a configured trusted publisher

Metadata

Release files for sq-system-one 0.1.1

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

Source distribution (sdist)

Source distribution for sq-system-one 0.1.1
File Size Uploaded Provenance
sq_system_one-0.1.1.tar.gz 41.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 53.8 kB

Release files / sq_system_one-0.1.1.tar.gz

Download URL sq_system_one-0.1.1.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4d4a56d95924e6881998e41f5e9d68383428b7927834c20aeac1b13c0f8aeb3e
BLAKE2b-256 checksum
How to use checksums
4d45dfd753a290dd56e2bce7e9cbae13c7d41505362e18ca88c29581b02e64f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Omarchy","version":"4.0.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sq_system_one-0.1.1-py3-none-any.whl

Download URL sq_system_one-0.1.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
367471407113e4f097c8e1720f7e0e0f01646f4924218d2bf3b2e5e59924591e
BLAKE2b-256 checksum
How to use checksums
3d55b8b6c007aceb1c903796c96aac5fd71caa965f17a8f73381b9db76ad2f8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Omarchy","version":"4.0.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for sq-system-one 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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