Community-sourced · not affiliated with TypeSafe
Use cases · Routing · Priority

Routing

Patterns for routing inbound tickets, messages, or requests to the right queue or action path. Related paid starter: T1 Ticket routing. Cases #1 (Cloudflare) and #16 (Vercel Gateway) both teach department Choice — keep both sources; avoid treating them as conflicting products.

Case card detail fields stay in English (source language). Titles and chapter shells are localized.

Case cards

1 · Title

#1 Support department routing (account / billing / technical / other)

2 · When to use / When not
When to use

Route a single inbound support message to one department when labels are fixed and mutually exclusive.

When not

Do not use alone when you also need urgency or frustration in the same pass — prefer the parallel multi-question pattern (#2). Avoid inventing departments not in your org chart.

3 · Question stem

Which team should handle this support request?

4 · Options
  • account
  • billing
  • technical
  • other
5 · Criteria
account
Login, password, profile, or security issues
billing
Charges, invoices, refunds, or subscriptions
technical
Product bugs, outages, or integrations
other
Requests that do not fit the other departments
6 · Example in → out
In
I cannot log in after changing my password, and the reset email never arrives.
Out
department → account (confidence 1.0 in CF sample response)
7 · Source
8 · Notes

From Cloudflare Workers AI Jev docs “Support department routing” example. Same Choice teaching as Gateway #16 (billing/shipping/technical) — keep both sources; do not duplicate long prose. Secondary: DEV practical guide (maps original #1) — short link only, not a re-recorded B card.

1 · Title

#2 Parallel urgency + department + frustration

2 · When to use / When not
When to use

Score several independent judgments on one ticket in a single call (Noul + Choice + Score).

When not

Skip when you only need one department label (#1). Do not hide urgency inside department criteria.

3 · Question stem

Multiple: Does this convey urgency? Which team should handle this? How frustrated is the customer?

4 · Options
  • is_urgent (noul)
  • department: billing | technical | sales
  • frustration Score: Calm → Frustrated → Very angry
5 · Criteria
is_urgent.true
Explicitly time-sensitive
is_urgent.false
No urgency expressed
billing
Payments, invoicing, refunds
technical
Bugs, outages, integrations
sales
Pricing, upgrades, new accounts
frustration
Calm; Frustrated; Very angry (ordered Score levels)
6 · Example in → out
In
Help! My payouts have been failing for 3 days.
Out
is_urgent noul≈0.95; department=billing; frustration≈Frustrated (CF sample)
7 · Source
8 · Notes

Cloudflare docs Usage example — three questions answered in one parallel pass. Secondary: jamilxt DEV post (parallel department/tone/urgency-shaped example) — short link only.

1 · Title

#5 Confidence-gated action routing

2 · When to use / When not
When to use

Gate side effects by per-action confidence: low bar for read-only actions; high bar before money-moving or irreversible actions.

When not

Do not use a single global threshold for every action. Do not treat confidence as a guarantee on one sample.

3 · Question stem

What is the user trying to do? (intent Choice)

4 · Options
  • check_balance
  • approve_transfer
  • (else → human)
5 · Criteria
check_balance
View the account balance (read-only, low bar once above floor)
approve_transfer
Approve the pending withdrawal / transfer (high confidence bar in source examples)
_routing
If confidence < 0.5 → human; check_balance may auto; approve_transfer only if confidence above high bar (DEV ~0.85 / Flavio ~0.9) else confirm
6 · Example in → out
In
(pattern) user message classified as check_balance vs approve_transfer
Out
Low confidence → route_to_human; high-confidence check_balance → show_balance; approve_transfer only above high bar else ask to confirm
7 · Source
8 · Notes

DEV “Pattern 2: Confidence-gated routing”. Option labels and threshold numbers taken from the article’s code samples — calibrate on your labeled traffic. Secondary: puffball1567 DEV comparison. NO automatic money transfer — confidence gates suggestions only; code + humans own irreversible/money actions.

1 · Title

#6 Cascade intent → code / LLM / human

2 · When to use / When not
When to use

Front a support flow with cheap Jev classification, then branch to pure code, a specialist LLM, or a human.

When not

Not a replacement for frontier models on hard reasoning; not for generating replies.

3 · Question stem

Primary intent of this message + how complex is this to resolve

4 · Options
  • intent: order_status | product_question | return_exchange | complaint
  • complexity Score: simple → judgment → unusual escalation
5 · Criteria
order_status
Asking about an existing order
product_question
Asking about a product
return_exchange
Wants to return or exchange
complaint
Unhappy, wants resolution
complexity
Simple lookup or standard procedure; Requires judgment or multiple steps; Unusual edge case, escalation needed
6 · Example in → out
In
(pattern) inbound customer message
Out
order_status → lookup_order (no LLM); product/return → specialist LLM; complaint + high complexity or low confidence → human
7 · Source
8 · Notes

DEV “Pattern 4: The Cascade”. Cost figures in the article are author/TypeSafe estimates — treat as illustration.

1 · Title

#7 Speculative fan-out ticket triage

2 · When to use / When not
When to use

Ask category plus follow-on questions that only matter for some categories in one parallel call; let code ignore irrelevant answers.

When not

Do not serialize one question per round trip when all questions could share state.

3 · Question stem

Broad category of this ticket (+ bug severity, has_repro, refund_wanted, frustration asked anyway)

4 · Options
  • category: bug_report | billing | feature_request | account
  • bug_severity Score
  • has_repro Noul
  • refund_wanted Noul
  • frustration Score
5 · Criteria
bug_report
Something is broken or erroring
billing
Charges, invoices, refunds
feature_request
Asking for new functionality
account
Login, permissions, security
bug_severity
Cosmetic; no impact → Degraded feature; workaround exists → Blocking; no workaround
has_repro
The user describes steps to reproduce
refund_wanted
The user explicitly asks for a refund or credit
frustration
Calm → Frustrated but civil → Very angry
6 · Example in → out
In
(pattern) raw support ticket text as state
Out
If bug_report and severity>1.5 and has_repro>0.6 → escalate eng; if billing and refund_wanted>0.7 → start refund flow (code decides)
7 · Source
8 · Notes

DEV “Pattern 1: speculative fan-out”. Cookbook speed/cost multiples are TypeSafe’s reported figures. Secondary: Cloudflare support-routing docs (related family) — short link, not a duplicate long card.

1 · Title

#15 Sponsorship form sorting

2 · When to use / When not
When to use

Triage structured sponsor / newsletter inquiry forms: real sponsor ask?, product category, how specific the request is.

When not

Do not auto-send rate cards or accept sponsors from model output alone — Flavio’s own plan starts in shadow / email annotation mode.

3 · Question stem

Does `description` ask to sponsor the site or newsletter? What kind of product? How specific is the request?

4 · Options
  • is_sponsor_inquiry (noul)
  • product_category: dev_tool | course | unrelated
  • message_quality Score (3 levels)
5 · Criteria
is_sponsor_inquiry
Does `description` ask to sponsor the site or newsletter?
dev_tool
Developer tools, hosting, APIs, SaaS for developers
course
Courses, books, or training
unrelated
Anything not aimed at developers
message_quality
Generic template, no reference to this site → Mentions the site but no concrete ask → Concrete ask with a timeframe or product named
6 · Example in → out
In
name: Managed Postgres; description: We make a managed PostgreSQL hosting product and would like to sponsor the newsletter in October.
Out
is_sponsor_inquiry high; product_category=dev_tool; message_quality near top level (illustrative shape in article)
7 · Source
8 · Notes

Flavio Copes deep-dive opening example. Article notes sample answer numbers are illustrative; shape is exact. Short note: Flavio’s Playground includes helpdesk-ticket routing walkthroughs — companion pointer, not a second long card.

1 · Title

#16 AI Gateway evaluate — ticket routing (billing / shipping / technical)

2 · When to use / When not
When to use

Teach Choice routing through Vercel AI Gateway `experimental_evaluate` with `typesafe-ai/jev`.

When not

Same Choice idea as CF #1 with different department set — do not maintain two conflicting rubrics; pick labels that match your queues.

3 · Question stem

Route this support ticket.

4 · Options
  • billing
  • shipping
  • technical
5 · Criteria
billing
payment or charge problems
shipping
delivery problems
technical
application bugs
6 · Example in → out
In
My card was charged twice for one order.
Out
route → billing (probabilities concentrated on billing in docs sample)
7 · Source
8 · Notes

Vercel AI Gateway Evaluation docs Choice example. Shares department-Choice teaching with CF #1; keep both sources, avoid duplicated long prose. Secondary: Vercel changelog (Jev on AI Gateway).

1 · Title

#N3 Model routing Choice: fast vs powerful

2 · When to use / When not
When to use

Use Jev Choice middleware to pick a cheaper/faster model vs a more capable one from the latest user message criteria you define.

When not

Not for generating the answer itself — only selecting which generative model should run. Calibrate criteria to your tasks.

3 · Question stem

Choose the least costly model that can complete the task. (ModelRouterMiddleware instructions in article)

4 · Options
  • fast
  • powerful
5 · Criteria
fast
Direct lookups, extraction, and localized changes.
powerful
Architecture and high-stakes decisions.
6 · Example in → out
In
ModelRouterMiddleware choices={ fast: ModelChoice(...), powerful: ModelChoice(...) } (article sample)
Out
Router selects a model for the run; probabilities/confidence remain available in agent state (per article)
7 · Source
8 · Notes

Same LangChain harness article as N2 — Model routing section. Option labels and criteria strings copied from the published sample; not a duplicate long B card.

1 · Title

#N9 jev-search: source pick + relevance Nouls (jev.s1.dev)

2 · When to use / When not
When to use

Plain-language web search where Jev chooses sources/time/query shape and scores each result for subject relevance; app merges and ranks — no generated answers.

When not

Independent Search1API project, not an official TypeSafe product. Engine coverage and model choices can vary; failed engines warn rather than zero-count.

3 · Question stem

Does the request ask for recent results, and if so how recent? + per-source Nouls (e.g. Would Reddit threads fit…?) + Which candidate is the best keyword query…? + Is results[i] about the subject the user asked for…?

4 · Options
  • window Choice (any / 24h / 7d / 30d)
  • source_* Nouls (google, duckduckgo, hackernews, reddit, github, x, arxiv, youtube, wikipedia, imdb, wechat)
  • query / entity Choice over query candidates
  • per-result relevance Noul
5 · Criteria
window
Judge only from what the request says or clearly implies; a request with no time cue wants any time
reddit_yes
The request names Reddit or a subreddit, or asks what people are saying, their experiences, recommendations, opinions or discussion
reddit_no
The request is a factual lookup or asks for official sources, code, papers or videos
relevance_true
The title or snippet discusses the same subject the user asked about, even briefly or as one of several topics
relevance_false
The result is about something else that only shares words with the request … or is unrelated
6 · Example in → out
In
“Jev discussions on Hacker News this week” (live demo prompt on jev.s1.dev)
Out
Intent → sources/window/query; lanes stream ranked results with visible relevance (README / live app)
7 · Source
8 · Notes

superagents-lab/jev-search. Source ask strings live in src/lib/sources.ts; rerank Noul in typesafe.ts. Try the live app; self-host needs Search1API + TypeSafe keys.

1 · Title

#N10 JevRouter: capability Choice (models / tools / subagents)

2 · When to use / When not
When to use

Local-first router that turns models, subagents, skills, MCP tools, CLIs, and plugins into one candidate set, asks Jev one typed Choice, then applies hard policy (availability, permissions, risk, confirmation).

When not

Jev owns probabilities; JevRouter owns policy — filtered candidates are never re-normalized. Decision-only by default; MCP adapter exposes jev_route and does not execute the selected capability implicitly.

3 · Question stem

Which single capability should handle this request? Choose only from the supplied options.

4 · Options
  • Choice over capability ids (criteria = capability descriptions from the candidate set)
5 · Criteria
_default
DEFAULT_QUESTION_INSTRUCTIONS in provider: Which single capability should handle this request? Choose only from the supplied options.
_two_stage
If candidates exceed single_stage_max_candidates: coarse Top-K then final Choice; raw_jev_stages keeps both responses
6 · Example in → out
In
route --request “查找 owner/repo 最近 30 天的登录失败 issue” with registered GitHub/search/model capabilities (README)
Out
Router fields under router; original probabilities/confidence preserved; demo path labelled jevrouter-demo offline
7 · Source
8 · Notes

BillionsBobby/JevRouter (+ jevrouter.co). Benchmark snapshot in README is author Toolathlon routing-accuracy experiment — not end-to-end task completion.

1 · Title

#N11 kody v2026.09.18 — Jev Score search rerank

2 · When to use / When not
When to use

After hybrid lexical+vector recall in kody MCP search, optionally Score-rerank skinny candidate cards with Workers AI typesafe/jev; fall back to hybrid order on failure or low mean confidence.

When not

Feature-flagged (jev-search-rerank). Offline/deterministic embedding paths never call Jev. Dropping below keep score must not empty the result set.

3 · Question stem

How relevant is state.candidates[${String(index)}] to state.query for the agent's next hop (open detail or execute)? Use state.intent only as context.

4 · Options
  • per-candidate Score (4 levels)
5 · Criteria
0
Unrelated or misleading for this query
1
Tangentially related
2
Clearly relevant next hop
3
Best primary match for this query
_policy
jevSearchMinKeepScore 1.5; jevSearchMinMeanConfidence 0.45; candidate cap 40; wide recall ≥50 when flag on
6 · Example in → out
In
Skinny cards: index, type, id, title, summary, optional domain (buildJevSearchSkinnyCard)
Out
Reorder/filter by Score; on low confidence or error keep pre-Jev hybrid order for the same pool
7 · Source
8 · Notes

Stems/criteria from packages/worker/.../search-jev-rerank.ts on tag v2026.09.18. Kody is a full assistant platform — this card is only the Jev rerank slice.