> ## Documentation Index
> Fetch the complete documentation index at: https://docs.krun.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Krun API base URL: https://api.krun.ai. Authenticate server-side with `Authorization: Bearer $KRUN_API_KEY`; never put a Krun API key in browser code.
> Prefer the Python SDK in examples: `pip install krun-ai`, `from krun import Krun`. The TypeScript SDK `@krun-ai/sdk` is not published on npm yet: do not tell users to `npm install` it.
> The only question type is `choice`. `confidence` is the top-1 minus top-2 probability margin, not the probability that the answer is correct. `choice` is null when `abstain` is true.
> Usage reports `input_tokens` only. There are no output tokens.

# Decision primitives

> Choice, noul and score: the three kinds of question Krun answers, and when to use each.

A Krun question has a `type`, its **decision primitive**. Krun One answers three:

| Primitive                               | Use when                                     | Returns                                              |
| --------------------------------------- | -------------------------------------------- | ---------------------------------------------------- |
| [`choice`](/concepts/primitives/choice) | You need to pick one of several alternatives | The selected option + a probability per option       |
| [`noul`](/concepts/primitives/noul)     | You need to evaluate a yes/no proposition    | A probability from 0 to 1 that the proposition holds |
| [`score`](/concepts/primitives/score)   | You need to rate something on ordered levels | An expected level + a probability per level          |

```json theme={null}
{
  "context": "Customer says this is the third time exports failed and wants a human immediately.",
  "questions": {
    "department": {"type": "choice", "options": {"billing": "", "support": "", "sales": ""}},
    "needs_human": {"type": "noul", "instructions": "Is the customer asking for human assistance?"},
    "severity": {
      "type": "score",
      "instructions": "How severe is the reported issue?",
      "levels": ["Minor issue", "Feature degraded", "Blocking issue"]
    }
  }
}
```

```json theme={null}
{
  "model": "krun-one-v0.3",
  "answers": {
    "department": {"type": "choice", "choice": "support", "confidence": 0.91,
      "probabilities": {"billing": 0.03, "support": 0.94, "sales": 0.03},
      "abstain": false, "abstention_status": "calibrated"},
    "needs_human": {"type": "noul", "noul": 0.94},
    "severity": {"type": "score", "score": 1.62, "confidence": 0.72,
      "legend": {"0": "Minor issue", "1": "Feature degraded", "2": "Blocking issue"},
      "probabilities": {"0": 0.02, "1": 0.34, "2": 0.64}}
  },
  "usage": {"input_tokens": 131}
}
```

Each answer has the same `type` as its question, so your code can branch on it.

## Choosing a primitive

* **Several alternatives, no order between them** (departments, intents, tools): `choice`.
* **A single yes/no proposition** (needs a human? likely fraud? should retrieve? should retry?): `noul`. It returns one
  probability, which is easier to threshold than a two-option `choice`.
* **A quantity on a scale** (severity, urgency, quality, risk, sentiment intensity): `score`. The levels are ordered, so
  "off by one level" and "off by four levels" are different mistakes, and the answer is an expected level you can
  compare, average or threshold.

<Tip>
  If the options have a natural order, use `score`, not `choice`. If there are only two outcomes and one is the
  "positive" case, use `noul`.
</Tip>

## Mixing primitives

A request can mix the three types, up to 16 questions. They are answered together, in one model job, and each
question is scored independently: adding a `score` question does not change the answer to a `choice` question. See
[Multiple decision primitives](/guides/multiple-primitives).

## Billing and usage

One question is one decision, whatever its type. `usage.input_tokens` is the real token count of each question's
sequence, summed. See [Usage and tokens](/concepts/usage-and-tokens).
