# Scenarios

> Six complete, runnable examples. Each one is a real decision, the questions behind it, and the plain code that acts on the answers.

Section: Scenarios · HTML: https://jevascript.org/docs/scenarios · Markdown: https://jevascript.org/docs/scenarios.md

Every scenario uses the same fictional company, Northwind, a B2B payments API, and the same pattern: declare the questions, ask them in one request, decide in code. The source for each lives in the [examples directory](https://github.com/hakantapanyigit/jevascript/tree/main/examples) of the library repository and runs with a key and one command.

- [Ticket triage](https://jevascript.org/docs/scenarios/ticket-triage): Six fields per ticket, one request, and thresholds that depend on the plan.
- [Lead qualification](https://jevascript.org/docs/scenarios/lead-qualification): The ideal customer profile is prose the revenue team owns.
- [Moderation](https://jevascript.org/docs/scenarios/moderation): Policy as text, thresholds as a diffable object, hard rules in code.
- [RAG gate](https://jevascript.org/docs/scenarios/rag-gate): Twelve passages judged in one request, plus the question retrieval cannot answer.
- [Agent guardrail](https://jevascript.org/docs/scenarios/agent-guardrail): Five checks on every tool call, sharing one request.
- [Fraud review](https://jevascript.org/docs/scenarios/fraud-review): Composite scoring with your own weights, and confidence gating on the expensive path.

## Running them

```bash
git clone https://github.com/hakantapanyigit/jevascript
cd jevascript && npm install
echo 'JEV_API_KEY=apikey_...' > .env
npm run example examples/launch/01-ticket-triage.ts
```

Each script prints the values it measured and the decision it reached, then the token count and cost of the run.

## What they have in common

- **Propositions, not labels.** Every `describe`, `condition` and criterion is a claim that can be true of the input.
- **One request per item.** Schemas and `batch()` keep everything about one input in one call.
- **Facts stay in code.** Plan, price, amount, role: compared with `===` and `>`, never asked.
- **The model's suggestion is one input.** Where a schema includes an `action` field, the code still applies hard policy on top of it.
