# AI Rules

AI rules let you analyze message content beyond simple keywords. Instead of matching text patterns, AI can understand what a message is actually about.

{% hint style="info" %}
AI Rules require the **Productive** or **Business** plan, plus an [AI integration](https://missiveapp.com/docs/ai/setup) (OpenAI, Anthropic Claude, or Google Gemini).
{% endhint %}

## How AI rules work

1. Create a rule with a **Prompt** condition
2. Write a simple instruction for the AI
3. The AI reads the message and responds
4. Your rule acts based on that response

## Standard rules vs AI rules

**Standard rules** match patterns:

* Sender contains a domain
* Subject includes keywords
* Message was sent to a specific address

**AI rules** understand meaning:

* Detect sentiment (urgent, angry, positive)
* Identify request types (refund, support, sales)
* Extract information (deadlines, action items)
* Understand context that keywords can't capture

Combine both: use standard conditions to filter first, then apply AI only to relevant messages. This keeps costs down.

## Setup

1. Go to **Settings** > **Integrations** > **Add integration** > choose your AI provider (OpenAI, Anthropic, or Gemini)
2. Connect your account and enter your API key
3. Create rules with AI conditions or actions

{% hint style="info" %}
AI costs are billed to your provider account based on usage. Missive doesn't charge extra for AI features. See [Setting up AI](https://missiveapp.com/docs/ai/setup) for detailed setup instructions.
{% endhint %}

## Model selection

When creating AI conditions or actions, you can choose which model to use:

| Provider  | Model                   | Description                                       |
| --------- | ----------------------- | ------------------------------------------------- |
| OpenAI    | GPT-5 Mini              | Fast, cost-effective for most tasks (recommended) |
| OpenAI    | GPT-5 (with web search) | Includes real-time web search capability          |
| Anthropic | Claude Haiku 4.5        | Fast, cost-effective for classification tasks     |
| Google    | Gemini 2.5 Flash        | Fast, cost-effective with large context window    |

## Debugging AI rules

Enable **Log prompt result in conversations** to see what the AI returns for each message. This adds a conversation event showing the AI's response, which helps you:

* Verify your prompt produces the expected output
* Debug rules that aren't firing correctly
* Fine-tune prompt wording

Enable this option on each rule that uses the prompt you're debugging.

{% hint style="info" %}
**Log prompt result in conversations** is only available for the **Prompt** condition. It is not available for AI actions like **Add label(s) with AI**, **Add AI note**, or **Create draft with AI**.
{% endhint %}

## AI actions

| Action               | What it does                                                  |
| -------------------- | ------------------------------------------------------------- |
| Add AI note          | Posts an AI-generated summary or analysis to the conversation |
| Create draft with AI | Generates a reply draft you can review before sending         |
| Add tasks with AI    | Extracts action items and creates tasks                       |
| Add label(s) with AI | Categorizes the message and applies labels                    |

## Use cases

**Customer service**

* Escalate upset customers to senior agents
* Identify support request types
* Summarize complex issues

**Sales**

* Distinguish leads from general inquiries
* Categorize prospects by need
* Draft responses to common questions

**Legal**

* Detect deadlines and time-sensitive requests
* Extract important dates as tasks
* Identify specific legal issues

**General**

* Summarize long threads
* Translate messages
* Extract action items

## Privacy

* You connect your own AI provider account
* You control which messages get processed
* Content is sent to your provider only during rule processing
* Providers don't store data beyond the immediate request

For example prompts and configurations, see [AI Rules templates](https://missiveapp.com/docs/advanced-features/rules/ai-rules/ai-rules-templates).
