DAIR.AI tutorial puts Jev on an agent harness's routing, tool-gating and done checks
A tutorial for wiring TypeSafe's Jev decision model into a custom Pi SDK agent harness, for devs who skip checks because LLM calls cost too much.
Picture a freelance developer running a homegrown coding agent against a client's repo. The loop is simple. The model reads the task, calls a tool, reads the result and repeats. The developer knows the loop should ask three questions on every step. Could a cheaper model handle this request? Is this shell command safe to run? Is this answer actually finished? Each check costs another chat-model call, which adds seconds and cents to hundreds of tool calls per session. So the checks get skipped. One evening the agent runs a destructive command that looked identical to a harmless one.
That gap is the subject of a DAIR.AI Academy tutorial on building a custom harness with Pi and Jev. The tutorial hands those small decisions to Jev, a model from TypeSafe AI that, per the tutorial, answers each question "with a number" and "never writes text." On September 27, 2026, @omarsar0 pointed readers back to it. He framed the idea as offloading harness decisions from a "System Two" model to a "System One" model, and cautioned that System One models "aren't built for reasoning-heavy tasks." This is the vibe-engineering move: verification on every step, cheap enough that it stops being optional. The limit is that it covers only the judgments that are quick to make.
What it is
Two things shipped here: a tutorial and the model it depends on.
The tutorial. The DAIR.AI guide builds an agent loop with the Pi SDK, which it describes as "a TypeScript toolkit for building agents." It then uses Jev at the decision points the harness usually skips: which model should handle a request, whether a tool call is safe to run, and whether an answer is good enough to hand back. It credits Sydney Runkle's LangChain post, which ships model routing and tool gating as ready-made middleware. DAIR.AI rebuilds those ideas by hand and adds two more patterns, one for handling failures and one for checking answers. At the end, the reader runs the finished harness in a live sandbox and changes its settings.
The model. According to Flavio Copes' deep dive, you send Jev some state and a list of typed questions. It returns one answer per question: a yes/no probability (noul), one option from a list you define (choice), or a position on a scale you define (score). Copes calls it "a smart if statement." TypeSafe came out of stealth on September 15, 2026 with $40M in seed funding. Its launch post says Jev is in early access and "can't hallucinate." Firecrawl's explainer narrows that claim: it means Jev cannot return a value outside your schema, and it "can still be wrong."
How each capability maps to the pain in the lede:
- Routing →
choice. LangChain'sModelRouterMiddlewareexample has Jev pick between a "fast" and a "powerful" model from criteria you write (LangChain). - Tool safety →
noul. Copes suggests a coding agent could ask whether a shell command is read-only, reversible or destructive. Firecrawl describes pi-warden, a guard that sends the task, the plan and the pending command to Jev with four questions before eachbash,writeoredit. Firecrawl reports that it answered in about 250 ms and, over 17,000 recorded calls, held 42 of them, with roughly 88% of those holds correct. - "Is this done" → a question about the answer, which the tutorial frames as "is this answer good enough to hand back?"
- Cost of asking. Questions are answered in parallel in one call, so adding one "barely changes the response time" (LangChain; Copes).
Alternatives, with one-line trade-offs:
- Claude Haiku 4.5 as a small LLM judge or router. In Kiryl Rusanau's independent benchmark of 385 Banking77 messages, Jev scored 84.9% and Haiku 4.5 with a schema scored 81.8%. He calls that a statistical tie. Jev was faster (p50 300 ms vs 968 ms) and cheaper ($0.18 vs $3.89 per 1,000 decisions). Haiku never broke a label when called per message. The trade-off: Haiku is slower and costlier, and it is a general model you probably already have access to.
- Sonnet 5 / Opus 5. In the same test they were about three points more accurate (88.1%) but took roughly 2 seconds or more per call.
- LangChain ModelRouter / Auto Mode middleware (
langchain_typesafe). It is ready-made and needs less custom work than the Pi SDK route. It ties you to LangChain, sits in anexperimentalnamespace, and still runs on Jev (LangChain). - A regex blocklist. It costs nothing, but Firecrawl points out that it cannot tell a correct
db:resetfrom a disastrous one, because the command text is identical.
Who it's for
Pick this up if you run your own agent loop in TypeScript and want to own routing, permissions and the definition of "done." It fits best if you know you're skipping checks because of cost or latency, and if your checks are short and well-scoped. TypeSafe's developer advocate offered a test in the joint LangChain/TypeSafe webinar: ask the kinds of questions a panel of very smart humans could answer in about five seconds.
Skip it in any of these cases:
- You're already on LangChain. The middleware covers routing and gating with less code.
- Your team is on Java. Rusanau notes there is no Java SDK, only Python and JavaScript, so you would call the HTTP endpoint yourself.
- Your decisions need multi-step reasoning.
- Your inputs are images or audio. Jev is text only, per Valyu's guide on DEV.
- You can't get early access.
Before and after
Before (typical custom loop):
- Every request goes to the same, usually expensive, model.
- The model proposes a tool call.
- The harness either runs it blind or makes a second chat-model call to ask "is this safe?" and parses prose back.
- The agent declares it's finished, and you find out later whether it was.
After (the tutorial's three checks; step 2's tool-gating detail follows Firecrawl's pi-warden write-up):
- Before the model call, a Jev
choicequestion picks which model handles the request. - Before each tool call, the harness sends the task, the plan and the command with a few
noulquestions. Your code compares the probabilities to thresholds and decides whether to run, hold or escalate. - Before returning, a Jev question checks whether the answer is good enough. If not, the loop continues or escalates.
- The LLM still does the open-ended reasoning and generation. As LangChain puts it, Jev "isn't a drop-in replacement for an LLM."
The policy lives in your code. Jev supplies the judgment. Copes describes the same split: "The model supplies the judgment, and the code decides what happens next."
Try it
The smallest step is to work through the DAIR.AI tutorial and its live sandbox. The tutorial excerpt doesn't say whether the sandbox needs your own API key.
To call Jev yourself, Valyu's guide says to get a key from TypeSafe's console (early access is waitlisted) or through Vercel AI Gateway. Firecrawl reports that TypeSafe opened signups on September 20 with $5 in free credit, then paused new signups on September 22. It adds that Vercel AI Gateway and OpenRouter don't go through TypeSafe's signup. For a TypeScript harness, the guide's setup is:
export TYPESAFE_API_KEY="sk-..."
npm install @typesafe-ai/sdk
And its first call:
import { choice, noul, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const response = await client.systemOne({
state: { document: "I was charged twice. Please fix this ASAP." },
questions: {
category: choice("What is this ticket about?", {
billing: "Payment or subscription issues",
technical: "Bugs or integration problems",
other: "Anything else",
}),
urgent: noul("The message conveys urgency"),
},
});
console.log(response.answers.category.choice); // types inferred from your questions
Cost. TypeSafe's launch post lists $0.042 per million input tokens, with output free. Rusanau measured $0.18 per 1,000 decisions at about 4,350 input tokens per call.
Where it breaks
- Reasoning-heavy calls. @omarsar0, Tom's Hardware and LangChain all scope Jev away from open-ended or multi-step work. We found no evidence on how it fails there beyond those scoping statements from the vendor and its partners. That remains an open question.
- Wrong but valid answers. Schema safety is not correctness. Tom's Hardware notes Jev can still misclassify, fall to adversarial attacks, or answer the literal wording rather than the meaning. A "done" check that is confidently wrong is worse than no check, because you stop looking.
- Not more accurate. Rusanau's headline says it plainly: faster and cheaper than Claude, "Not More Accurate." Sonnet 5 and Opus 5 beat it by about three points on his test.
- Vendor numbers. The 70–500 ms latency and the "up to 194x faster and 445x cheaper" figures come from TypeSafe. The company says its evals are generally run from its laptops on the West Coast, and that it "can't prove" its pricing isn't subsidized. The prices and latencies in explainer posts relay these vendor figures. We have not checked them against an official pricing page, and early-access pricing may change.
- Input limits. Text only. Per Valyu, the limits are 64k tokens for state plus all questions, and 32k for state plus the longest question. Tom's Hardware adds that extra context lowers accuracy.
- Access. Early access is waitlisted, and Firecrawl reports that direct signups were paused on September 22.
- Untested harness. We have not checked whether the Pi SDK harness runs as written with current package versions.
- Lock-in. Every check in your loop now depends on one young vendor's API. That is our analysis, not a sourced claim.
- Independence. LangChain co-marketed Jev with TypeSafe through the joint webinar. Several explainers, from Firecrawl, Valyu and others, come from companies with their own products. We found no disclosure that @omarsar0 or DAIR.AI was paid, but the wave of coverage is not clearly independent. Rusanau's benchmark is the closest thing to third-party evidence, and it covers intent routing, not tool safety or done-checks.
Sources
- Building a Custom Harness with Pi and Jev · Building a Custom Harness with Pi and Jev | DAIR.AI Academy
- A deep dive into Jev, TypeSafe's System One model · Flavio Copes
- Jev vs Claude for Java Intent Routing: Up to 7x Faster, 9 to 21x Cheaper, Not More Accurate · Kiryl Rusanau
- Introducing System One Models & Jev - TypeSafe AI Blog · typesafe.ai
- TypeSafe AI's Jev offers an alternative to LLMs that's 193x faster and 445x cheaper · Tom's Hardware
- How to Use Jev: A practical guide to TypeSafe's System One model · DEV Community
- Building a Harness with Jev · goldcast.registration.public-pr50.goldcast.io
- What Is Jev? Inside TypeSafe's Decision-Only AI Model and Its Developer Use Cases · Firecrawl
- What Is Jev? A Guide to TypeSafe AI’s System One Model · langchain.com
- @omarsar0: This is brilliant. Recommended reading. · @omarsar0