Jev Case Study: Email Routing to Three Teams (Full Code)

Updated Applies to Jev 1.13 Example fixture

TL;DR: This Jev case study routes a shared inbox with one choice question on Jev 1.13: sales, billing, or technical-support. Anything scoring below the confidence threshold falls back to a human triage folder instead of a wrong team. Full code below.

Scenario

We are a twelve-person company with one public address, hello@, that lands in a shared inbox. Three teams pull work from it: sales, billing, and technical support. Every misrouted email costs two handoffs, a confused first reply, and usually an apology — and “can you forward this to the right team?” emails were quietly eating a couple of hours a week.

The routing rule we wanted was simple to state and hard to express with keywords: read the email, pick exactly one team. One call to Jev does it.

The fallback is not decoration. A routing model that is confidently wrong is worse than no model, and a model that whispers “0.52” is telling you it does not know. Jev — TypeSafe AI’s System One judgment model, released September 2026 — returns the confidence value as part of its typed output, which makes the fallback a one-line comparison instead of a second model call. This example runs through the OpenRouter OpenAI-compatible endpoint.

The sample email below is a renewal-quote request. Sales-leaning, but it mentions billing-adjacent words like “invoice cycle” — exactly the kind of email keywords misroute.

Request

{
  "model": "typesafe/jev-1.13",
  "messages": [
    {
      "role": "system",
      "content": "Choice question. Route the email to exactly one team: sales, billing, or technical-support. Reply with JSON only: {\"answer\": <team>, \"confidence\": <0-1>, \"rationale\": <one sentence>}"
    },
    {
      "role": "user",
      "content": "From: dana@example.com\nSubject: License renewal quote for 25 seats\n\nHi, we are expanding from 10 to 25 seats and need a renewal quote with the annual discount before our procurement window closes Friday. Our current invoice cycle renews on the 1st."
    }
  ]
}

Response

Example fixture — illustrative output, not a live capture:

{
  "answer": "billing",
  "confidence": 0.94,
  "rationale": "The customer asks for a renewal quote tied to their existing subscription and invoice cycle, which is a billing-managed renewal rather than a new-sales conversation."
}

Note what the model did with the ambiguity: it picked billing — defensibly — and put the reasoning in rationale where a human can audit it later.

Reproduce

Save as route.py, set OPENROUTER_API_KEY, and run python3 route.py:

import json, os, urllib.request

URL = "https://openrouter.ai/api/v1/chat/completions"
MODEL = "typesafe/jev-1.13"  # confirm exact slug on the OpenRouter model page
FALLBACK_CONFIDENCE = 0.7

SYSTEM = ('Choice question. Route the email to exactly one team: '
          'sales, billing, or technical-support. Reply with JSON only: '
          '{"answer": <team>, "confidence": <0-1>, "rationale": <one sentence>}')

def route(email_text):
    body = {"model": MODEL, "messages": [
        {"role": "system", "content": SYSTEM},
        {"role": "user", "content": email_text}]}
    req = urllib.request.Request(URL, data=json.dumps(body).encode(),
        headers={"Authorization": "Bearer " + os.environ["OPENROUTER_API_KEY"],
                 "Content-Type": "application/json"})
    with urllib.request.urlopen(req) as res:
        payload = json.load(res)
    result = json.loads(payload["choices"][0]["message"]["content"])
    if result["confidence"] < FALLBACK_CONFIDENCE:
        return "human-triage", result
    return result["answer"], result

email = """From: dana@example.com
Subject: License renewal quote for 25 seats

Hi, we are expanding from 10 to 25 seats and need a renewal quote
with the annual discount before our procurement window closes Friday.
Our current invoice cycle renews on the 1st."""

team, detail = route(email)
print(team, "->", detail)

Key parameters

FieldValueWhy it matters
modeltypesafe/jev-1.13Pin the version. Confirm the exact slug on the OpenRouter model page.
messages[0] (system)Choice question + three teams + JSON shapeThe option list is the routing table. Keep it in sync with your real queues.
messages[1] (user)Full email including headersFrom: and Subject: carry real routing signal — do not strip them.
answer (response)billingMap directly to the destination queue.
confidence (response)0.94 (example fixture)Drives the fallback: below 0.7human-triage.
rationale (response)One sentenceLets the receiving team see why the email landed with them.
Price$0.0462 per 1M input tokensOne short call per email; verify current pricing on OpenRouter before budgeting.

Notes

Keep reading