Flows

What are Flows?

Flows are multi-step AI workflows that let you chain together prompts, API calls, data transformations, and logic to build powerful AI-powered processes without writing a full application.

With Flows, you define the exact steps you want to run, in the order you want them. This gives you full control over how your AI features behave and makes them easier to test, debug, and refine.

How Flows work

A Flow executes a sequence of steps you define. Each step performs a specific task, such as calling an AI model, fetching data from an API, transforming data, making decisions, or working with Records. Steps can pass data to each other using template variables, so the output of one step becomes the input for the next.

Example: customer support escalation

  1. Prompt step — Analyze a customer message for sentiment and intent

  2. Conditional step — If sentiment is negative, route to an escalation path

  3. Record step — Look up the customer's history from Records

  4. Prompt step — Generate a personalized response using that history

  5. API Call step — Create a ticket in your support system if escalation is needed

Example of a Flow in action

A SaaS company needs to moderate user-submitted product reviews before publishing them. The team cannot manually review hundreds of submissions each day, but it needs accuracy and wants to avoid rejecting legitimate reviews.

A developer builds a content moderation Flow with these steps:

  1. Prompt step — Send the review text to an AI model with instructions to identify potential policy violations such as spam, profanity, personal attacks, and promotional content. The model returns a structured JSON object with violation categories and confidence scores. Output variable: analysis.

  2. Transform Data step — Check whether any violation has a confidence score above a threshold. Output variable: needsReview.

  3. Conditional step — If {{needsReview}} is true, route to manual review. Otherwise, auto-approve.

  4. API Call step — On the auto-approve path, call the company's publishing API to make the review live.

  5. API Call step — On the manual review path, send the review and {{analysis}} to the internal moderation queue so reviewers can see the AI's reasoning.

During testing, the developer notices too many borderline cases getting flagged. They adjust the confidence threshold in the Transform Data step, rerun test cases in the Playground, and see the false positive rate drop without missing real violations.

Once in production, most reviews auto-approve and the moderation team can focus on genuinely ambiguous cases. Because the Flow follows a defined sequence of steps, edge cases are easy to trace and the logic is straightforward to refine.

Use the Playground to iterate quickly on your Flow logic before deploying to production. You can test different inputs and see how each step behaves.

Available step types

Runtype provides a wide range of step types to cover common workflow needs. Some of the most common include:

  • Prompt — Call an AI model with a prompt

  • Transform Data — Manipulate data with sandboxed JavaScript

  • Conditional — Branch your Flow based on conditions

  • Fetch URL / API Call — Make HTTP requests to external services

  • Upsert / Retrieve Record — Create, update, or look up Records

  • Send Email — Send emails via SMTP

  • AI Search — Search the web using AI-powered tools

  • Wait Until — Pause execution until a condition is met

See Flow step types overview for the complete list.

Template variables

Template variables let you pass data between steps in your Flow.

Using step outputs: When you configure a step, you give its output a variable name. Later steps can reference that output using {{variableName}}. For example, if a step outputs to customerLookup, you can use {{customerLookup.tier}} or {{customerLookup.count}} in a later step.

Providing input to a Flow: When you trigger a Flow through the API, you can pass values in the inputs field and reference them as {{varName}}, such as {{customerName}}. For Record-based execution, access Record metadata with {{_record.metadata.fieldName}}.

System variables like {{_flow.name}} and {{_execution.timestamp}} are also available.

Example prompt using variables:

Summarize this customer message and suggest a response:
Message: {{messageText}}
Customer tier: {{customerLookup.tier}}
Previous interactions: {{customerLookup.count}}

Flows vs. Agents

Flows

Agents

Execution

Follow your predefined steps, with support for branching

Run in a loop, iterating until the task is complete

Control

You define each step

The AI decides which tools to use

Behavior

Predictable and controlled

Flexible and autonomous

Best for

Defined, repeatable workflows

Iterative tasks and turn-taking interactions such as chat

Use Flows when you know the steps needed to accomplish a task. Flows run through your defined steps and complete, which gives you full visibility into what happened and why.

Use Agents when the AI should decide how to accomplish a goal. Agents reason, call tools, and evaluate results in a loop, which makes them well suited for tasks that require multiple rounds of decision-making or conversational interactions.

Start with Flows for most use cases. They are easier to debug, more predictable, and faster to execute. You can introduce Agents later when you need autonomous decision-making.

Next steps

Was this helpful?