Runnable demo · no sign-in

Run a harness, read the decision

  1. 01 pick
  2. 02 edit & run
  3. 03 read the answer
  4. 04 take the code

02Edit the state, then run

148/2000

fixed questions

  • choicedepartment
  • scoreseverity
  • noulescalate

03The decision

departmentchoice

—

awaiting run

severityscore

—

awaiting run

escalatenoul

—

awaiting run

Verdict pending — department ≥ 0.8, otherwise send to a human triage queue instead of routing.

trace
» waiting for a run

04How this works

Three closed questions about one piece of text: which team, how bad, escalate or not. None of them produces language a person reads, so none of them needs a generative call.

Then, in code: The chosen team receives the ticket; severity sets the queue; a high escalation probability pages a human.

routingseverityescalation

05Your code

ticket-routing.ts
// Route a support ticket — the call this page runs
const response = await fetch('https://ai.gateway.lovable.dev/v1/systemone', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LOVABLE_API_KEY}`, // server side only
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'typesafe/jev-latest',
    state, // the context your code already has, unchanged
    questions: {
        "department": {
            "type": "choice",
            "instructions": "Which team should handle this ticket?",
            "criteria": {
                "billing": "charges, invoices and refunds",
                "technical": "bugs, outages and integration failures",
                "account": "login, permissions and profile changes",
                "other": "anything that does not fit the other teams"
            }
        },
        "severity": {
            "type": "score",
            "instructions": "How severe is this for the customer?",
            "criteria": [
                "cosmetic or informational",
                "degraded, a workaround exists",
                "blocking, no workaround",
                "blocking with financial or data loss"
            ]
        },
        "escalate": {
            "type": "noul",
            "instructions": "Should this go to a human immediately?"
        }
    },
  }),
});

const { answers, usage } = await response.json();

// act on it, in code
const gate = answers.department;
if ((gate.confidence ?? gate.noul) < 0.8) {
  // send to a human triage queue instead of routing
}

Keep the key server-side. The question set is data — keep it next to the code that acts on the answer.

Now find these call-sites in your own project

The console reads a public repository or pasted files and names every AI call-site it can see, with the evidence behind each classification and the coverage it managed to read.