---
title: AI Workflows
description: "--- ## Introduction **AI workflows** enable the automation of intelligent processing on Kafinea records. By adding an **AI Prompt** task to a workflow, you can have data automatically analyzed, summarized, translated, or classified by an artificial intelligence model. --- ##…"
url: "https://www.kafinea.com/en/help/artificial-intelligence/ai-workflows/"
updated: "2026-04-13"
category: Artificial intelligence
---

# AI Workflows

---

## Introduction

**AI workflows** enable the automation of intelligent processing on Kafinea records. By adding an **AI Prompt** task to a workflow, you can have data automatically analyzed, summarized, translated, or classified by an artificial intelligence model.

---

## 1. Create a workflow with an AI task

1. Access **Settings > Automation and Communication > Workflows**
2. Create a new workflow or edit an existing one
3. Choose the target module (Contacts, Invoices, Quotes, etc.)
4. Define the trigger conditions
5. Add an **AI Prompt** task

---

## 2. Configure the AI Prompt task

The AI Prompt task consists of two parts:

### The prompt (instruction)

This is the textual instruction sent to the AI model. You can include module variables to customize the request.

**Prompt example:**

```
Résume en 2 phrases le contenu de la description suivante : $description
Classifie le niveau d'urgence du ticket parmi : faible, moyen, élevé, critique.
```

### The return field mapping

For each field the AI needs to fill, you configure:

- **The target field**: the record field to update
- **The specific instruction**: what the AI should generate for this field

> **Important:** The AI's response is expected in JSON format with field names as keys. The system automatically handles extraction even if the response contains text around the JSON.

---

## 3. Contextual data transmitted to the AI

The AI task automatically transmits the following to the model:

| Data | Description |
| --- | --- |
| **Record data** | All fields of the current record |
| **Parent records** | Data from linked records (contact, account, etc.) |
| **Module descriptions** | Field names and types, picklist values |
| **Detail lines** | For inventory-type modules (invoices, quotes, orders) |
| **Organization data** | Company information linked to the record |
| **Document content** | If the module is Documents, the content of the attached file |

---

## 4. Usage examples

### Automatic ticket summary

- **Module**: HelpDesk
- **Trigger**: On creation
- **Prompt**: "Summarize this support ticket in one concise sentence."
- **Target field**: `cf_summary` ← instruction: "A sentence summarizing the issue"

### Contact classification

- **Module**: Contacts
- **Trigger**: On save
- **Prompt**: "Analyze this contact's information and suggest a business segment."
- **Target field**: `cf_segment` ← instruction: "The segment from: SMB, Mid-Market, Large Enterprise, Individual"

### Product description translation

- **Module**: Products
- **Trigger**: On save
- **Prompt**: "Translate the product description into English."
- **Target field**: `cf_description_en` ← instruction: "The English translation of the description"

---

## 5. Error management

If the AI does not return a valid response, the workflow continues without updating the fields. Errors are logged in the server logs:

- **Missing API key**: check the AI gateway configuration
- **Empty response**: the prompt may be too vague or the data insufficient
- **JSON parsing error**: the system automatically attempts several extraction strategies

> **Tip:** Consult the PHP logs (`error_log`) to diagnose AI workflow execution issues.

---

## 6. Limitations

- The prompt size is limited by the AI model used (generally 4,096 response tokens max).
- Large image files or very long documents may be truncated.
- The workflow runs synchronously: a slow AI call can slow down processing.

---

## Related References

- [The scheduler](/200_automatisation/020_le-planificateur.md)
- [AI Chat](https://www.kafinea.com/en/documentation/artificial-intelligence/ai-chat/)
- [AI Text Assistant](https://www.kafinea.com/en/documentation/artificial-intelligence/the-ai-text-assistant/)
- [Connect an External AI (MCP)](https://www.kafinea.com/en/documentation/artificial-intelligence/connect-an-external-ai-mcp/)
- [AI-Assisted Invoice OCR](https://www.kafinea.com/en/documentation/artificial-intelligence/ai-assisted-invoice-ocr/)
- [AI agents](/250_parametrage/120_les-agents-ia.md)
