Skip to main content

STROT

A decision compiler

Compile System-2 reasoning into System-1 decisions — $0 at inference.

PyPI License Python

An LLM reasons through your task once, at compile time. STROT distills that judgment into a specialized decision model — a calibrated head on a frozen encoder, trained on your real data — that then makes every decision locally, on CPU, at $0: no API calls, no GPU, no per-record cost.

Stable decide API, plus an MCP surface to drive it from an agent. The core (a head on a frozen gte-modernbert encoder) is benchmark-validated on Banking77 (93% full-data, 87% at 10 examples/class). Validation breadth is still growing — bring your own data and tell us how it does.

pip install "strot-ai[local,anthropic]"
export ANTHROPIC_API_KEY=...
import strot

# 1. Design the decision schema from a one-line intent (review/edit it).
questions = strot.questions(tickets, "triage support tickets",
                            llm="anthropic/claude-opus-4-8")

# 2. Compile a decision model — the LLM teacher labels your sample, a calibrated
#    head per question is distilled onto the frozen encoder.
model = strot.decide(tickets, questions, llm="anthropic/claude-opus-4-8")

# 3. Decide — locally, on CPU, $0 per call.
model(tickets[0])
# {"predicates": {...}, "scores": {...}, "choices": {...}}  probabilities + calibrated confidence

# 4. Ship one self-contained file; reload anywhere.
model.dispatch("ticket-triage")
strot.load_model("ticket-triage")

The LLM runs only at compile time. After that, production is a self-contained model file: the local model answers every record, nothing is generated at runtime, and every output is bounded typed JSON with a calibrated confidence.

Typed questions

A decision config maps a name to a typed question — predicate, choice, or score:

questions = {
    "is_bug_report":      {"type": "predicate", "instructions": "mentions crashes or errors?"},
    "customer_sentiment": {"type": "score", "instructions": "how upset is the customer?",
                           "levels": [{"label": "angry"}, {"label": "neutral"}, {"label": "happy"}]},
    "routing_bucket":     {"type": "choice", "choices": [
                              {"value": "billing",     "description": "charges, invoices, refunds"},
                              {"value": "engineering", "description": "crashes, bugs, defects"}]},
}

Pass that to strot.decide(data, questions), or hand decide a bare intent string and it designs the schema for you first (result.questions shows what it chose). Each answer carries probabilities and a calibrated confidence.

Three tiers

strot.decide(data, questions, mode=...) picks how hard it works:

mode what it is needs when
lite zero-shot prototype heads (embed each option's description, cosine-match) no labels, instant try a decision immediately, $0, bring no data
head (default) a calibrated logistic head per question, distilled from teacher labels the teacher labels your sample the accuracy of training on your records
deep a shared top-N LoRA adapter over all questions, then refit heads the [finetune] extra + more records representation-bound tasks a frozen head can't crack

warm=True serves lite instantly while head trains in the background, then hot-swaps it in — "zero-shot that grows up."

How it works

Two phases: the expensive, non-deterministic one happens once; the cheap one runs on every record forever.

  • Compile once. The LLM designs the question schema (optional) and writes the record→text projection; the teacher labels a PII-masked sample; a calibrated head per question is trained on the frozen encoder's embeddings and baked into a standalone .py artifact. Content-addressed: a schema change triggers exactly one recompile, nothing else does.
  • Decide forever. The local model projects a record, embeds it once, and every question head answers — typed JSON, bounded, with calibrated confidence. No LLM, no network, ~tens of ms on CPU.
  • Refuses what it hasn't seen. A drift gate (per-class centroids + a distance threshold, fit at compile time) returns a refusal for records unlike anything in training rather than guessing on them.
  • Recompile, don't increment. Every compile is a fresh fit from the frozen base on the current data — never a warm-start from prior weights. A model's weights are a pure function of its own (data, questions, mode), so retraining on accumulated data can only gain quality; it is immune to catastrophic forgetting by construction.

Data & privacy

The teacher LLM is used as a labeler of your real records, never as a bulk synthetic generator. Before any record reaches the teacher it is PII-masked at that boundary: a regex pre-pass guards format-defined tokens (email, SSN, card, API keys, IBAN, IP/MAC/phone), and GLiNER (the [pii] extra) masks names, addresses, and orgs. Masking is compile-time only.

We measured synthetic data and it hurt both accuracy and the confident slice — it comes out too clean and leaks the label. The policy is real-first: label real data; handle class imbalance by labeling more real minority-class records.

Install

pip install strot-ai                # core (pure stdlib)
pip install "strot-ai[local]"       # + torch/transformers (compile + serve a model)
pip install "strot-ai[finetune]"    # + torch/transformers, for mode="deep"
pip install "strot-ai[pii]"         # + GLiNER masking at the teacher boundary
pip install "strot-ai[openai]"      # + openai, teacher via llm="openai/<model>"
pip install "strot-ai[anthropic]"   # + anthropic, teacher via llm="anthropic/<model>"
pip install "strot-ai[mcp]"         # + the MCP server (drive it from an agent)

Extras install optional packages; they do not sign you in. Set the matching API key and pass llm="<provider>/<model>". Compile-time only — serving needs no key.

Drive it from an agent (MCP)

strot-ai[mcp] exposes the compiler as an MCP server, so an agent (Claude, etc.) can compile, run, evaluate, and keep decision models healthy with tools instead of code:

pip install "strot-ai[local,mcp,openai]"
python -m strot.mcp          # runs the MCP server over stdio

Tools cover the whole lifecycle — inspect_data, pii_scan, design_questions, compile_start/compile_status, decide, evaluate_model, read_traces, drift_check, cluster_rejections, recompile, set_status (circuit breaker) — and a strot_compiler prompt (the playbook) teaches the agent how to use them.

Point any MCP client at python -m strot.mcp. For Claude Desktop, add to claude_desktop_config.json:

{
  "mcpServers": {
    "strot": {
      "command": "python",
      "args": ["-m", "strot.mcp"],
      "env": { "OPENAI_API_KEY": "sk-..." }
    }
  }
}

Bake the encoder into your image for offline production:

RUN pip install "strot-ai[local]" \
 && python -c "import strot; strot.prefetch_nlu(local_dir='/opt/encoder')"
ENV STROT_NLU_CHECKPOINT=/opt/encoder

Docs

DEVELOPERS.md covers the architecture — the compile path, the lite/head/deep tiers, calibration & the drift gate, the lifecycle primitives (evaluate, traces, drift_check, cluster_rejections), and the MCP agent surface.

Contributing & contact

Pull requests welcome — keep them focused, branch off the latest main, and run the suite first. See CONTRIBUTING.md. Questions or ideas: open an issue or email lee@strot-ai.xyz.

Built by Amit Rath — LinkedIn.

License

MIT. The base encoder (Alibaba-NLP/gte-modernbert-base) is Apache-2.0. Implements ideas from STROT (arXiv:2505.01636).

Metadata

Release files for strot-ai 1.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 strot-ai 1.1.0
File Size Uploaded Provenance Actions
strot_ai-1.1.0.tar.gz 66.2 kB With provenance Details for strot_ai-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for strot-ai 1.1.0
File Interpreter ABI Platform Actions
strot_ai-1.1.0-py3-none-any.whl Python 3 none any Details for strot_ai-1.1.0-py3-none-any.whl

Total release size: 139.4 kB

Release files / strot_ai-1.1.0.tar.gz

Download URL strot_ai-1.1.0.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
30be787c398a772c0d73ebf9291db8c76a578a72c6c38755e1276f9c1873590d
BLAKE2b-256 checksum
How to use checksums
745c1124c15310fe20637f75d1feb824f6c83cdbebbdd23032052eea2f46dab0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / strot_ai-1.1.0-py3-none-any.whl

Download URL strot_ai-1.1.0-py3-none-any.whl
Size 73.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b595be14537b6e85cdc1fc2a022f957612cc661feb609f10bfae3abb13937135
BLAKE2b-256 checksum
How to use checksums
1db0a0e9b1c41fd2670799497abd1d4b5b7bf4375c4548041a90d82d52345c04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for strot-ai 1.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for strot_ai-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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