---
title: "AI actions"
description: "Custom prompt, Write, Summarize and Categorize with Softr AI or your own API key: structured output, how an AI step ends, and which AI model to choose."
canonical: "https://docs.softr.io/workflows/actions/ai-actions"
updated: "2026-12-01"
---

# AI actions

> **Applies to:** every version of Custom prompt, Write, Summarize and Categorize

The **Custom prompt**, **Write**, **Summarize** and **Categorize** actions send text to an AI model and give its answer to the next steps. Each of them is in **Softr AI** on every plan, and uses your workspace's AI credits. On the Business and Enterprise plans, they are also in the [OpenAI](/workflows/integrations/openai), [Anthropic](/workflows/integrations/anthropic), [Gemini](/workflows/integrations/gemini) and [Mistral](/workflows/integrations/mistral) integrations, which use your own API key. Gemini and Mistral show **Summarize** as **Summarize Text**.

**OpenAI: Make a decision** is an AI action too. It gives a yes or no, one of your options, or a score, with probabilities. It has [its own page](/workflows/actions/openai-make-a-decision).

## Structured output

> **Applies to:** Custom prompt only. Softr AI 1.3.0 and later, OpenAI and Anthropic 1.2.0 and later, Gemini and Mistral every version.

By default, AI actions return **freeform text**. That is useful for content, but difficult to use in Branch conditions or record updates, because the format can change from run to run.

Turn on **Structured output** to get a **JSON object with typed fields** instead. You can then branch on it, store each field on its own, or give specific values to later steps.

**How to turn it on:**

1. In a **Custom prompt** step, with Softr AI or your own API key, turn on **Structured output**.
2. In **JSON Schema**, describe the fields and types you expect.

The pictures below use a schema for an email, with the fields `subject` and `body`.

![Custom prompt with Structured output on and a JSON schema](/workflows/actions/ai-actions/ai-structured-output-jsonschema.webp)

_Custom prompt with Structured output on and a JSON schema for an email_

The step's **Testing** tab shows the answer when you test the step:

![Structured output test result](/workflows/actions/ai-actions/ai-structured-output-result.webp)

_Test result with the subject and body fields_

**Example schema** to categorize 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 answer is an object with the two fields `category` and `confidence`, and later steps can use each of them.

> **Tip**
>
> For a simple classification into fixed categories, the **Categorize** action needs no JSON schema. Use **Custom prompt** with **Structured output** when you need more than one value, for example a category and a confidence score, or several extracted fields.

## How an AI step ends

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

- `result`: the model's answer.
- `outcome`: how the model ended the answer. Use it in a Branch to handle an answer that is not complete.

| `outcome`   | The step                                       | What happened                                                                                |
| ----------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `COMPLETED` | Succeeds                                       | The model finished its answer.                                                               |
| `TRUNCATED` | Succeeds, with the answer so far               | The answer reached the output limit and stops in the middle.                                 |
| `FILTERED`  | Fails, and keeps the answer so far in `result` | The provider's safety or content filter declined the prompt or stopped the answer.           |
| `NO_ANSWER` | Fails                                          | The provider sent no answer at all. Usually it declined the prompt before it wrote anything. |
| `OTHER`     | Fails, and keeps the answer so far in `result` | The answer stopped for another reason, such as a tool call the model could not make.         |
| `UNKNOWN`   | Succeeds                                       | The 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 provider's own reason 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, with the message "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."

**Softr AI credits:** a step that fails still uses AI credits for the tokens that the provider reports.

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

## Choose a model

Select the model in the step's **Model** field. From version 1.2.0, Softr AI gives you models from OpenAI, Anthropic, Google and Mistral. Versions 1.0.0 and 1.1.0 have a shorter list of OpenAI and Anthropic models only. The right model depends on how complex the task is. A top-tier model on every step uses more credits and makes your workflow slower.

| Task type                                                   | Recommended tier       | Examples                                            |
| ----------------------------------------------------------- | ---------------------- | --------------------------------------------------- |
| **Classification and routing**                              | Smaller, faster models | Claude Haiku 5.5, GPT-6 Luna, Gemini 3.5 Flash-Lite |
| **Writing, summarization, data extraction**                 | Mid-tier models        | Claude Sonnet 5.5, GPT-5.6 Terra, Gemini 3.8 Flash  |
| **Complex reasoning, code generation, multi-step analysis** | Top-tier models        | Claude Opus 5.5, GPT-6.1 Sol, Gemini 3.1 Pro        |

> **Tip**
>
> Start with the smallest model that can do the task. Run a few tests and compare the answers. Move to a more capable and more expensive model only when the quality is not sufficient.

![AI model selector](/workflows/actions/ai-actions/ai-model-selector.webp)

_AI model selector with models from more than one provider_
