Back to News
RSS feedvercel.com

How to Integrate Jev with TanStack Start and TanStack AI

Summary

The Vercel guide explains how to add Jev-based evaluation to a TanStack Start application through TanStack AI and the @tanstack/ai-vercel-gateway adapter. A server route supplies ticket subject and message as evidence, asks Jev to choose among billing, technical support, and needs-review queues, and returns a typed decision for the interface or application code. The example uses the typesafe-ai/jev model, createVercelGatewayDecider, and either an AI Gateway API key or a Vercel OIDC token; the credential remains on the server. For local development, Vercel project linking and environment pulling provide an OIDC token that expires after 12 hours, while request-time token retrieval avoids stale credentials in long-running processes. The guide validates JSON input with Zod, limiting the subject to 200 characters and the message to 5,000, and maps malformed requests to HTTP 400 and evaluation failures to HTTP 503. The example treats a result as requiring review when Jev selects needs_review or when the selected option's probability is below 0.85, while noting that the threshold and 10-second timeout are application choices that should be calibrated with labeled requests. It distinguishes the model's proposed queue from the final destination chosen by application code, and warns that a routing suggestion does not establish the issue's cause or confirm account checks. The browser submits tickets to the route and displays a suggestion or review message, but the guide recommends persistence and access controls before confirming receipt. It also explains that choice answers expose probabilities and confidence, while score() and boolean() support other evaluation tasks. Before production use, teams should test threshold boundaries, explicit review cases, invalid inputs, provider failures, multi-issue tickets, and labeled examples, while preserving tickets, routing results, corrections, and question definitions for later analysis. AI SDK is presented as an alternative through experimental_evaluate, with different answer shapes and probability semantics to account for.