Jev AI Hub
Start Learning

Support · Noul

Detect Escalations with Jev

Escalation as a Jev Noul: one yes/no probability, optional criteria, no separate confidence field.

Published
Sep 20, 2026
Updated
Sep 20, 2026
Last verified
Sep 20, 2026

Quick answer

Ask a Noul whether a thread needs a human or a manager now, then threshold P(yes) in code.

Problem

Most tickets should stay with L1. A few mention lawyers, churn, or 'I already emailed your CEO'. You want a gate, not a generated summary of how bad it is.

Why Jev fits this task

Official Noul: probability a statement is true. Escalation is that statement. Keep queue identity on the routing example; keep tone on the sentiment example.

Input state

Send only the fields the questions name. Official docs warn that extra unrelated state costs accuracy.

{
  "ticket": {
    "messages": [
      {
        "from": "customer",
        "text": "This is the third outage this month."
      },
      {
        "from": "agent",
        "text": "We are monitoring the status page."
      },
      {
        "from": "customer",
        "text": "If this is not restored in an hour I will cancel and have our counsel review the SLA."
      }
    ]
  }
}

Question

Does this conversation require a human escalation right now?

Question type: Noul.

Jev schema

{
  "model": "jev-latest",
  "state": {
    "ticket": {
      "messages": [
        {
          "from": "customer",
          "text": "This is the third outage this month."
        },
        {
          "from": "agent",
          "text": "We are monitoring the status page."
        },
        {
          "from": "customer",
          "text": "If this is not restored in an hour I will cancel and have our counsel review the SLA."
        }
      ]
    }
  },
  "questions": {
    "escalate": {
      "type": "noul",
      "instructions": "Does `ticket.messages` ask to involve a manager, legal, cancellation, or a hard deadline that L1 cannot meet?",
      "criteria": {
        "true": "Lawyer, executive, cancellation threat, or a deadline L1 cannot own",
        "false": "Ordinary follow-up or frustration without an escalation ask"
      }
    }
  }
}

Python example

from typesafe_sdk import Noul, TypeSafeClient

state = {
    "ticket": {
        "messages": [{
            "from": "customer",
            "text": "This is the third outage this month.",
        }, {
            "from": "agent",
            "text": "We are monitoring the status page.",
        }, {
            "from": "customer",
            "text": "If this is not restored in an hour I will cancel and have our counsel review the SLA.",
        }],
    },
}

with TypeSafeClient() as client:
    response = client.system_one(
        state=state,
        questions={
        "escalate": Noul(
            instructions="Does `ticket.messages` ask to involve a manager, legal, cancellation, or a hard deadline that L1 cannot meet?",
            criteria={
                            "true": "Lawyer, executive, cancellation threat, or a deadline L1 cannot own",
                            "false": "Ordinary follow-up or frustration without an escalation ask",
                        },
        ),
        },
    )

print(response.answers["escalate"].noul)
print(response.model)

TypeScript example

import { noul, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();

const response = await client.systemOne({
  state: {
    "ticket": {
      "messages": [
        {
          "from": "customer",
          "text": "This is the third outage this month."
        },
        {
          "from": "agent",
          "text": "We are monitoring the status page."
        },
        {
          "from": "customer",
          "text": "If this is not restored in an hour I will cancel and have our counsel review the SLA."
        }
      ]
    }
  },
  questions: {
    escalate: {
      type: "noul",
      instructions: "Does `ticket.messages` ask to involve a manager, legal, cancellation, or a hard deadline that L1 cannot meet?",
      criteria: {"true":"Lawyer, executive, cancellation threat, or a deadline L1 cannot own","false":"Ordinary follow-up or frustration without an escalation ask"},
    },
  },
});

console.log(response.answers.escalate.noul);
console.log(response.model);

JavaScript example

import { noul, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();

const response = await client.systemOne({
  state: {
    "ticket": {
      "messages": [
        {
          "from": "customer",
          "text": "This is the third outage this month."
        },
        {
          "from": "agent",
          "text": "We are monitoring the status page."
        },
        {
          "from": "customer",
          "text": "If this is not restored in an hour I will cancel and have our counsel review the SLA."
        }
      ]
    }
  },
  questions: {
    escalate: {
      type: "noul",
      instructions: "Does `ticket.messages` ask to involve a manager, legal, cancellation, or a hard deadline that L1 cannot meet?",
      criteria: {"true":"Lawyer, executive, cancellation threat, or a deadline L1 cannot own","false":"Ordinary follow-up or frustration without an escalation ask"},
    },
  },
});

console.log(response.answers.escalate.noul);
console.log(response.model);

cURL example

curl -s https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<'EOF'
{
  "model": "jev-latest",
  "state": {
    "ticket": {
      "messages": [
        {
          "from": "customer",
          "text": "This is the third outage this month."
        },
        {
          "from": "agent",
          "text": "We are monitoring the status page."
        },
        {
          "from": "customer",
          "text": "If this is not restored in an hour I will cancel and have our counsel review the SLA."
        }
      ]
    }
  },
  "questions": {
    "escalate": {
      "type": "noul",
      "instructions": "Does `ticket.messages` ask to involve a manager, legal, cancellation, or a hard deadline that L1 cannot meet?",
      "criteria": {
        "true": "Lawyer, executive, cancellation threat, or a deadline L1 cannot own",
        "false": "Ordinary follow-up or frustration without an escalation ask"
      }
    }
  }
}
EOF

Expected output

{
  "model": "jev-1.13.0",
  "answers": {
    "escalate": {
      "type": "noul",
      "noul": 0.87
    }
  },
  "usage": {
    "input_tokens": 250,
    "output_tokens": 16
  }
}

Confidence handling

There is no confidence field. Use two thresholds: auto-escalate above a high band, stay on L1 below a low band, review the middle. Official cookbooks keep the raw noul visible when a human reviews.

Production considerations

Point the question at the latest customer turn with a backticked path if the thread is long. Official context-rot warning: do not paste a 200-message transcript if the last two turns decide it.

L1 assist, after-hours bots, and SLA breach watchers.

When to use Jev

You need a single P(escalate) to drive a page or a Slack mention.

When not to use Jev

You also need to know which team and how angry they are — add those as extra questions, or use the routing and sentiment examples.

Jev does not know your SLA clock. Official date notes: compare 'in an hour' to now in code after you extract the deadline. A Noul of 0.5 is uncertainty, not 'medium severity'.

Common mistakes

  • Encoding escalate / stay / watch as a Choice when you only need P(yes).
  • Carrying a Noul threshold onto a yes/no Choice. Official jaggedness notes say they are not the same statistic.

FAQ

Should I negate the question too?

Ask the positive form. Official notes: a question and its negation need not sum to 1.

Sources

  1. Primitives (Questions)TypeSafe · accessed 2026-09-20 · documentation
  2. ConfidenceTypeSafe · accessed 2026-09-20 · documentation
  3. Jev 1.13 jaggednessTypeSafe · 2026-09-17 · accessed 2026-09-20 · documentation

All Jev examples