> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatling.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows

> Automate tasks when events happen in your AI Agent.

Workflows automatically perform tasks when selected events happen in your AI Agent. Use them to update conversations and contacts, send messages, connect other apps, and route work based on conditions.

## How workflows work

* **[Triggers](/ai-agent/workflows/triggers)** start the workflow when an event occurs.
* **[Actions](/ai-agent/workflows/actions)** perform tasks such as sending messages or updating contacts.
* **[Conditions](/ai-agent/workflows/condition)** route the workflow based on rules you define.

## Create a workflow

1. Open your AI Agent and select **Workflows**.

<img src="https://chatling-assets.b-cdn.net/click-workflows-menu.jpg" width="300" />

2. Click **New** or **Create workflow**.
3. Enter a name and optional description.

<img src="https://chatling-assets.b-cdn.net/create-workflow-dialog.jpg" width="400" />

4. Select the **Start** node and add one or more trigger events.

<img src="https://chatling-assets.b-cdn.net/add-start-triggers.jpg" width="500" />

5. Add actions and conditions from the left sidebar.
6. Connect the steps in the order they should run.
7. Click **Publish** to activate the workflow.

<Note>
  Only the published version runs. Changes remain in draft until you publish them.
</Note>

## Use variables

Insert variables into supported fields by typing `{{` or opening the variable menu.

You can use:

* System variables
* Custom variables

If a system variable is unavailable, select **Import system variables** from the variable menu.

## Publish and manage

* **Save:** keeps your current draft.
* **Publish:** makes the latest draft available to run.
* **Activate:** allows the workflow to respond to new events.
* **Pause:** stops the workflow from running.
* **Duplicate:** creates a copy you can edit separately.
* **Archive:** removes the workflow from active use while keeping it available.

## Review activity

* **Run history:** view recent runs, each completed step, and any errors.

<img src="https://chatling-assets.b-cdn.net/open-run-history-workflows.jpg" width="500" />

* **Version history:** preview published versions or restore one as the current draft.

<img src="https://chatling-assets.b-cdn.net/open-version-history-workflows.jpg" width="400" />
