# AI result processor templates

Create and preview reusable templates that turn tool results into compact text for AI answers, citations or guardrail processing.

*Release 3.3 · admin, developer*

**Settings › AI › Result Processors** · **Settings › AI › Functions**

## What it is

**Result Processors** are reusable templates for reshaping AI tool results. You can keep selected facts, organise repeated items and add fixed values or generated identifiers. A preview shows the transformed output and estimates how much shorter or longer it is.

## Who uses it and why

- Administrators maintain reusable result formats for their AI functions.
- Developers design and test templates so the model, citations or guardrails receive the intended information.

## Where to find it

Open **Settings › AI › Result Processors** to create or edit a processor. Assign it in **Settings › AI › Functions**, under **Result Processor**, and choose **Mode** on that function.

## How it works

1. Create a named processor and write its **Template**. Templates support substitutions, loops and conditions.
2. Optionally use **Variables** to add **Static** values or **Sequence** identifiers.
3. Open **Test**, paste **Sample Input** and select **Run Preview**. Review **Output**, character counts and estimated token counts. **Syntax Reference** describes the available template features.
4. Save the processor and select it on an AI function.
5. When that function returns a successful result, INSIDE applies the selected processor before the next AI generation.

In **Citation / Guardrails Only** mode, the original result remains the tool input sent to the model, with a processed companion available for other processing. In **Full Replacement**, processed output replaces the tool result sent to the model. The original result remains retained separately.

## Configure it

With the **Settings** role and the **AI** permission, or the **Developer** role, select **New** in **Settings › AI › Result Processors**. Supply **Name** and **Template**, then test representative examples before saving.

On the function, choose **Result Processor** and **Mode**. A new function has no processor selected, and the mode starts at **Citation / Guardrails Only**. Choose **Full Replacement** when the model should receive the transformed output.

Keep the facts the agent needs to answer accurately. Preview both ordinary results and examples with missing or repeated information.

### Settings

| Setting | Where | Applies to | Default | Who can change it | What it does |
|---|---|---|---|---|---|
| Result Processor | Settings › AI › Functions | website | None | Settings role, Developer role | Selects the saved template to apply to successful results from the function. |
| Mode | Settings › AI › Functions | website | Citation / Guardrails Only | Settings role, Developer role | Keeps the original model input with a processed companion, or uses Full Replacement to send processed output to the model. |
| Template | Settings › AI › Result Processors › Template | website | Not set | Settings role, Developer role | Defines how the tool result is rendered; a non-empty template is required to save. |
| Type | Settings › AI › Result Processors › Variables | website | Static | Settings role, Developer role | Chooses Static for a fixed value or Sequence for generated identifiers. |
| Value | Settings › AI › Result Processors › Variables | website | Not set | Settings role, Developer role | Supplies a fixed value for a Static variable; blank leaves the variable without a value. |
| Base ID | Settings › AI › Result Processors › Variables | website | Not set; use the tool result identifier | Settings role, Developer role | Sets a Sequence variable's base identifier. |
| Start | Settings › AI › Result Processors › Variables | website | 0 | Settings role, Developer role | Sets the sequence starting index. |
| Format | Settings › AI › Result Processors › Variables | website | Base identifier and sequence index, separated by a colon and enclosed in square brackets | Settings role, Developer role | Controls how the sequence combines its base identifier and incrementing index. |

### Fields

| Field | Where | Required | What it is for |
|---|---|---|---|
| Name | Settings › AI › Result Processors | Yes | Identifies the reusable processor in selection lists. |
| Name | Settings › AI › Result Processors › Variables | No | Names an optional template variable; unnamed variable rows are ignored. |
| Sample Input | Settings › AI › Result Processors › Test | No | Supplies test content for a preview without running the function. |

### Permissions

| Permission | Lets you |
|---|---|
| Settings | Create, edit, delete and preview result processors when AI is allowed under Settings Permissions. |
| AI | Allows AI configuration within Settings Permissions. |
| Developer | Manage result processors and assign them to AI functions. |

## Limits and good to know

- A processor applies only to successful results from a function that references an available processor.
- A missing processor or a template error leaves the original tool result in use.
- Preview accepts structured data or plain text. Text that is not valid JSON is treated as text, rather than automatically converted into structured fields.
- Estimated token reduction is a sample estimate, not a guarantee of provider billing savings.
- **Citation / Guardrails Only** does not shorten the original tool result sent to the model.
- Sequence variables default to a starting index of zero and use the result identifier when **Base ID** is blank. Preview identifiers can differ from live identifiers.

## Depends on and works with

### This feature uses

- **Configured in** [Roles and permissions](ADM-008.md): AI configuration permissions control processor management.
- **Configured in** [AI functions and required inputs](AI-016.md): Each function selects its Result Processor and output-processing Mode.

### Used by

- **Configures** [AI functions and required inputs](AI-016.md): Optional result processors change how function output is reused.
- **Configures** [Knowledge Base connections for AI](AIP-009.md): The function's selected Result Processor and mode control how successful retrieval results are transformed.
- **Configures** [Algolia Search for AI knowledge](AIP-010.md): The function's selected Result Processor and mode control how successful Algolia results are transformed.
- **Configures** [Knowledge sources behind AI citations](AIP-012.md): A function's selected Result Processor can reshape the supporting content shown with citations.
- **Configures** [MCP tool connections for AI](AIP-017.md): The MCP function's selected Result Processor and mode control how successful tool results are transformed.
- **Enhances** [AI knowledge and web search](AI-017.md): A result processor can transform retrieved output or derive citations.
- **Enhances** [AI integrations and automation tools](AI-018.md): Result processors can transform output or derive citation and guardrail information.

## FAQ and troubleshooting

### Why has the model's input not become shorter?

Check **Mode** on the function. **Citation / Guardrails Only** retains the original model input. **Full Replacement** uses the processed output for that input.

### Why is the original result still being used?

The function may have no processor selected, its processor may have been deleted, the function may have failed, or the template may have raised an error. Check the selection and use **Run Preview** with a representative sample.

### Why does Preview show an empty result?

Check that the template refers to information present in **Sample Input**. Inspect the input structure and any conditions or loops that could produce no output.

### Does a 50% token reduction mean a 50% reduction in cost?

No. The estimate concerns the sample result. Total cost also depends on the rest of the input, generated output, model pricing and other AI calls.
