Back to Learn Jev
Starter project 03 · Start here

Confidence router

Use confidence to decide when software can proceed and when a person should take over.

Time
45–60 min
Level
Production pattern
Shape
Work request → route + confidence → proceed, confirm, or review
You’ll practice
Confidence gates · Fallbacks · Observable decisions

The agent prompt

Copy this brief into your coding agent from the root of the project you want to build in. It names the behaviour, the constraints, and the checks to run — the decisions Jev makes stay explicit so you can see what the model actually decided.

Build a "Confidence router" demo in this repository with Jev from TypeSafe AI.

Start by inspecting the codebase and following its established framework, package manager, and UI patterns. Use the official TypeSafe skill for current API guidance. If it is unavailable, install it with:
npx skills add typesafe-ai/skills --skill typesafe-ai

Users should paste a short work request. Send it to Jev as state and ask one Choice question that routes it to engineering, design, operations, or unclear. Give every option a precise criterion. Then implement the routing policy in normal code:
- confidence >= 0.80: mark it ready for automatic routing;
- confidence from 0.55 to 0.79: suggest the route but request confirmation;
- confidence < 0.55: do not route it and ask for human review.

The UI should explain the chosen route, confidence band, and all option probabilities. Add a small local-only history of the latest five decisions so users can compare outcomes. Include sample requests that exercise all three confidence paths in tests; do not promise that live model results will always hit a particular band.

Requirements:
- Use the official TypeSafe SDK that matches this project.
- Keep TYPESAFE_API_KEY server-side and out of logs, client bundles, and source control.
- Put thresholds in named configuration, not inside the prompt.
- Log only safe decision metadata; never log the full submitted state by default.
- Provide accessible loading, error, empty, and low-confidence states.
- Unit-test the deterministic confidence policy separately from the Jev integration.
- Add setup and run instructions to the README.

Run all relevant tests and checks. Finish with a concise explanation of the trust boundary, fallback behavior, and changed files.

Built something like this

Community projects in the directory that solve a similar problem: