> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/advanced-functions-and-tools/docbits-operator/triggering-prompts-with-a-workflow.md).

# Triggering Prompts with a Workflow

This guide explains how to configure a DocBits workflow to automatically trigger a saved prompt. This allows you to integrate Operator prompts into document processing flows without manual input.

### Step 1: Create a Prompt

Before linking a prompt to a workflow:

* Ensure your prompt is already created
* Include all necessary **variables** in the prompt body.

If you need help writing or saving prompts, refer to the [Prompt Writing Guide](/advanced-functions-and-tools/docbits-operator/prompt-writing-guide.md) and [Operator Interface Overview](/advanced-functions-and-tools/docbits-operator.md).

### Step 2: Set Up the Workflow

Before configuring the Operator Prompt card, make sure your workflow is properly created.

1. Navigate to the **Workflow Builder** in the DocBits interface.
2. Create a new workflow or open an existing one.
3. Define the **trigger conditions**—these determine when the workflow will start (e.g., document type, status, field presence, etc.).
4. Add the necessary **action steps** to your workflow as needed.

<div align="left"><figure><img src="/files/9mZ5R9PgmDhwHXZDa5kQ" alt="Workflow Setup Example"><figcaption></figcaption></figure></div>

### Step 3: Configure the Operator Prompt Card in the Workflow

In the Workflow Builder, use the **Operator Prompt card** to configure a prompt that should execute when the workflow's conditions are met.

<div align="left"><figure><img src="/files/7Y1GmFIGdGBH2somTiiZ" alt="Operator Prompt Card Configuration"><figcaption></figcaption></figure></div>

#### Key Configuration Options

* **Script:** Select the saved **Organization Prompt** to be executed.
* **Script Data (Variables):** If the selected prompt contains variables, define their values here using key-value pairs.
  * If a variable is left empty here, the system will attempt to automatically populate it **from the document**.
  * For this to work, the variable name in the prompt must **exactly match** the **field ID** of the document attribute.
* **Max Steps:** Define the maximum number of steps the operator is allowed to execute during this prompt.
* **Max Retries:** Set how many times the system should retry the prompt in case of failure.
* **Execution Mode:** Choose whether the prompt should run:
  * **In the Cloud**
  * **On-Premises** (required if your ERP or target system is hosted locally)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.docbits.com/advanced-functions-and-tools/docbits-operator/triggering-prompts-with-a-workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
