FastAPI + Jev Decision Service (Python)
Python rules for a Jev decision service: FastAPI, the async typesafe-sdk client, a typed question registry, confidence thresholds, decision logs and replay tests.
- Formats
- 4 files
- AGENTS.md
- 43 lines
- CLAUDE.md
- 16 lines
- Languages
- Python
- Updated
- Oct 2026
- Used by
- 4 projects
Writes .claude/skills/fastapi-jev-decision-service/SKILL.md
$ curl -s --create-dirs -o .claude/skills/fastapi-jev-decision-service/SKILL.md https://stackitfast.com/rules/fastapi-jev-decision-service/SKILL.mdRule files
Works with Claude Code · Cursor · Windsurf · AGY
Architecture notes
Architecture Overview
A shared decision layer for every product. A FastAPI service wraps Jev, TypeSafe’s System One model, behind named decision endpoints such as POST /v1/decisions/ticket-triage. Each decision is a small Python module: a Pydantic state model, the Choice, Score and Noul questions it asks, and the thresholds that turn probabilities into an action. Every call is logged with the model version that answered.
Why it suits AI coding agents
- Decisions are code, not prompts. Questions, criteria and thresholds are typed Python an agent can diff, test and replay.
- Replay tests catch drift. Labelled fixtures run against the live API whenever questions or the model change.
- Hard boundaries. Math, dates and counting stay in code, and every low-confidence case has a defined path.
Related
The most-starred open-source Jev project, jev-ultrafast, is also Python. For a web app that mixes Jev with an LLM see Next.js + AI SDK + Jev, and for the existing Python agent stack see LangGraph + FastAPI. Background: Jev for developers.
Frequently asked questions
How do I call Jev from Python?
Install typesafe-sdk (Python 3.10+), set TYPESAFE_API_KEY, and call system_one on a TypeSafeClient or AsyncTypeSafeClient with state and a dict of Noul, Choice and Score questions. Answers are read from response.nouls, response.choices and response.scores under the IDs you chose.
Why put Jev behind its own service?
A decision service gives every product the same questions, thresholds, logging and replay tests, and one place to pin the model version. Other services send state and get back a typed decision plus an action (act, review or escalate) instead of each team writing its own prompts.
How should I pick confidence thresholds for Jev?
Start from labelled fixtures. For each decision, measure accuracy and the share of cases handled automatically at different thresholds, pick the point that meets your error budget, and route the rest to review or escalation. Re-run the replay whenever the model version changes, because thresholds do not automatically carry over.
What should a Jev decision service not do?
It should not compute amounts, compare dates, count items or generate text; TypeSafe documents these as weak spots for jev-1.13. Do those steps in code or with an LLM, and use Jev for the semantic judgment in between.
Used in production
Explore all stacksMindsHub (formerly MindsDB)
1Splitting the client, API and agent into separately versioned git submodules lets each ship on its own cadence (a signed desktop app, a PyPI server package, an agent package), while one Makefile and one docker-compose.yml still bring the whole stack up together.
Jev Ultrafast
Asking Jev for the operation and speculative per-operation targets in one request turns each browser step into a single constrained choice, while code validates the observed node and a small LLM writes only typed text.
TypeSafe Agent Skills
Shipping one SKILL.md that points agents at live Markdown docs, installable as a Claude Code plugin or via skills.sh, keeps agent guidance current without an MCP server and without copying version-specific API details.
VoiceStudio
Heavy model work stays in a Python FastAPI backend with a pluggable, hardware-aware engine registry. Desktop, web, MCP and remote-worker clients all use the same local API, so voice models run on the user's own GPU without a cloud dependency.