Recipe catalog / route-many
Route many requests in batches
Which named route handles each of up to 500 requests, judged in batched Jev requests so a queue of tickets, emails, or events is routed in a handful of calls instead of one per item?
You have a backlog or stream of messages to route to the same set of handlers and want batched throughput with a per-item review outcome.
Explore this recipe interactively ยท Source and implementation guide
Use route-many 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 { routeMany } from 'jev-recipes/route-many';
const result = await routeMany({
"requests": [
{
"id": "t-1041",
"text": "I was charged twice for my subscription this month. Please refund one of the charges."
},
{
"id": "t-1042",
"text": "The export button on the reports page does nothing when clicked. Console shows a 500 error."
},
{
"id": "t-1043",
"text": "Can I get a demo of the enterprise plan for a team of 40?"
},
{
"id": "t-1044",
"text": "hi"
}
],
"routes": {
"billing": "Payments, invoices, subscriptions, and refunds",
"technical": "Errors, outages, and broken product features",
"sales": "Pricing questions, plan upgrades, demos, and new purchases"
},
"batchSize": 20,
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| requests | array | Required |
| routes | object | Required |
| batchSize | integer | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"requests": {
"minItems": 1,
"maxItems": 500,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"id",
"text"
]
}
},
"routes": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"batchSize": {
"type": "integer",
"minimum": 1,
"maximum": 50
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"requests",
"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"
]
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"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": [
"id",
"status",
"route",
"suggestedRoute",
"confidence",
"probabilities"
],
"additionalProperties": false
}
},
"routed": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"requestCount": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"requestsMade": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"model",
"usage",
"status",
"items",
"routed",
"requestCount",
"requestsMade"
],
"additionalProperties": false
}
}Saved example result
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-many.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "review",
"items": [
{
"id": "t-1041",
"status": "ready",
"route": "billing",
"suggestedRoute": "billing",
"confidence": 0.95,
"probabilities": {
"billing": 0.95,
"technical": 0.01,
"sales": 0.01,
"__review__": 0.03
}
},
{
"id": "t-1042",
"status": "ready",
"route": "technical",
"suggestedRoute": "technical",
"confidence": 0.94,
"probabilities": {
"billing": 0.01,
"technical": 0.94,
"sales": 0.01,
"__review__": 0.04
}
},
{
"id": "t-1043",
"status": "ready",
"route": "sales",
"suggestedRoute": "sales",
"confidence": 0.93,
"probabilities": {
"billing": 0.02,
"technical": 0.01,
"sales": 0.93,
"__review__": 0.04
}
},
{
"id": "t-1044",
"status": "review",
"route": null,
"suggestedRoute": null,
"confidence": 0.85,
"probabilities": {
"billing": 0.05,
"technical": 0.05,
"sales": 0.05,
"__review__": 0.85
}
}
],
"routed": 3,
"requestCount": 4,
"requestsMade": 1
}
Evaluation evidence
jev-1.13.0 / 2026-09-27 / 40 held-out cases
Scoring revision 1.
25 ready decisions, with 100% accuracy among those decisions.
95% case-level interval: 87% to 100%. Related synthetic cases are correlated.
Measured on these synthetic cases
This measurement uses an earlier or unverified recipe or evaluator version. Rerun with the current recipe and evaluator before treating these numbers as current.
Use the evaluation guide to measure this decision on your own labeled cases.
Limitations
- Every request in a batch shares one model call, so accuracy can fall as batches grow; the default batch size of 20 is a starting point to tune against your own labels.
- Per-item results are independent judgments. The recipe does not deduplicate or group related requests.
Related recipes
- route: Use route for a single request, or when each request has its own set of routes.
- ticket-match: Use ticket-match to link a new message to an existing ticket rather than a queue.