Recipe catalog / route
Route a request
route is a Jev recipe from the jev-recipes TypeScript package. Choose a named handler or return a review decision. Use it when you need to send a request to the right handler, team, or department.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use route in TypeScript?
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { route } from 'jev-recipes/route';
const result = await route({
"request": "I was charged twice for my subscription. Can someone check the invoice?",
"routes": {
"billing": "Payments, invoices, subscriptions, and refunds",
"technical": "Errors, outages, and broken integrations"
},
"minConfidence": 0.8
});
console.log(result);
What input does route take?
| Field | Type | Needed |
|---|---|---|
| request | string | Required |
| routes | object | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"request": {
"type": "string"
},
"routes": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"request",
"routes"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"route": {
"type": [
"string",
"null"
]
},
"suggestedRoute": {
"type": [
"string",
"null"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
},
"required": [
"model",
"usage",
"status",
"route",
"suggestedRoute",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}What does a route result look like?
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo route.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"route": "billing",
"suggestedRoute": "billing",
"confidence": 0.9,
"probabilities": {
"billing": 0.95,
"technical": 0.02,
"__review__": 0.03
}
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.
Result
A confident selection returns status: "ready" and the route name in route. A low-confidence result or the reserved __review__ choice returns status: "review" and a null route.
suggestedRoute preserves a low-confidence suggestion. It is null when no route is selected. confidence and probabilities describe the model decision, including the __review__ option.
The result includes model and token usage. Inspect the outcome as well as its review status.
Reuse and calls
Uses the shared choice helper. This folder owns the routing question, route criteria, and review policy. A live invocation makes one logical Jev request; SDK retries can add transport attempts.
Limits
Routes with overlapping descriptions can be difficult to distinguish. Describe their responsibilities clearly. Routing does not execute handlers or establish permission to act.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo route shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe route to inspect the input and result schemas.
Build a conversation
Use route for one request. Use route-many for independent requests in a batch. When the application needs missing details before routing, compose clarify with route as shown in the support conversation starter.
How accurate is route?
jev-1.13.0 / 2026-10-04 / 110 development cases
Scoring revision 2.
73 ready decisions, with 100% accuracy among those decisions.
95% case-level interval: 97% to 100%. Related synthetic cases are correlated.
This measures the recorded dataset, not general readiness. Label sources: unspecified: Existing repository labels; independent review and original authorship were not recorded.; author-synthetic: AI-authored synthetic boundary cases for jev-recipes; labels have not had independent human review.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of route?
- Does not execute handlers or enforce access control.
- Provide 1 to 254 routes; __review__ is reserved.
Which recipes are related to route?
- turn-intent: Use turn-intent to identify what a message is doing before choosing a handler.