Skip to content
Docs

Decide

Decide asks a decision model questions about a piece of text: is this urgent, which team should handle it, how frustrated is the customer. A decision model writes no text. For every question it returns the answer it chose and a probability for each answer it could have given. You find it on the node picker’s AI shelf.

Use it when the answer comes from a fixed list and you will act on it: triage, routing, tagging. A chat model can do the same with a prompt, but it gives you no honest measure of how sure it is. Decide gives you one, and you can send the cases it is unsure about to a person.

The node has one input handle and one output handle, and agents can call it as a tool.

Each question has a name, a kind of answer, the question itself, and its options. The answer comes back under the name, so a name is letters, digits and underscores, starting with a letter.

There are three kinds of answer:

Kind Answers Options, one per line
noul yes or no optional: yes: and no: lines saying what each answer means
choice one of several options an option, optionally followed by a colon and what it means
score one of ordered levels the levels, lowest first

A choice question that routes support mail:

billing: Payments, invoices, refunds
technical: Outages, errors, anything that is broken
sales: Prices, plans, new customers

A score question:

Calm
Frustrated
Very angry

Put every question about the same text on one node. The model reads the text once and answers all of them, so five questions cost little more than one.

State is the text the questions are about, and is usually an expression:

{{ $start->payload->body }}

Keep it to the text that matters. Accuracy falls as the state fills with signatures, quoted replies and other unrelated content.

With an OpenAI decision model (gpt-6-luna), the questions can also look at images: a photo of a damaged parcel, a screenshot of an error. Point Images at a stored file or an email attachment, or a JSON array of them, such as an email trigger’s attachments:

{!! json_encode($start->payload->attachments) !!}

Images picks stored files: type part of a path, and the field lists the matching files of every file store in your workspace as Store › path, the newest first, 50 at most. One picked file is saved as its object id, several as a JSON array. For a mail’s attachments, as above, click Insert a value ({x}) and write the expression there.

A file that is not a JPEG, PNG, GIF or WebP image, such as a PDF among the attachments, is skipped. The output lists it under imagesSkipped with the reason, and the node still answers from the text and the images it could use. The other providers read text only: the editor says so when you give them images.

Put a Switch after the node and route on its output. A case condition for the billing team:

$workflow->node("Decide")->answers->team->chosen === "billing"

A yes-or-no answer is a real true or false, so it can be the whole condition:

$workflow->node("Decide")->answers->urgent->chosen

Each answer has a confidence: the probability the model gave the answer it chose. When any answer’s confidence is below the confidence threshold, lowConfidence is true and lowConfidenceQuestions names the questions concerned.

Make that the first case of the Switch, so an unsure answer never reaches the cases that act on it:

$workflow->node("Decide")->lowConfidence

Send that branch to a person, or to an Agent that can read the whole message.

The threshold defaults to 0.7. That is a starting point and not a measured value. How far a model’s confidence can be trusted differs per model and per kind of text, so check the threshold against cases where you know the right answer before you rely on it.

The Decide node's settings form, with the fields described below
The Decide node's settings form, with the fields described below
FieldTypeDefaultDescription
Provider (provider)one of openai, anthropic, gemini, ollama, mistral, groq, xai, voyageai, openrouter, typesafe, eleven, openai-compatible, soniox ✦ (required) — The service that runs the decision model: TypeSafe or OpenAI directly, or OpenRouter as a gateway to TypeSafe.
Model (model)string ✦ (required) — The decision model, e.g. jev-1.13.0 (TypeSafe) or gpt-6-luna (OpenAI). A decision model answers typed questions about a text with a probability per answer, and writes no text.
State (state)string ✦ (required) — The text the questions are about: a support message, an email body, a form entry.
Questions (questions)list (required) — The questions to answer about the state. Each comes back under its name with the chosen answer, a probability for every allowed answer, and a confidence.
Name (questions[].name)string (required) — The name the answer comes back under, e.g. team or urgent.
Kind of answer (questions[].type)one of noul, choice, score (required) — Yes-or-no, one of several options, or one of ordered levels.
Question (questions[].instructions)string (required) — The question, in plain words, e.g. “Which team should handle this request?”
Options (questions[].options)string (optional) — One per line. Choice: an option, optionally followed by a colon and what it means. Score: the levels, lowest first. Yes-or-no: optional “yes:” and “no:” lines saying what each answer means.
Credential (credential)string ✦ (optional) — The key this node pays with: a secret holding a TypeSafe, OpenAI or OpenRouter API key, or a saved Connection. Leave it empty to use the workspace key for this provider, set on the AI models page.
Base URL (baseUri)string ✦ (optional) — Override the provider’s API base URL: https://eu.api.openai.com/v1 for an OpenAI project set up for processing in Europe, or a self-hosted server speaking TypeSafe’s /v1/systemone protocol.
Confidence threshold (confidenceThreshold)number ✦ (optional) — Below this confidence (0–1) an answer counts as unsure, and the node sets lowConfidence so a Switch can hand the case on. Defaults to 0.7.
Images (images)string ✦ (optional) — Images the questions are also about, such as a photo of a damaged parcel: a stored file or an email attachment, or a JSON array of them. Only OpenAI’s decisions endpoint reads images.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

{
"answers": {
"urgent": {
"chosen": true,
"probabilities": { "true": 0.95, "false": 0.05 },
"confidence": 0.95,
"position": null
},
"team": {
"chosen": "technical",
"probabilities": { "billing": 0.06, "technical": 0.88, "sales": 0.06 },
"confidence": 0.88,
"position": null
},
"mood": {
"chosen": "Frustrated",
"probabilities": { "Calm": 0.0, "Frustrated": 0.9, "Very angry": 0.1 },
"confidence": 0.9,
"position": 1.1
}
},
"lowConfidence": false,
"lowConfidenceQuestions": [],
"model": "jev-1.13.0",
"usage": { "inputTokens": 318, "outputTokens": 0 }
}

position is a score’s expected level, counted from 0 for the lowest, and can fall between two levels: 1.1 is just past Frustrated towards Very angry. It is null for the other kinds.

Pick a model and the provider follows. Three are available:

Model Provider Price per 1M input tokens Where the text goes
Jev (jev-1.13.0) TypeSafe, directly $0.042 Outside the EU
Jev and other decision models OpenRouter, as a gateway The model’s own Outside the EU: OpenRouter’s EU region offers no decision models, so the workspace’s OpenRouter region must be Global or United States
GPT-6 Luna (gpt-6-luna) OpenAI, on its decisions endpoint $0.10 The United States, or Europe for an OpenAI project set up for it

Output is free with every one of them: a decision model writes no text.

To keep the text in Europe, use OpenAI with your own key for a project that OpenAI has approved for processing in Europe, and set the node’s Base URI to https://eu.api.openai.com/v1. OpenAI asks for Zero Data Retention or a similar retention arrangement before it approves one.

When you save, the questions are checked against the model’s published limits, and a question set the model cannot take marks the node with an error instead of failing the run later. Jev takes up to 255 options per choice and 2 to 10 levels per score, and about 64,000 tokens per request for the state and all questions together. English is its primary language. Other languages work, but less well. OpenAI publishes no limits for GPT-6 Luna’s decisions endpoint, which is in public beta.

  • Switch routes on the answers.
  • Agent can call this node as a tool, and can take over the cases it is unsure about.
  • LLM Chat writes text, which this node never does.