# Procedures

> Turn your SOPs into steps an agent follows in a conversation or on a board item, with approvals, simulations, and versions.

Source: https://docs.getlinkai.com/agents/procedures

A procedure turns one of your SOPs into steps an agent follows in a conversation or on a board item. It keeps the agent focused and walks it through several tools in order, so the form, the visit, the board update, and the handoff finish as one job you can see.

Use procedures for any process you would hand a new teammate as a checklist: qualifying a lead, booking a visit, following up on a quote, escalating a complaint.

![The Procedures tab on an agent](https://docs.getlinkai.com/screenshots/v2/agent-procedures.png)

## When to use a procedure

| Tool | What it is | Use it when |
| --- | --- | --- |
| **Instructions** | The agent's general prompt on the **Agent** tab. | You want to shape tone, scope, and rules for every conversation. |
| **Actions** | Single tools the agent can call, like Calendar or Smart Forms. | One tool answers the request, and the agent can decide when to use it. |
| **Procedures** | Ordered steps that chain tools and board actions, with approvals. | A job has a fixed order and must finish the same way every time. |
| **Workflows** | Trigger and steps across tools, with no conversation. | Something should happen in the background, like a new lead creating a board item. |

## Create a procedure

Open an agent from **My Agents**, go to the **Procedures** tab, and click **New procedure**. Pick how to start:

| Option | What it does |
| --- | --- |
| **From past conversations** | Pick real conversations or tickets, and the agent drafts the steps from them. |
| **Let Ally build it for you** | Describe the job, and Ally writes the procedure. |
| **Start from scratch** | Opens an empty procedure in the editor. |

Then set it up in the editor:

### Name it
Click the name in the header and give the procedure a name your team will recognize, like "Book a showroom visit".

### Describe when to use it
Under **When to use**, describe the condition in plain words, for example "The customer wants to see a product in person." Leave it blank to start the procedure only from events.

### Train on examples (optional)
Click **Train on examples** to add messages under **Use when** and **Don't use when**, up to 20 each. The agent reads them when deciding to start.

### Set the audience and board
Click **Audience** to choose **Everyone** or **Some people**, and which channels. Pick a **Board** so every run has an item and your steps can use its fields.

### Add events (optional)
Under **Based on events**, click **+** to start the procedure when something happens on a board. See [Board events](#board-events).

### Write the steps
Under **Instructions**, write the steps in order. Press **Enter** to start the next step. Type **@** to insert a tool, a board action, or a logic step, and **{{** to insert a field.

### Run simulations
Click **Test** and add simulations with pretend customers. See [Simulations](#simulations).

### Publish
Click **Publish**, add an optional change note, and confirm. The status changes to **Live**.

![The procedure editor with When to use, events, and instructions](https://docs.getlinkai.com/screenshots/v2/procedure-editor.png)

You should see the procedure in the list with the status **Live** and the condition under **Starts when**.

## Board events

A procedure can start from a board, not only from a conversation. Add up to five events under **Based on events**.

| Event | Starts when an item |
| --- | --- |
| **Board event** | is created, enters a status, has a field change, gets a message (from them, from us, or either), is assigned, gets a file, or gets a comment |
| **Time in a status** | has been in a status for a set time, at least 5 minutes. Count business hours only, and repeat up to 100 times. |

Narrow an event with **Only when a rule holds** or **Only items owned by this agent**. Use **Time in a status** for follow-ups, like checking in on a quote that has waited three days.

## Step types

Type **@** in a step to pick its type.

| Step | What it does |
| --- | --- |
| **Instruction** | Tells the agent what to do in plain words. |
| **Action** | Calls one of the agent's tools, like Calendar or Smart Forms. |
| **Item actions** | From the **Items** group, act on the run's item: **Create item**, **Update fields**, **Move to status**, **Assign person**, **Add comment**, **Attach file**, **Link items**, **Set date**, **Notify someone**, **Ask Ally to work on it**, and more. |
| **Condition** | **If**, **Else if**, **Else**. Let **Your agent decides**, or write an **Advanced rule**. |
| **Check** | Confirms something is true before the agent moves on. |
| **Approval** | Stops until a named teammate approves or rejects. See [Approvals](#approvals). |
| **Wait** | Waits for a reply, a status, a field change, or a set time, with **Give up after**. |
| **Send approved message** | Sends a message your team wrote and approved, word for word. |
| **Sub-procedure** | Runs another procedure. |
| **Hand off** | Passes the conversation to a person, with a **Note**. See [Human Handoff](https://docs.getlinkai.com/agents/human-handoff). |
| **End** | Finishes the run as **Resolved**, **Cancelled**, or a custom outcome. |

A procedure can have up to 30 steps and two levels of nesting. Open a step's **Settings** to set its **Title**, whether it is **Required**, **Done when**, **Max turns**, and **If it fails**: tell the agent, go to a step, hand off to a person, or end as cancelled.

## Approvals

Add an **Approval** step where a person must sign off before the agent continues, like a discount, a refund, or an exception.

- **Approvers:** the item's person field, specific teammates, or a role. The first rule that matches decides who approves. The agent never approves for anyone.
- **Approval message:** what the approver reads.
- **Expires after:** 3 days by default, or never.
- **Outcomes:** choose what happens when the request is approved, rejected, or expires.

Teammates get a notification and an email that opens the item, and approve or reject with an optional note. Guests get a single-use link by SMS or email. The agent continues with the result.

## Simulations

Click **Test** to open **Simulations**. A simulation is a pretend customer with a **Scenario**, a **Channel**, and **Checks**: what a good answer must do, one per line. Pick the outcome you expect, such as **Resolved** or **Handed off to a person**.

Nothing is saved or sent while a simulation runs. Each one shows **Passed**, **Failed**, or **Could not run**. Use **Suggested** simulations, or add them from real conversations and tickets. When you publish, you can run all simulations first.

## Publish and versions

Each publish creates a new version. The **Publish version** dialog shows **What changes**, and runs already in progress finish on the version they started with. Open **History** and **Versions** to see who published each version, and **Restore** an older one into your draft.

## Statuses and metrics

| Status | What it means |
| --- | --- |
| **Live** | The agent follows the procedure in conversations and on board events. |
| **Live, edited** | Live, with draft changes that are not published yet. |
| **Draft** | Saved but not in use. Test and publish when ready. |
| **Paused** | Turned off for now. Settings are kept. |
| **Archived** | Read-only. |

The list shows how each procedure performs:

| Column | What it shows |
| --- | --- |
| **Starts when** | The condition or event that starts the procedure. |
| **Outcomes** | Runs that finished as designed: resolved, a custom outcome, or a handoff you planned. |
| **Outcome rate** | Outcomes as a share of finished runs. |
| **Resolution rate** | Resolved runs as a share of finished runs. |
| **In progress** | Runs that are running or waiting. |

Search the list, filter by **Any status**, **Live**, **Draft**, or **Paused**, and sort by **Recently updated**, **Name**, or **Live first**.

## Runs

Open **History** and **Runs** to see every run, filtered by **In progress**, **Waiting**, **Resolved**, **Handed off**, or **Failed**. A run page shows each step the agent took, with values, cost, and messages. You can **Pause**, **Resume**, **Hand off**, or **Cancel run**. Board items link to their runs from the item's activity with **View run**.

## System procedures

Every agent comes with two system procedures under **Link system procedures**. They are already configured, and the agent follows them without one you write.

| Procedure | Starts when |
| --- | --- |
| **Ticket for escalation** | Someone needs a person. Shows **Off** when Smart Tickets is off. |
| **Contact sign-ups** | Someone messages the agent. |

## Settings

Open **Settings** in the editor header to set:

- **Runs at the same time:** one per item or conversation, or one per trigger event.
- **Model:** the model that runs the procedure.
- **Run timeout:** how many days a run can stay open, 90 by default.
- **Hand-off target:** who gets the conversation when a step hands off.

## Example: Book a showroom visit

**Tip: Example**
This is a sample procedure to show the shape of good instructions. Tool and field names in your workspace may differ.

**When to use:** The customer wants to see a product in person or asks to visit the showroom.

**Board:** Leads

**Instructions:**

1. Ask which product the customer wants to see and confirm {{customer name}} and {{phone number}}.
2. Use @Smart Forms to collect the visit details: product, preferred day, and number of visitors.
3. Use @Calendar to check showroom availability and offer the customer two open times.
4. If the customer asks for a private after-hours visit, @Approval from the showroom manager before you confirm.
5. Book the chosen time with @Calendar, then @Move to status "Visit booked".
6. Confirm the date, time, and address to {{customer name}} in one short message.

## Best practices

- **One job per procedure.** Split a long process into two procedures, or use a **Sub-procedure**.
- **Write the condition the way customers talk.** "Wants to visit the store" works better than an internal code.
- **Name the tool in each step.** Use **@** so the agent knows exactly which tool to call.
- **Put approvals where money or risk is.** Discounts, refunds, and exceptions are good places for a sign-off.
- **Simulate before every publish.** Cover the happy path and at least one edge case.

## Next steps

**[Actions](https://docs.getlinkai.com/agents/actions)**:
Enable the tools your procedures call.

**[Boards](https://docs.getlinkai.com/products/boards)**:
See where agents and people share work.

**[Workflows](https://docs.getlinkai.com/agents/workflows)**:
Automate background tasks across your tools.

**[Human Handoff](https://docs.getlinkai.com/agents/human-handoff)**:
Bring a person in when the job needs one.
