Skip to main content
A Procedure captures how your AI agent should handle a specific situation as a repeatable, standard operating procedure (SOP). Each one pairs a trigger (the situation that engages it) with an ordered list of steps the AI agent works through, including the Actions it calls along the way. Reach for Procedures on high-stakes flows like refunds, escalations, and onboarding, where you don’t want the AI agent improvising. Procedures run in your AI agent’s conversations on every channel where the Actions they reference are available, such as the Chat Bubble, WhatsApp, or email. You build them in Build > Procedures.

When to use a Procedure

Reach for a Procedure when the order of steps matters (look up the order before offering a refund), when there are eligibility rules (orders older than 30 days go to your team), or when an Action is sensitive. For sensitive Actions, also turn on Only use in Procedures so the Action can only run after the Procedure’s checks pass. If a single rule covers the case, such as “Share our returns page link when customers ask about returns,” keep it in your instructions.
Image

Anatomy of a Procedure

Every Procedure has three parts:
Image

Steps

Steps run in order, top to bottom. There are two kinds:
  • Instruction steps: a plain instruction the AI agent follows (“Ask the customer for their order number”).
  • Branch steps: a decision point with one or more if / else if conditions and an optional otherwise. The AI agent evaluates the conditions top-to-bottom, runs the first matching branch, then continues after the branch.
Limits: up to 15 instruction steps per Procedure, up to 5 branches per decision point (if / else if / else), and a branch can’t be nested inside another branch.

Referencing Actions with @

Inside a step, type @ to reference an Action the AI agent should run at that point (for example @lookup_order). When the AI agent reaches that step, it invokes the tool.
Referencing an Action in a step with @
If a step references an Action that isn’t available on the current channel, the entire Procedure is skipped for that conversation. See How Procedures run.
If a step references an Action that doesn’t exist or is disabled, the editor flags it and won’t let you enable the Procedure until you fix or remove the reference.

Using variables with {{ }}

You can personalize your steps and branch conditions with {{token}} variables that are resolved at runtime. Type {{ in a step or condition to open the picker, which groups the available variables into:
A variable resolves only when its value is available for the conversation. For example, {{user.email}} is empty unless the embedding site passes it, and {{contact.*}} requires a matched contact. Write steps so the AI agent can still proceed (or asks for the value) when a variable is missing.
Inserting a variable token in a step

Start from a template

Don’t want to build from scratch? Open the Templates tab to browse ready-made Procedures for common flows like order returns, subscription cancellations, and billing disputes, all grouped by category. Pick one to create an editable copy, then tailor its trigger and steps to your business.

Creating a Procedure

1

Open the Procedures tab

Go to your AI agent and then click on Build from the side bar, then open Procedures, then click Add Procedure (or start from a template).
2

Name it and define the trigger

Give it a clear name, then use the When to use field to describe the trigger: the situation that should route the conversation to this Procedure.
3

Add steps

Add instruction steps, reference Actions with @, add variables with {{ }}, and add conditional branches where the flow forks.
4

Enable it

Save and set the Procedure to Active. Only active Procedures are considered at runtime.
Saving puts your changes in a draft. Your customers see them once you click Publish in the top-right corner. A few settings go live as soon as you save. See Drafts and versions.

Examples

The examples below show the step syntax in practice. The Action names are examples: type @ in a step to pick the Actions on your own AI agent.

Refund request

This Procedure uses Shopify Actions to check an order before refunding it, and sends older orders to your team with Escalations. When to use: The customer wants to return an item or get a refund for a past order. Steps:
Step 2 is a branch step with a single if and no otherwise, so a recent order skips it and moves on to step 3. To make sure the return only happens through this flow, turn on Only use in Procedures on the Create_Return Action.

Damaged or missing item

This Procedure collects the details of an order issue, then hands the customer to a person in real time if someone is available, or opens a ticket if not. It uses Chatbase live chat and Escalations. When to use: The customer says an item in their order arrived damaged, is missing, or is the wrong item. Steps:
{{agentAvailable}} is true when at least one human Helpdesk agent is available, so this Procedure only offers live chat when someone can answer. Because Chatbase checks every Action a Procedure references, including those inside branches, the Procedure is skipped on any channel where Get_Orders, live chat, or Escalations is off. See How Procedures run.

Analytics

Open a Procedure and switch to the Analytics tab to see how it’s performing over a date range you choose: A trend chart below the counters breaks the same numbers down by day, so you can spot patterns (for example, a spike in refund requests) at a glance.
Procedure analytics tab

Frequently asked questions

A Procedure can have up to 15 instruction steps. Each branch step can have up to 5 branches (if, else if, and otherwise), and a branch can’t be nested inside another branch.
No. The AI agent runs at most one Procedure per turn, the one whose trigger best matches what the customer is asking for right now. It can switch to a different Procedure on a later turn if the customer changes topics. To handle two things together, combine them into one Procedure with branches. See How Procedures run.
No. A step can be a plain instruction, such as “Ask the customer for their order number.” Reference Actions with @ only where the AI agent needs to look something up or make a change.
A Procedure is skipped on any channel where one of its referenced Actions is disabled or not supported, even if that Action is inside a branch that never runs. Turn on every referenced Action for that channel in the Action’s Channels section.
Open the Procedure’s Analytics tab to see how many runs were triggered, pending, and resolved. In Activity, filter conversations by Procedure used or Procedure result to read the conversations themselves.

Next steps

How Procedures run

Understand triggering, one-Procedure-per-turn, and how Procedures interact with Actions.