Skip to content

AI node

The AI node sends a prompt to a Claude model and stores the reply — the building block for classify, summarize, extract, and generate steps inside a flow. Give it a prompt (with ${...} references to earlier flow data), and it returns the model's text.

Component id: flowrunner/ai.

IMPORTANT

This node is an installable component, not part of the engine. Every workspace gets it installed automatically; if it has been removed, the node passes straight through at run time and the editor marks it Not installed in the Add panel. Open Components in the project header to reinstall it.

How it works

The AI node makes a single call to Anthropic's Messages API and writes the result to a variable. You provide:

  • a model — Claude Opus 4.8 (most capable), Sonnet 5 (balanced), or Haiku 4.5 (fast and cheap);
  • an API key, supplied as a secret reference (${secrets.ANTHROPIC_API_KEY}) so the key never lives in the flow itself;
  • a prompt, which is a full template — ${start.message}, ${response.body}, and any other flow reference is interpolated before the call;
  • an optional system prompt to set behavior;
  • an optional max tokens cap (defaults to 1024, capped at 16000).

The reply is stored under your result variable as an object:

text
refs.<resultVar> = {
  text:       "the model's reply text",
  stopReason: "end_turn" | "refusal" | "max_tokens" | ...,
  usage:      { input_tokens, output_tokens }
}

Read the answer downstream as <resultVar>.text.

Safety and reliability

  • The API key is read from your project's secret vault and is redacted from run traces — it never appears in logs or the run history.
  • On a refusal, the node still succeeds (next) with an empty text and stopReason: "refusal" so you can branch on it.
  • If retries are configured, a rate limit (429), an overload (529), or a 5xx triggers a bounded retry — the same retry/delay budget the HTTP and Email nodes use.

Config

FieldRequiredDescription
modelNo (default claude-opus-4-8)claude-opus-4-8, claude-sonnet-5, or claude-haiku-4-5.
apiKeyYesYour Anthropic API key, as a secret reference — e.g. ${secrets.ANTHROPIC_API_KEY}.
promptYesThe user prompt. A full template — ${...} flow references are interpolated.
systemNoA system prompt to steer the model's behavior. Also a template.
maxTokensNo (default 1024)Maximum reply length; capped at 16000.
resultVarNo (default ai)The variable the reply is written to (text / stopReason / usage).

Ports

The AI node is an I/O node, so it has both a next port and an error port. If the request fails (bad key, network error, non-retryable API error) and you have wired the error port, the failure routes there; otherwise it surfaces as a top-level error.

Examples

Summarize an incoming message:

text
AI  model: claude-haiku-4-5
    prompt: "Summarise this support ticket in one sentence: ${start.body}"
    resultVar: summary
# → refs.summary.text = "Customer can't reset their password."

Classify, then branch on the result:

text
AI  prompt: "Reply with exactly one word — 'refund', 'question', or 'other' — for: ${start.message}"
    resultVar: intent
If  condition: intent.text == 'refund'

TIP

Store your key once under Secrets as ANTHROPIC_API_KEY, then reference it as ${secrets.ANTHROPIC_API_KEY} in every AI node — see Secrets.

See also

FlowRunner — the no-code platform for small businesses.