proomt

Search

Search posts, papers, and topics

All posts

SitePoint15 min readtutorialintermediate

Build a Safer AI Agent Harness with Jev and LangChain

Summary

A step‑by‑step tutorial showing how to add a typed decision layer (using Jev and Pydantic) to a LangChain agent so you can route requests to cheaper or more capable models and gate risky tool calls, with concrete Python code and cost‑trade‑off notes.

  • LangChain’s default agent loop lacks branching; every query hits the same LLM and tool permissions are implicit.
  • Jev decision nodes (Request Router and Tool Gate) provide typed, auditable decisions for model selection and tool risk evaluation.
  • The router classifies request complexity (simple/moderate/complex) and maps it to a model tier (gpt‑4o‑mini or gpt‑4o).
  • The tool gate evaluates proposed tool calls against a risk policy, returning approve, log‑and‑approve, or deny outcomes.

Without explicit decision points, AI agents can waste expensive inference tokens and execute unsafe actions, leading to higher costs and potential security incidents. Adding a typed, version‑controlled decision layer makes the system auditable, testable, and more cost‑effective, which is crucial fo…

6/10

Related reading

  1. I turned Jev into a (lousy) chatbot

    jevchat is a Python CLI that turns the Typesafe Jev API into a symbol‑level chatbot by repeatedly asking Jev which next character to emit. It offers interchangeable sampling strategies and alphabets, live generation stats, and a benchmark mode that quantifies performance trade‑offs.

    Hacker News front pagegithub.com5 minHN16948
  2. TypeSafe AI's Jev now available on AI Gateway

    Vercel AI Gateway now offers Jev, a probabilistic decision model that returns typed choices, scores, and booleans instead of raw text. TypeSafe AI reports it runs up to 193× faster and 445× cheaper than standard LLMs, exposed via the experimental evaluate API in AI SDK 7.

    Vercelvercel.com2 minrelease
  3. Build a Typed Context Compaction Gate for AI Agents

    A step‑by‑step tutorial showing how to build a typed context‑compaction gate for AI agents in TypeScript using LangChain and Zod. It defines a discriminated‑union schema for keep/summarize/discard actions, implements a fast gpt‑4o‑mini classifier, validates decisions at runtime, and wires the gate as middleware in an agent loop, with testing and production‑grade tuning advice.

    SitePointsitepoint.com16 min
  4. Introducing System One Models and Jev

    TypeSafe AI announced its first “System One” model, Jev, a non‑text‑generating LLM that outputs type‑safe structured decisions with calibrated probabilities. It claims 40‑200× lower latency (70‑500 ms) and 100‑500× lower cost versus frontier LLMs, no hallucinations, and parallel sampling. The post includes a side‑by‑side demo, a custom “workflow” benchmark comparing Jev to GPT‑5.6/6 and other mod…

    Hacker News front pagetypesafe.ai9 minHN1824480lobste.rs26
  5. Reverse-engineered Jev-like model

    Jevlike is an open‑source starter model that scores a list of text options in a single forward pass. It provides a minimal architecture (option queries, shared dot‑product scorer), synthetic data generation, training/evaluation CLI, and examples on Doom and chess. The repo supports a byte‑level encoder or a frozen Hugging‑Face encoder (e.g., Qwen2.5‑0.5B), runs on CPU/MPS/CUDA, and reports benchm…

    Hacker News front pagegithub.com4 minreleaseHN16224
  6. Jev is the fastest-adopted model in AI Gateway history

    Vercel reports that the Jev decision model was adopted by 13% of paid teams within its first day, outpacing prior model launches. Jev claims to be up to 194× faster and 445× cheaper than general‑purpose LLMs while returning structured, probabilistic decisions.

    Vercelvercel.com1 minHN21