> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

AI decision nodes

AI decision nodes let AI make a judgment call inside a workflow. You give the node a state (the data to look at) and a question about it, and AI answers with yes or no, an option from a list, or a score.

Like condition nodes, an AI decision node can branch the workflow. The difference is the kind of decision each one makes:

  • Condition nodes perform structural manipulation. A JQ expression checks the shape and values of your data, for example whether a field equals "production" or a number is above a threshold.
  • AI decision nodes perform semantic classification. AI reads the meaning of the data and applies plain-language instructions, for example "Is this incident customer facing?" or "Which team should own this request?".

In the workflow builder, add it from the AI category by selecting Make AI decision.

How it works​

  1. The workflow reaches the AI decision node.
  2. Port resolves any JQ templates in the node's state, then sends the state and the question to Port AI.
  3. AI answers the question. The answer is stored in the node's outputs.
  4. For boolean and choice questions, the workflow continues down the outlet that matches the answer. For score questions, the node doesn't branch and the workflow continues to the next node.
AI must be enabled

AI decision nodes use Port AI, so Port AI must be enabled for your organization. Each decision counts toward your organization's AI decision quota and rate limits, see limitations. If the request fails or times out, the node fails and the workflow run fails.

Example​

The following node asks AI whether an incident affects customers, and routes the workflow to the yes or no outlet:

{
"identifier": "is-customer-facing",
"title": "Is customer facing?",
"config": {
"type": "DECISION",
"state": "{{ .outputs.trigger.incident }}",
"questions": {
"decision": {
"type": "boolean",
"instructions": "Decide whether this incident affects external customers.",
"criteria": {
"true": "The incident impacts a customer-facing service, API, or UI.",
"false": "The incident only affects internal tools, staging, or background jobs."
}
}
}
}
}

Configuration​

An AI decision node is defined by a config object with "type": "DECISION" and the following fields:

FieldRequiredDescription
typeYesMust be "DECISION".
stateYesThe text or JSON object the question is asked about. Supports JQ templates, for example "{{ .outputs.trigger }}", so you can pass data from the workflow run context.
questionsYesAn object holding the question to answer about the state, under the decision key (for example "questions": { "decision": { ... } }). Exactly one question is supported. See question types below.
timeoutMinutesNoThe maximum time the node can run before it times out. Defaults to 60.
Keep the state focused

Pass only the data AI needs to answer the question, for example {{ .outputs.trigger.entity.properties }} instead of the whole trigger output. A smaller, focused state leads to more accurate answers.

Question types​

The question is always stored under the decision key in questions, and its answer is returned under the same key in the node's outputs (answers.decision). The workflow builder sets this key for you.

Each question has a type, an instructions field that describes what AI should decide about the state, and an optional or required criteria field depending on the type.

Boolean​

A yes/no question. The node has two outlets, yes and no.

FieldRequiredDescription
typeYesMust be "boolean".
instructionsYesWhat AI should decide about the state.
criteria.trueNoGuidance for when the answer is yes (the yes outlet).
criteria.falseNoGuidance for when the answer is no (the no outlet).

AI returns a probability between 0 and 1 that the answer is yes. The workflow takes the yes outlet when the probability is 0.5 or higher, and the no outlet otherwise.

For a boolean question example, see the example at the top of this page.

Choice​

A multiple-choice question. The node has one outlet per option, and the outlet identifier is the option key.

FieldRequiredDescription
typeYesMust be "choice".
instructionsYesWhat AI should decide about the state.
criteriaYesAn object of at least two options, keyed by the option identifier, with a description of when to choose each.
Choice question example (click to expand)
{
"identifier": "route-request",
"title": "Route request",
"config": {
"type": "DECISION",
"state": "{{ .outputs.trigger.request_description }}",
"questions": {
"decision": {
"type": "choice",
"instructions": "Decide which team should handle this request.",
"criteria": {
"platform": "Infrastructure, CI/CD, Kubernetes, or cloud resources.",
"security": "Access requests, vulnerabilities, or secrets.",
"data": "Databases, data pipelines, or analytics."
}
}
}
}
}

This node has three outlets: platform, security, and data.

Score​

A rating question. Score questions don't branch the workflow. Use them to enrich data, and reference the score in later nodes (for example, in a condition node).

FieldRequiredDescription
typeYesMust be "score".
instructionsYesWhat AI should decide about the state.
criteriaYesAn array of at least two score levels, ordered from lowest to highest.
Score question example (click to expand)
{
"identifier": "rate-deployment-risk",
"title": "Rate deployment risk",
"config": {
"type": "DECISION",
"state": "{{ .outputs.trigger.change_description }}",
"questions": {
"decision": {
"type": "score",
"instructions": "Rate the risk of deploying this change to production.",
"criteria": ["Low", "Medium", "High", "Critical"]
}
}
}
}

The score is available in later nodes as {{ .outputs["rate-deployment-risk"].answers.decision.score }}.

Connections​

Connections from a boolean or choice AI decision node must specify which outlet they're connected to, using sourceOutletIdentifier. Unlike condition nodes, AI decision nodes don't support a fallback connection, since AI always picks one of the outlets:

{
"connections": [
{
"sourceIdentifier": "is-customer-facing",
"targetIdentifier": "page-on-call",
"sourceOutletIdentifier": "yes"
},
{
"sourceIdentifier": "is-customer-facing",
"targetIdentifier": "open-ticket",
"sourceOutletIdentifier": "no"
}
]
}

Each sourceOutletIdentifier must reference a valid outlet on the node: yes or no for boolean questions, or one of the criteria keys for choice questions.

Score questions have a single output, so their connections don't need a sourceOutletIdentifier.

Outputs​

An AI decision node produces the following outputs, which subsequent nodes can reference through data flow:

OutputDescription
answersThe answer, stored under the decision key (answers.decision). The answer has a type and a value: probability for boolean, choice for choice, or score for score. Choice and score answers may also include probabilities per option.
selectedOutlet.identifierThe identifier of the outlet the workflow continued on. Only set for boolean and choice questions.
providerThe AI provider that made the decision.
modelThe AI model that made the decision.
usageToken usage for the decision: inputTokens, outputTokens, and totalTokens.

For example, to reference the answer to the boolean question above in a downstream node:

{{ .outputs["is-customer-facing"].answers.decision.probability }}

Limitations​

LimitationDefaultNotes
Questions per nodeOne.To ask several questions about the same data, chain multiple AI decision nodes, or use a score question in one node and branch on the result with a condition node.
State sizeNo fixed character limit.A decision must complete within 60 seconds. A very large state increases the chance of a timeout and reduces answer accuracy, so keep the state to the fields AI actually needs.
Monthly quota10,000 decisions per organization.Separate from the Port AI invocations quota. Each successful decision counts as one request, regardless of state size or tokens used. Failed decisions don't count. Resets on the first day of each calendar month (UTC). Contact your account team for higher limits.
Rate limit200 decisions per minute per organization.When the monthly quota or rate limit is exceeded, the request is rejected and the node fails, which fails the workflow run. Port doesn't retry automatically, and AI decision nodes don't support onFailure: "continue".

FAQ​