> For the complete documentation index, see [llms.txt](https://docs.agenticflow.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agenticflow.ai/reference/nodes/ai_decision.md).

# AI Decision

**Action IDs:** `ai_decision`, `typesafe_ai_decision`, `agenticflow_ai_decision`

## Description

Evaluate one or more questions about the same piece of state and return typed, structured answers. Use AI Decision when a workflow needs to classify, score, or check information before a later step uses the result.

AI Decision does not change the workflow path by itself. Add a later node that uses the answer, or use [AI Switch](/reference/nodes/ai_switch.md) when the result should select one child workflow.

## Connections

Choose the provider variant shown by the builder:

| Connection                              | Use                                                                                          |
| --------------------------------------- | -------------------------------------------------------------------------------------------- |
| PixelML (`ai_decision`)                 | Inference billed to the connected PixelML account.                                           |
| TypeSafe (`typesafe_ai_decision`)       | Use a connected TypeSafe account. Billing is handled by that provider account.               |
| AgenticFlow (`agenticflow_ai_decision`) | Built-in provider access. The workspace uses AgenticFlow credits. No connection is required. |

Credentials are selected through Connections and are not entered into the node's state or question fields.

## Input Parameters

| Name      | Type                   | Required | Description                                                                               |
| --------- | ---------------------- | :------: | ----------------------------------------------------------------------------------------- |
| state     | text, object, or array |    Yes   | The information to evaluate. This can be a workflow input or output from an earlier node. |
| questions | object                 |    Yes   | One or more named questions. Each question uses Choice, Score, or Yes/No.                 |
| model     | fixed model            |    No    | The decision model selected by the action. The current action uses `jev-1.13.0`.          |

Question IDs must start with a letter and may contain letters, numbers, `_`, or `-`. Use stable IDs because later nodes reference answers by these IDs.

## Question Types

### Choice

Choose the option with the highest probability from a fixed list. Provide at least two options and give each option a stable ID and a description.

```json
{
  "route": {
    "type": "choice",
    "instructions": "Which team should handle this request?",
    "criteria": {
      "billing": "Invoices, refunds, or charges",
      "technical": "Login, API, or product errors",
      "general": "Questions that do not fit the other options"
    }
  }
}
```

### Score

Evaluate the state against an ordered rubric with two to ten levels. The returned score is the probability-weighted position in that rubric, starting at `0`.

```json
{
  "priority": {
    "type": "score",
    "instructions": "Rate how urgently this request needs attention.",
    "criteria": [
      "Routine",
      "Needs attention soon",
      "Urgent"
    ]
  }
}
```

### Yes/No

Estimate the probability that a statement is true. The answer is returned as `noul`, a number from `0` to `1` representing the probability of “Yes”.

```json
{
  "needs_specialist": {
    "type": "noul",
    "instructions": "Does this request require a specialist?",
    "criteria": {
      "true": "A specialist is needed",
      "false": "The standard team can handle it"
    }
  }
}
```

You can mix all three question types in one action. Questions that depend on a previous answer should use a later node instead of being placed in the same request.

## Output Parameters

| Name    | Type   | Description                                    |
| ------- | ------ | ---------------------------------------------- |
| model   | string | The model that served the decision.            |
| answers | object | An answer for each question ID.                |
| usage   | object | Input and output token usage for the decision. |

Choice answers contain `choice`, `probabilities`, and `confidence`.

Score answers contain `score`, `legend`, `probabilities`, and `confidence`.

Yes/No answers contain `noul`. A Yes/No answer does not include a synthetic confidence field.

Example output:

```json
{
  "answers": {
    "route": {
      "type": "choice",
      "choice": "technical",
      "probabilities": {
        "billing": 0.1,
        "technical": 0.8,
        "general": 0.1
      },
      "confidence": 0.8
    },
    "needs_specialist": {
      "type": "noul",
      "noul": 0.92
    }
  },
  "usage": {
    "input_tokens": 312,
    "output_tokens": 48
  }
}
```

## Referencing Answers in Later Nodes

If the node is named `classify_request`, later nodes can use paths such as:

```
{{classify_request.answers.route.choice}}
{{classify_request.answers.route.probabilities.technical}}
{{classify_request.answers.needs_specialist.noul}}
```

Use the answer value for deterministic business rules. Treat probabilities and confidence as model estimates, not authorization or guaranteed truth.

## Example: Classify a Support Request

1. Add an input named `customer_message`.
2. Add **AI Decision** and set `state` to `{{customer_message}}`.
3. Add a Choice question named `route` with `billing`, `technical`, and `general` options.
4. Add a message, database, or workflow node that uses `{{classify_request.answers.route.choice}}`.

The decision node returns the classification; the following nodes decide what to do with it.

## Limits and behavior

* A request can contain up to 32 named questions.
* The native request limit is 64,000 input tokens, and `state` plus the longest question is limited to 32,000 tokens.
* Choice options must be unique and Score levels keep their configured order.
* The action accepts text and structured state. It does not analyze raw images, audio, or video directly.
* Provider failures and invalid answers stop the action with an error. They do not silently become `false`, `0`, or a default option.
* A low-confidence answer is still a valid answer. Add an explicit rule or use AI Switch if uncertainty should follow a fallback path.

## Troubleshooting

| Problem                              | What to check                                                                               |
| ------------------------------------ | ------------------------------------------------------------------------------------------- |
| A connection is required             | Select an active PixelML or TypeSafe connection, or choose the built-in AgenticFlow action. |
| An option is missing from the answer | Make sure the option ID is configured and unchanged.                                        |
| A later reference is unavailable     | Save the decision node first and reference the exact node name and question ID.             |
| The action rejects the request       | Check that the state is valid text/JSON and that each question has the required fields.     |
