> ## 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.

# Choice

> Pick one option from a set of alternatives.

A `choice` question picks **one option** from 2 to 64 alternatives that have no natural order: departments, intents,
tools, categories.

## Complete example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.krun.ai/v1/decide \
    -H "Authorization: Bearer $KRUN_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "context": "I was charged twice for the same order and need the money back.",
      "questions": {
        "department": {
          "type": "choice",
          "options": {
            "billing": "Billing and payment issues",
            "returns": "Returns and refunds",
            "shipping": "Shipping and delivery issues"
          }
        }
      }
    }'
  ```

  ```python Python theme={null}
  from krun import Krun

  client = Krun()  # reads KRUN_API_KEY

  result = client.decide(
      context="I was charged twice for the same order and need the money back.",
      questions={
          "department": {
              "type": "choice",
              "options": {
                  "billing": "Billing and payment issues",
                  "returns": "Returns and refunds",
                  "shipping": "Shipping and delivery issues",
              },
          },
      },
  )

  answer = result.choice("department")
  print(answer.choice, answer.confidence)  # "returns" 0.8855, or None if the model abstains
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "model": "krun-one-v0.3",
  "answers": {
    "department": {
      "type": "choice",
      "choice": "returns",
      "confidence": 0.885515,
      "probabilities": {"billing": 0.049104, "returns": 0.934619, "shipping": 0.016277},
      "abstain": false,
      "abstention_status": "advisory"
    }
  },
  "usage": {
    "input_tokens": 56
  }
}
```

The body always has a `context` and a `questions` map keyed by ids you choose (`department` here); the answer comes
back under the same id. A request can mix `choice` questions with [`noul`](/concepts/primitives/noul) and
[`score`](/concepts/primitives/score) questions, up to 16.

## Question fields

A `choice` question is one entry of `questions`:

| Field       | Required | Description                                                                |
| ----------- | -------- | -------------------------------------------------------------------------- |
| `type`      | Yes      | `"choice"`                                                                 |
| `options`   | Yes      | Option id → description (2–64). Use `""` or `null` for label-only options. |
| `task_type` | No       | `"intent"` (default) or `"tool"` for [tool routing](/guides/tool-routing). |

## Reading the answer

* `choice` is the selected option id, or `null` when the model [abstains](/concepts/abstention).
* `confidence` is the margin between the two most likely options, not the probability of `choice`. See
  [Confidence and probabilities](/concepts/confidence-and-probabilities).
* `probabilities` has one calibrated probability per option, in request order.
* `abstention_status` is `calibrated` for intent questions with label-only options and `advisory` otherwise.

Choice behaves exactly as it did before the other primitives existed: existing requests need no change.
