Four trays are on the table. A message flies to a team only when confidence and the selected probability both clear their floors.
Use this when incoming messages must land in one of a fixed set of team queues, with low-confidence cases held back for human review.
Similar patterns, and when each one is the better fit.

Jev Best-of-N JudgeUse this when you already have several candidate replies to one prompt and need one chosen, or none at all if the pick is too close to call.
Jev Sub-agent DelegationUse this when you delegate a request to one specialist agent and want to show the Jev choice distribution before its result.
Jev Email TagsUse this when you are multi-label tagging a known set of messages, such as an inbox, without writing a classifier prompt or allowing invented labels.
Jev Search FilterFreeUse this when you want semantic search over a known catalog, such as emoji or icons, without building embeddings, scoring each item with a boolean.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: AI_GATEWAY_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
AI_GATEWAY_API_KEYGet keyAI SDK APIs
experimental_evaluateProviders
External services
app/page.tsxapp/layout.tsxapp/api/confidence-router/route.tscomponents/confidence-router-demo.tsxcomponents/message-board.tsxcomponents/typesafe-ai.tsxcomponents/probability-bar.tsxhooks/use-confidence-router.tslib/router-policy.tslib/router-questions.tslib/rate-limit.tslib/request-utils.tsREADME.mdnpm packages
6
Registry components
lib/router-policy.tsPure decideRoute policy: assign only when confidence >= 0.60 AND selected probability >= 0.70. Missing providerMetadata.typesafe.confidence must go to human-review. Test with Experimental_EvaluationMockModelV4.
lib/router-questions.tsChoice question with described department criteria (not labels). Confidence and selected-probability floors live here as constants.
confidence-router/route.tsRate-limited experimental_evaluate call through AI Gateway model typesafe-ai/jev with zeroDataRetention. Returns decideRoute(answer, confidence), never the raw model dump as the product decision.
Four trays are on the table. A message flies to a team only when confidence and the selected probability both clear their floors.
Use this when incoming messages must land in one of a fixed set of team queues, with low-confidence cases held back for human review.
Similar patterns, and when each one is the better fit.

Jev Best-of-N JudgeUse this when you already have several candidate replies to one prompt and need one chosen, or none at all if the pick is too close to call.
Jev Sub-agent DelegationUse this when you delegate a request to one specialist agent and want to show the Jev choice distribution before its result.
Jev Email TagsUse this when you are multi-label tagging a known set of messages, such as an inbox, without writing a classifier prompt or allowing invented labels.
Jev Search FilterFreeUse this when you want semantic search over a known catalog, such as emoji or icons, without building embeddings, scoring each item with a boolean.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: AI_GATEWAY_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
AI_GATEWAY_API_KEYGet keyAI SDK APIs
experimental_evaluateProviders
External services
app/page.tsxapp/layout.tsxapp/api/confidence-router/route.tscomponents/confidence-router-demo.tsxcomponents/message-board.tsxcomponents/typesafe-ai.tsxcomponents/probability-bar.tsxhooks/use-confidence-router.tslib/router-policy.tslib/router-questions.tslib/rate-limit.tslib/request-utils.tsREADME.mdnpm packages
6
Registry components
lib/router-policy.tsPure decideRoute policy: assign only when confidence >= 0.60 AND selected probability >= 0.70. Missing providerMetadata.typesafe.confidence must go to human-review. Test with Experimental_EvaluationMockModelV4.
lib/router-questions.tsChoice question with described department criteria (not labels). Confidence and selected-probability floors live here as constants.
confidence-router/route.tsRate-limited experimental_evaluate call through AI Gateway model typesafe-ai/jev with zeroDataRetention. Returns decideRoute(answer, confidence), never the raw model dump as the product decision.
Loading preview…


Open on desktop for the interactive preview.
Four trays are on the table. A message flies to a team only when confidence and the selected probability both clear their floors.
Loading preview…


Open on desktop for the interactive preview.
Four trays are on the table. A message flies to a team only when confidence and the selected probability both clear their floors.