Next.js + Vercel AI SDK + Jev (System One + LLM)
Next.js rules for Jev: typed TypeSafe decisions route, classify and gate on the server, the Vercel AI SDK streams LLM text, and confidence decides what runs.
- Formats
- 4 files
- AGENTS.md
- 49 lines
- CLAUDE.md
- 17 lines
- Languages
- TypeScript
- Updated
- Oct 2026
- Used by
- 4 projects
Writes .claude/skills/nextjs-ai-sdk-jev/SKILL.md
$ curl -s --create-dirs -o .claude/skills/nextjs-ai-sdk-jev/SKILL.md https://stackitfast.com/rules/nextjs-ai-sdk-jev/SKILL.mdRule files
Works with Claude Code · Cursor · Windsurf · AGY
Architecture notes
Architecture Overview
System One plus System Two in one Next.js app. Jev, TypeSafe’s decision model, handles every closed-ended judgment: which team a ticket belongs to, how severe it is, whether a message requests a refund, whether an LLM answer is supported by its source. The Vercel AI SDK handles everything that has to be written. Code sits between them and decides what happens, based on Jev’s confidence.
Why it suits AI coding agents
- Typed answers by construction. With
@typesafe-ai/sdk, answer types are inferred from the questions, so a renamed option breakstscinstead of a production branch. - Decisions are data. Questions, thresholds and logged answers are plain TypeScript and Postgres rows that an agent can read, change and replay against fixtures.
- Clear rules for the model’s limits. Math, dates and counting stay in code, which is TypeSafe’s own guidance for jev-1.13.
Related
TypeSafe’s official agent skill teaches the API (typesafe-ai/skills). For a Python service see FastAPI + Jev decision service, and for agents that act in a browser see Jev browser agent. Data on 648 open-source Jev repos: Jev for developers.
Frequently asked questions
How do I use Jev with the Vercel AI SDK?
The @ai-sdk/typesafe-ai provider exposes Jev through the experimental_evaluate() function with typeSafeAi.evaluationModel("jev-latest"); it does not support generateText or generateObject, because Jev does not generate. This rule uses the official @typesafe-ai/sdk for decisions, because its answer types are inferred from your questions, and the AI SDK for the LLM that writes text.
Why combine Jev with an LLM instead of using one model?
They do different jobs. Jev returns typed decisions with probabilities in a fraction of a second at a low per-token price, but cannot write. An LLM writes and reasons but is slower and returns free text that must be parsed. Routing, classification and guardrails go to Jev, writing goes to the LLM, and code decides using Jev's confidence.
Where should Jev calls run in a Next.js app?
On the server only: route handlers, server actions or React Server Components. The TYPESAFE_API_KEY must never be bundled for the browser, and server-side calls let you log every decision with its model version in Postgres.
How do I test Jev decisions?
Keep a set of labelled fixtures per decision and replay them against the live API whenever questions, criteria, thresholds or the model version change. Assert on the chosen option and on threshold bands rather than exact probabilities, and track how many cases are auto-handled versus escalated.
Used in production
Explore all stacksFast Jev Compaction
Two Jev Noul questions per tool call, gated by a threshold in code, prune a transcript without rewriting it, and a thin hook adapter falls back to Claude Code's built-in summary whenever Jev fails or saves too little.
TypeSafe Agent Skills
Shipping one SKILL.md that points agents at live Markdown docs, installable as a Claude Code plugin or via skills.sh, keeps agent guidance current without an MCP server and without copying version-specific API details.
OpenMAIC
Built as a Next.js app around a set of npm-published packages (slide DSL, generation, renderer, editor, importer, storage). The multi-agent LangGraph pipeline, the slide format and persistence can each be reused or swapped, and heavy video rendering runs in a separate container.
OpenSEO
Running on Cloudflare Workers with D1, Workflows and Durable Objects makes it free-tier friendly to self-host and to scale when hosted. Supporting both D1 and Postgres through Drizzle, plus a Docker path, keeps the project portable beyond Cloudflare.