- Guides
- How to Use Jev: API Quickstart and Integration Patterns
How to Use Jev: API Quickstart and Integration Patterns
TypeSafe's Jev primitives (Choice, Score, Noul), the confirmed LangChain integration patterns for agent guardrails and model routing, and what to benchmark before you rely on a five-day-old vendor's calibration claims.
The Three Primitives
Every request to Jev is one of three typed question shapes, evaluated "in parallel and in isolation against the same state in one go" [3]:
- Choice — "choose an option from a list." Returns a
choice, aprobabilitiesdistribution across the options, and aconfidencescore. - Score — "score the state on a rubric." Returns a
score,probabilities, andconfidence. - Noul — "is this statement true?" Returns a probability between 0 and 1.
TypeSafe's documentation is explicit that adding more questions to a single batched call "barely changes the response time," and reports a "12.2x cheaper and 10.0x faster" result for batched questions versus issuing them as separate sequential calls [3]. The practical implication: if you have several independent judgments to make about the same state — is this spam, is this harassment, does this need escalation — send them as one batched request, not three separate ones.
Confirmed Integration Pattern: LangChain
The most concrete, vendor-confirmed integration available at launch is LangChain's own. LangChain exposes Jev through a TypeSafeClassifier, callable from agent nodes or middleware hooks, and documents two specific patterns:
1. Model Routing
A ModelRouterMiddleware uses Jev to assess incoming requests and select the appropriate model — LangChain's own description of the payoff: "fast and inexpensive for straightforward tasks, more capable for complex ones" [1]. It's a cost-optimization pattern that's well established in agent architecture generally, now offered as a packaged primitive rather than a custom-trained classifier you'd otherwise have to build and maintain yourself.
2. Tool-Call Guardrails
An AutoModeMiddleware uses Jev to classify whether a proposed tool call is dangerous before it executes — gating the action rather than reviewing it after the fact, a pattern LangChain describes as inspired by guardrails used in coding-agent harnesses [1]. This is the pattern worth building first if your agent has access to consequential tools: file writes, payments, external API calls, anything hard to undo.
In both patterns, the architecture is the same: the LLM stays responsible for open-ended reasoning and generation, and Jev is called for fast, narrow, structured decisions inside the same agent loop — never as a replacement for the LLM itself.
Build the Guardrail Layer Right the First Time
We design and benchmark the tool-call gating layer for agents that already have access to consequential actions — before a bad guardrail becomes the incident.
What to Verify Before Production
TypeSafe publishes its own "jaggedness" documentation disclosing known failure modes for the current model version — worth reading directly, and worth testing against, not just taking on faith [2]. At minimum, before an auto-act decision (blocking a tool call, auto-escalating a ticket) depends on Jev's output:
- Measure calibration on your own data. Bucket Jev's confidence scores and check whether actual correctness matches the stated confidence at each bucket before setting any auto-act threshold.
- Test cross-question consistency. TypeSafe's own documentation shows a Noul and a logically equivalent Choice question returning different probabilities (0.22 vs. 0.01) on identical input [2] — verify whether that affects your specific question phrasing.
- Test adversarial state. TypeSafe states Jev "does not treat state as hostile by default" [2] — if Jev is gating a tool call, the state it evaluates is an attack surface, and should be tested as one.
- Keep arithmetic and date logic in code, not in Jev. TypeSafe's own guidance is explicit that Jev doesn't count or compare dates reliably [2] — extract categorical judgments with Jev, then do the arithmetic in ordinary application code.
For a deeper look at how Jev's approach compares to structured output you can already get from an LLM you're paying for, see Jev vs. LLM structured output. For pricing details, see what Jev actually costs. And for the broader production-agent guardrail patterns this fits into, see AI agent failure modes in production.
Sources
- [1] Building a harness with Jev — LangChain Blog
- [2] Jev 1.13 Model Jaggedness — TypeSafe AI Docs
- [3] TypeSafe AI Documentation — TypeSafe AI