quix-ai-sdk
Prompt in, analysis out. One method launches a Quix.AI agent session: a sandboxed sub-agent writes fresh analysis code for your prompt, queries the lakehouse, and streams conclusions back.
from quix_ai_sdk import run
result = run("Compare sector times between the two fastest laps of the last session")
print(result) # the agent's conclusions
result.activities # typed log: tools called, code generated, queries run
result.session_id # resume handle + audit id
Install
uv add quix-ai-sdk # or: pip install quix-ai-sdk
Configuration (env only)
| variable | meaning |
|---|---|
Quix__Portal__Api |
portal base URL |
Quix__Workspace__Id |
workspace scope for the analysis sandbox |
QUIX_TOKEN |
a user PAT — see below |
Quix__Workspace__Idis only required forrun()/stream()(the analysis sandbox) — theagents/knowledge/mcpadmin surface doesn't need it.
QUIX_TOKEN must be a user PAT. Quix.AI sessions are user-owned — opening one requires a real user's PAT. The
Quix__Sdk__Tokenthat deployments auto-inject is a service token and cannot run Quix.AI sessions. Deployments that run analyses (e.g. automated post-race summaries) must therefore addQUIX_TOKENas a secret. Missing vars raiseMissingConfigErrornaming the variable.
Acting as a user
Web apps forwarding a logged-in user's token pass token= to run() or stream():
result = run("Summarize", token=request.user.quix_token)
The env QUIX_TOKEN is the default; token= is the only per-call override.
When a real user triggers the run, pass their token — fall back to env
QUIX_TOKEN only for headless/automated runs (attribution and permissions
follow the token). Never log the token value or call args containing it.
Streaming
import asyncio
from quix_ai_sdk import stream, TextChunk, Done
async def main():
async for event in stream("Find anomalies in brake temperature"):
if isinstance(event, TextChunk):
print(event.text, end="")
elif isinstance(event, Done):
print(f"\nsession: {event.session_id}")
asyncio.run(main())
Distilled events: TextChunk, ToolCalled, CodeGenerated, QueryRan,
Progress, Failed, Done. Pass raw=True for wire-level SSE dicts.
Follow-ups
first = run("Summarize the session")
more = run("Expand on the tyre wear point", resume=first.session_id)
fast = run("Quick summary", model="claude-haiku-4-5") # per-run model; result.model = what answered
for m in list_models().models: print(m.id, m.display_name) # what model= accepts
Provisioning (0.3): agents / knowledge / mcp
One-time setup of the AI resources your analyses run on. These live in
submodules (agents, knowledge, mcp), not in the root namespace. Every
write needs an org-admin user PAT (token= per call or env QUIX_TOKEN).
from quix_ai_sdk import agents, runs
agent_id = agents.ensure_analysis_agent(token=ORG_ADMIN_PAT) # once per org
result = runs.run(f"Analyze test {test_id} ...", agent_id=agent_id)
ensure_analysis_agent() creates (or updates) an org agent with a curated,
versioned system prompt shipped in-package: lakehouse query discipline, the
delegate_task sandbox workflow, honest handling of missing data. Append
app-specific rules with extra_prompt=. All ensure_* functions are
idempotent and support dry_run=True previews. Full guide: docs/admin.md.
Failure model
- Agent outcome → in the result:
result.status == "failed", detail inresult.error. Never raises. - Infrastructure → typed exceptions under
QuixAIError:MissingConfigError,AuthError,RunTimeout,StreamInterrupted. - A dropped stream cancels the run server-side (platform behavior). The
session survives:
StreamInterrupted.session_idfeedsresume=. The SDK never auto-retries — a retried run duplicates cost and side effects.
Logging
The SDK logs to stdlib logging under the quix_ai_sdk logger and never
configures handlers. Suggested app-side setup:
import logging
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)-8s] [%(name)s] %(message)s"))
logging.getLogger("quix_ai_sdk").setLevel(logging.INFO)
logging.getLogger("quix_ai_sdk").addHandler(handler)
More runnable examples in examples/. Module docs in docs/.
Metadata
Release files for quix-ai-sdk 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quix_ai_sdk-0.5.0.tar.gz | 31.0 kB | Without provenance | Details for quix_ai_sdk-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quix_ai_sdk-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for quix_ai_sdk-0.5.0-py3-none-any.whl |
Total release size: 66.5 kB
Release files / quix_ai_sdk-0.5.0.tar.gz
| Download URL | quix_ai_sdk-0.5.0.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dde2e143ba383c9901e4929a4df65a1d8b0a1de3145b8a451fe97ef1cb318f1c
|
|
BLAKE2b-256 checksum How to use checksums |
633e58f93d3fdc7d7d63b7d69df7f1031c0eb5643a4d6e139e36a868bdcef874
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / quix_ai_sdk-0.5.0-py3-none-any.whl
| Download URL | quix_ai_sdk-0.5.0-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe81b6a659ef8e1b330c1023454fc3d02dce6354a83fda0a38fb54fecde54f4a
|
|
BLAKE2b-256 checksum How to use checksums |
118df896bce5fda80d583b143e6331d44c861b244c14f32baa8d1d3c20c718fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for quix-ai-sdk 0.5.0
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.