An AI agent is a language model that works in a loop. It reads the task, uses a tool such as "read this file" or "delete that file", looks at the result, and keeps going until the job is done. Each time the model asks to use a tool, that request is called a tool call.
The code that runs this loop is called the harness. The model decides what it wants to do. The harness actually does it, and it also decides what the model is allowed to do.
A good harness makes lots of small decisions along the way. Which model should handle this request? Is this tool call safe to run? Is this answer good enough to hand back? Most harnesses answer these by asking a chat model and reading its reply. That costs a full model call each time, so in practice most checks get skipped.
Jev from TypeSafe AI is a small model built only for these decisions. You describe the situation and ask a few questions, and it answers each one with a number. It never writes text.
This matters most when you build a custom harness, your own agent loop instead of an off-the-shelf agent. A custom harness lets you choose which models run, what the agent may touch, and what counts as done. Jev makes the checks behind those choices cheap enough to run on every step.
In this tutorial you build a harness with the Pi SDK, a TypeScript toolkit for building agents, and use Jev in three places. At the end you run the finished harness in a live sandbox and change its settings yourself.
This guide was inspired by Sydney Runkle's Building a Harness with Jev on the LangChain blog, which shows model routing and tool gating as ready-made LangChain middleware. Here you build the same ideas yourself on the Pi SDK, then add two more patterns for handling failures and checking answers.
