decision-circuits
Zero-dependency Python SDK for deterministic gates over calibrated model answers, with LangChain, OpenAI and Claude agent hooks.
Overview
decision-circuits lets you ask a model small typed questions about a piece of state, get probabilities back, and then decide in code with thresholds, AND/OR/NOT, argmax with a confidence floor, majority votes, verification and ordinal buckets. That code is the decision circuit: the model never sees it, so it is versionable, testable offline and auditable, and each result carries its probability, outcome and trace. When a probability sits too close to a threshold, the gate abstains or escalates instead of guessing.
Any backend with one method can answer; a SystemOne backend targets TypeSafe's Jev. Integrations include LangChain tool-guard middleware and a model router, OpenAI Agents SDK input, output and tool guardrails, and a Claude Agent SDK pre-tool-use hook returning allow, deny or ask. It installs with no dependencies on Python 3.10+.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Yes / no | Does this text contain personal information about a private individual? | yes · no |
| Yes / no | Is the writer angry? | yes · no |
| Choice | Which team should handle this? | billing · technical · other |
How it works
- Define questions and gates in a Circuit
- Run it against a backend such as Jev
- Gates compute decided, abstain or escalate outcomes with traces
- Use gates to redact, route, or send to a human
Strengths
- Decision logic is versioned and testable offline
- Explicit abstain/escalate near thresholds
- No dependencies
- Agent framework integrations
Caveats
- Small project (early stage)
- Calibration depends on the backend
Getting started
pip install decision-circuits, then build a Circuit and run it with decision_circuits.backends.SystemOne.At a glance
- Type
- Library
- Status
- beta
- Language
- Python
- Runtime
- library
- Has code
- yes
- Has tests
- yes
- License
- MIT
- Stars
- 1
Use cases and integrations
How curated lists describe it
Decision circuits: typed questions to a System One model, calibrated probabilities back, gates in code. Zero-dependency Python SDK with LangChain, OpenAI Agents, and Claude Agent SDK integrations.
wh000wh000/awesome-jev-live
Frequently asked questions
What is a decision circuit?
Code that combines model probabilities with thresholds and logic to produce auditable decisions.
Do I need Jev?
No, any backend with the required method works; SystemOne is the Jev backend.
Can it guard agent tool calls?
Yes, via LangChain, OpenAI Agents SDK and Claude Agent SDK integrations.
Related projects
Claude Code mod that adds $.jev to the engine interface so other plugins and hooks can ask Jev typed questions through six providers.
ServicebetaTypeScriptAx, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptComposio agent SDK with an optional TypeSafe provider that uses Jev to shortlist and pick tools and closed-set arguments.
ProjectproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptPHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
ProjectproductionPHPLangChain's Python framework, which includes an optional TypeSafeClassifier runnable plus model-routing and risky-tool middleware using Jev.
PluginproductionPython