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:

Alternatives, with one-line trade-offs:

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:

Before and after

Before (typical custom loop):

  1. Every request goes to the same, usually expensive, model.
  2. The model proposes a tool call.
  3. The harness either runs it blind or makes a second chat-model call to ask "is this safe?" and parses prose back.
  4. 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):

  1. Before the model call, a Jev choice question picks which model handles the request.
  2. Before each tool call, the harness sends the task, the plan and the command with a few noul questions. Your code compares the probabilities to thresholds and decides whether to run, hold or escalate.
  3. Before returning, a Jev question checks whether the answer is good enough. If not, the loop continues or escalates.
  4. 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

Sources