# AI Condition

**AI Condition** is an intelligent action that lets you automate decision-making inside a conversation flow using **Generative AI models (LLMs)** such as **OpenAI GPT-5**, **Google Gemini**, **Anthropic Claude**, **Grok**, and more.

<figure><img src="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2FhduWTfZdj015t8rj470h%2Fimage.png?alt=media&#x26;token=6461c8b2-e1a9-40ef-9789-e5d7524cce3a" alt=""><figcaption></figcaption></figure>

Unlike the standard Condition Action, which relies on basic logic (for example, “if value equals…”), the **AI Condition** uses language understanding to evaluate the semantic meaning of the user’s message and make context-aware decisions.

{% hint style="info" %}
Tiledesk can only continue down one Condition path per execution.

If you define a Condition and do not add a step afterwards, the execution will stop.
{% endhint %}

## Why use AI Condition

This action is ideal when your logic can’t be expressed through simple rules. It allows you to:

* Interpret tone, intent, or context directly from natural language.
* Route conversations automatically to the correct department or human agent (Sales, Support, Billing, etc.).
* Improve First Contact Resolution (FCR) by connecting users to the right resource on the first try.
* Detect frustration or dissatisfaction and immediately transfer the chat to a live operator.
* Apply complex decision logic without writing code or creating multiple manual conditions.

## Where to find it

In the left panel of the Design Studio, go to **AI → AI Condition**. This action is currently marked as **BETA**.

## How it works

{% stepper %}
{% step %}

### Step 1

Sends the user’s latest message to the selected LLM (for example, GPT-5 or Gemini).

<figure><img src="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2FnQMjyKVDntM2GVy6Xvf2%2FUntitled.001.png?alt=media&#x26;token=3edcf156-037a-4c1e-b7f1-d985c3aeb045" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Step 2

The model analyzes the language and evaluates whether one or more **AI Conditions** are met.
{% endstep %}

{% step %}

### Step 3

Based on the result, the flow continues along the corresponding **Success** paths (for example, Support, Sales, Transfer to Human).
{% endstep %}

{% step %}

### Step 4

If the model can’t classify the message, the **Fallback** connector is triggered.
{% endstep %}
{% endstepper %}

### Example 1: Detecting frustration and transferring to a human

You can use **AI Condition** to enhance the way you handle difficult or emotional conversations. For instance, if a user shows frustration or dissatisfaction, the chat can be automatically escalated to a live agent.

#### How to configure

{% stepper %}
{% step %}
Drag an **AI Condition** block into your flow.
{% endstep %}

{% step %}
Select the LLM (for example, OpenAI GPT-5).
{% endstep %}

{% step %}
In Condition 1, enter:

> If the user shows any sign of frustration, dissatisfaction, or emotional distress, whether expressed directly or implied through tone, wording, or repeated complaints.
> {% endstep %}

{% step %}
Set the **Success** path to **Transfer to Human**.
{% endstep %}

{% step %}
In the *Instructions* field, type: `User said: {{lastUserText}}`

<figure><img src="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2Fn1fHWoHyJk6g37U6DLHl%2FGuide%20Articles%20(15).png?alt=media&#x26;token=d707c8d8-7d0b-4f90-b2b4-8dd69a87f2f6" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Benefit: Proactively detect unhappy users and prevent churn by connecting them with a human representative at the right moment.

### Example 2: Routing between Support and Sales

With multiple AI conditions, you can design a smart routing system that identifies the right department based on the user’s query.

#### How to configure

{% stepper %}
{% step %}
Add an **AI Condition** block and select a model (for example, OpenAI GPT-5).
{% endstep %}

{% step %}
Define two conditions:

* Condition 1:

  > If the user’s last question is related to support, troubleshooting, instructions, tutorials, or guidance on how to perform a task\
  > Success → **Support dept**
* Condition 2:

  > If the user’s question is related to subscriptions, pricing, plans, upgrades, discounts, or any other sales-related topic\
  > Success → **Sales dept**
  > {% endstep %}

{% step %}
In the *Instructions* field, type: `User’s last question: {{lastUserText}}`

<figure><img src="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2FvuR7Srzalx9g5ZBmvGhT%2FGuide%20Articles%20(14).png?alt=media&#x26;token=d8419d82-cc64-4d8e-991d-99637e5de158" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Benefit: Automatically send each conversation to the right team without human intervention, reducing waiting times and increasing First Contact Resolution (FCR).

### In summary

**AI Condition** takes conversational automation to the next level — transforming the natural-language understanding of large language models into actionable routing decisions that improve efficiency and customer satisfaction.

It’s the foundation for building **human-AI hybrid flows** that are more adaptive, empathetic, and productive.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.tiledesk.com/ai-chatbots-and-automation/actions-explained/ai-condition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
