> ## Documentation Index
> Fetch the complete documentation index at: https://control-dev.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Build and publish a workflow

> Create an agent workflow from a template or blank draft, edit its instructions and tools, validate it, and publish an immutable version.

# Build and publish a workflow

Follow this workflow to take an idea from a starter template to a published, immutable agent version that can run on manual, cron, or event triggers.

## Workflow overview

```text theme={null}
Choose a template → Edit the draft → Validate → Publish version → Run or wait for a trigger
```

## Before you begin

* Open the Studio from the **Agents** entry in the main navigation.
* Decide which trigger you want (manual, schedule, month-close readiness, new counterparty, or signed external event). See [Trigger workflows](/product-docs/agents/triggers).
* If the workflow will read from or write to Slack or Gmail, connect those accounts first. See [Connect Slack, Gmail, and event sources](/product-docs/agents/connections).

## 1. Start from a template or a blank draft

The **Agents** view lists the workflows already in the tenant and the built-in templates.

Built-in templates:

| Template                      | Category            | What it does                                                                                                                                                    |
| ----------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Monthly management report** | Close automation    | Waits for the `finance.monthly_close.ready.v1` event, then summarizes revenue, profitability, cash flow, and material changes with source links.                |
| **Daily finance digest**      | Scheduled reporting | Runs every morning on a cron trigger and delivers a compact daily pulse of KPI movement and issues to follow up on.                                             |
| **New counterparty review**   | Continuous control  | Reacts to the `finance.counterparty.identified.v1` event and reviews the counterparty using Control's transaction history without changing any accounting data. |

To start a workflow:

1. In the **Agents** view, select a template card or **Blank draft**.
2. The Studio opens the **Builder** with a new draft attached to the workflow.

**Checkpoint:** The workflow appears in the agents list with status `Draft` and no published version.

## 2. Edit the draft in the Builder

Every workflow has one editable draft. Save it as often as you like; nothing runs until you publish.

Fill in the following:

* **Name and description.** Use a name that reads well in the Approvals view when a reviewer sees a proposal from the workflow.
* **Instructions.** The prompt the agent follows on every run. Be explicit about scope, the evidence to cite, and what to do when data is missing.
* **Output instructions.** Describe the shape of the final answer, for example "return an executive summary, material variances, cash observations, risks, and source links."
* **Tools.** Enable only the Control data reads the workflow needs. Each tool card shows its provider, description, and risk label. Tools that talk to Slack or Gmail also let you pick a specific connection and a fixed destination.
* **Triggers.** Manual is always on. Add a schedule, subscribe to a Control event, or accept signed external events. See [Trigger workflows](/product-docs/agents/triggers) for the full list.

> **Governance:** Tool grants are explicit. If a tool is not enabled on the draft, the agent cannot read that data at run time.

**Checkpoint:** Select **Save draft**. The workflow's `updatedAt` timestamp advances and the toast confirms **Draft saved**.

## 3. Validate the draft

Validation checks that the draft is internally consistent before you publish. It reports errors that block publication and warnings you can review.

1. Select **Validate**.
2. Read the returned errors and warnings.
3. Fix any errors and validate again.

**Checkpoint:** A valid draft shows **Workflow is ready to publish**.

## 4. Publish an immutable version

Publishing seals the current draft into a numbered version. The version stores the instructions, output contract, tool grants, and trigger set, along with a snapshot checksum. Later edits will start a new draft; publishing that draft produces the next version.

1. Select **Publish**.
2. The workflow's status becomes `Active` and its current version increments.
3. Scheduled and event triggers begin producing occurrences on the new version.

**Checkpoint:** The Builder shows **Version N published** with the publisher's identity and timestamp.

## 5. Run the workflow

You can trigger a run at any time, even before wiring up a schedule or event, to confirm the workflow behaves as expected.

1. In the Builder, enter optional test input.
2. Select **Run now**.
3. Move to the **Runs** view to watch the run progress. See [Review runs and approvals](/product-docs/agents/runs-and-approvals).

## Managing published workflows

Use the workflow's action menu in the Builder or Agents view for lifecycle actions:

| Action      | Effect                                                                                                                          |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Pause**   | Stops scheduled and event triggers from producing new occurrences. Existing runs continue. Manual runs are still allowed.       |
| **Resume**  | Re-enables triggers on the currently published version.                                                                         |
| **Clone**   | Copies the workflow's draft into a new agent so you can iterate on variants without disturbing the original.                    |
| **Archive** | Removes the workflow from the active list. Published versions, occurrences, runs, and audit history are retained for reference. |

## Verify the completed workflow

* Confirm the current version number and publisher shown in the Builder match the change you intended.
* Trigger a manual run and inspect the events and output in the **Runs** view.
* If a schedule is enabled, verify the **Next runs** preview lists the times you expect in the tenant's time zone.
* If an external write is proposed, confirm the payload and fixed destination in the **Approvals** view before approving.

## Related tasks

* [Trigger workflows](/product-docs/agents/triggers)
* [Review runs and approvals](/product-docs/agents/runs-and-approvals)
* [Connect Slack, Gmail, and event sources](/product-docs/agents/connections)
