CommunityHire an ExpertSign Up
Workflows & AgentsAI in workflows
Workflows

AI in workflows: generate, extract, classify and decide

Use AI in a Softr workflow to write, summarize, categorize, run your own prompt or decide on a path, with Softr AI or with your own AI provider API key.

AI steps read text and data in a workflow and write, summarize, categorize or decide. Use them to draft replies, sort incoming requests, enrich records or route a run.

AI steps

StepWhat it does
WriteWrites text from your instructions, such as a reply or a description
SummarizeShortens a text to its key points
CategorizePuts a text into one of the categories you list
Custom promptRuns your own prompt, with free text or a structured answer
Make a decisionAnswers yes or no, picks one option from a list, or gives a score, to route the run. OpenAI step, from 2 to 255 options or 2 to 10 score levels
Image stepsCreate an image from a prompt: Generate image (Image 2) in OpenAI, Nano Banana 2 (image) in Gemini, and Flux via Replicate and Pruna via Replicate in Replicate

To read a PDF or a web page before an AI step, use Extract PDF or Scrape webpage. See Steps.

A Categorize step on Softr AI: the model Claude Haiku 5.5, the text to categorize from the request, and the Categories Billing, Technical and Sales, outlined

Softr AI or your own provider

Each AI step runs on Softr AI or on your own account with an AI provider:

  • Softr AI runs models from OpenAI, Anthropic, Google and Mistral, and uses your workspace’s AI credits.
  • Your own key for OpenAI, Anthropic, Gemini, Mistral or DeepSeek bills your provider account directly. Connect the account as an integration first. AI steps on your own key need the Business plan or above.

Choose a model

Pick the model by the task. The most capable model costs more credits and slows the workflow down, so avoid it on every step.

TaskModel to start with
Classify and routeA small, fast model
Write, summarize, extract dataA mid-size model
Reason over many steps, write codeThe most capable model

The model list of a Categorize step on Softr AI, with what each model is best for and its credit cost

Get a structured answer

By default, AI steps return free text. That works for writing content, but the format can vary, so it is hard to use in a Branch condition or a record update.

Turn on Structured output to get a JSON object with typed fields instead. You can then branch on it, store single fields, or pass specific values to later steps.

To turn it on:

  1. In a Custom prompt step, with Softr AI or your own key, turn on Structured output.
  2. Provide a JSON schema that describes the fields and types you expect.

Structured output needs Softr AI 1.3.0 or later, or OpenAI and Anthropic 1.2.0 or later. Every version of Gemini and Mistral has it.

A Custom prompt step that checks a discount request, with Structured output on and a JSON schema with followsPolicy and reason, outlined

This schema categorizes customer feedback with a confidence score:

JSON
{
  "type": "object",
  "properties": {
    "category": {
      "type": "string",
      "enum": ["bug", "feature_request", "billing"]
    },
    "confidence": {
      "type": "integer",
      "description": "Confidence score from 0 to 100"
    }
  },
  "required": ["category", "confidence"]
}

With this schema, the AI returns exactly two fields, category and confidence, that you can use in later steps.

The Testing tab of the Custom prompt step, with the result of a test: followsPolicy true and the reason

How an AI step ends

Custom prompt, Write, Summarize and Categorize have two outputs:

  • result: the answer of the model.
  • outcome: how the model ended the answer. Use it in a Branch to handle an answer that is not complete.
outcomeThe stepWhat happened
COMPLETEDSucceedsThe model finished its answer.
TRUNCATEDSucceeds, with the answer so farThe answer reached the output limit and stops in the middle.
FILTEREDFails, and keeps the answer so far in resultThe safety or content filter of the provider declined the prompt or stopped the answer.
NO_ANSWERFailsThe provider sent no answer at all. Usually it declined the prompt before it wrote anything.
OTHERFails, and keeps the answer so far in resultThe answer stopped for another reason, such as a tool call that the model could not make.
UNKNOWNSucceedsThe provider gave no reason.

When the step fails, the run details show one of these messages:

  • FILTERED: “The AI provider declined the prompt or stopped the answer with its safety or content filter. Change the prompt and try again.”
  • NO_ANSWER: “The AI model returned no answer. The provider may have declined the prompt. Change the prompt and try again.”
  • OTHER: “The AI model stopped before it finished the answer (finish reason: …).” The reason of the provider replaces the dots.

A cut-off answer is a success, so the workflow continues. To catch it, add a Branch after the AI step that checks whether outcome is TRUNCATED. With Structured output on, a cut-off answer is not valid JSON, so the step fails instead. The message is “The AI response was cut off because it reached the maximum output length. Please ask for a shorter response or split the request into smaller steps.”

Mistral gives no signal when it declines a prompt. A Mistral refusal is a normal answer with the outcome COMPLETED.

Route a run with AI

Let an AI step classify or analyze data, then use a Branch to route the run on the result.

Route on a category

flowchart LR A[Record added to Feedback] --> B[Categorize: Bug or Feature request] B --> C{Category is Bug?} C -->|Yes| D[Post in #bugs and update the record] C -->|No| E[Post in #feature-requests and update the record]

The Categorize step outputs a category value. The Branch checks it and sends the run down the matching path. Each path can notify a different team and update the record with the category.

Route on confidence

For more control, use a Custom prompt with Structured output that returns a category and a confidence score. Then branch on the confidence:

flowchart LR A[New support ticket] --> B[Custom prompt: category and confidence] B --> C{Confidence 70 or more?} C -->|Yes| D[Assign to the team and update the record] C -->|No| E[Ask a reviewer in Slack] E -->|Approve| F[Update the record with the AI category] E -->|Override| G[Update the record with the reviewer's category]

The AI handles the clear cases, and a person reviews the unclear ones. See Human in the loop for the review step.

Send only the records that matter

Sending all your records in one AI prompt is expensive and slow, and the answer is often worse because the AI has too much to sift through.

Instead, use two passes. A small AI model first picks the relevant records, and the workflow passes only those records to the main AI task.

flowchart TD A[New task arrives] --> B[Find multiple records: all items of the knowledge base] B --> C[Run custom code: keep the ID and title of each record] C --> D[Custom prompt, small model: pick the relevant IDs] D --> E[Loop: get the full content of each selected record] E --> F[Custom prompt, larger model: complete the task with these records] F --> G[Store the result]

The first pass is cheap, because a small model reads short titles and picks the relevant ones. The second pass is focused, because the larger model receives only the few records that matter. The total cost is lower than one large prompt.

For example, you keep 50 marketing insights in a database, and a user asks for a LinkedIn post about one product. The workflow sends the 50 titles to a small model, which picks “LinkedIn post framework”, “Product X specs” and “Brand voice guidelines”. The workflow then fetches those 3 records and passes them to a larger model to write the post.

Credits

AI steps on Softr AI use AI credits, based on the size of the prompt and the answer. A step that fails still uses credits for the tokens that the provider reports. Each run shows the credits it used. See AI credits.

Use these docs with your AI tools

An AI agent can read this documentation directly. You do not need an account or an API key. Everything here is public and read-only.

Query these docs via MCP

Recommended

Add this server to Claude, Claude Code, Cursor, Mistral, or any tool that supports MCP. Your agent can then search Softr Documentation documentation and read it in full, instead of answering from memory.

https://docs.softr.io/mcp
  • searchFind the passages that answer a question.
  • fetchRead one page in full, as Markdown.
  • list_pagesSee every page in this documentation.

Query these docs over HTTP

The same tools also work as plain web requests. Use this for scripts, or for any tool that does not support MCP. There is one endpoint per tool. Arguments go in the query string, and the answer comes back as JSON.

https://docs.softr.io/api/docs/search?query=custom+domain

Read the OpenAPI description. It is built from the same definitions as the tools, so it always matches what the endpoints do.

Read these docs as Markdown

Add .md to any page URL to get its Markdown source. You can also send the headerAccept: text/markdown to the page URL itself.

To read the whole documentation in one file, open llms-full.txt. For a short index of every page, open llms.txt.