Agent procedures
Write step-by-step playbooks the agent follows for one kind of request, with if/then branches, tool calls and visitor placeholders, then publish them.
A procedure is a step-by-step playbook the agent follows for one kind of request, such as a cancellation, a refund or an escalation rule. You write the steps as you would brief a new teammate, add if/then branches, and name the tool a step should call. The agent follows the published version in order, one step at a time.
Create a procedure
Open Custom Actions and click New procedure
Procedures are listed in the Procedures section of that page.
Name it and describe the trigger
Name (up to 60 characters) and When should the agent run it? (up to 500). The agent compares each request with the trigger: "A customer wants to cancel or pause their subscription."
Write the steps
Up to 15 steps of up to 1,000 characters, in order: "Ask which subscription they mean and why they want to cancel." The arrows reorder steps; the bin removes one.
Name a tool for a step (optional)
Then call picks the tool a step uses: No tool, the built-in tools (Hand over to a human, Mark the conversation resolved, Collect contact details), your custom actions and your data forms.
Add branches (optional)
Add branch adds an If condition and a then instruction: "If the order is older than 30 days then explain the refund window has passed". Up to 5 branches per step. The optional Else says what to do when no branch applies.
Save draft or Save & publish
Save draft stores your work without the agent seeing it. Save & publish makes it live straight away.
Draft and published
The agent only ever reads the published version. Each procedure card shows where it stands:
| Badge | Meaning | Buttons |
|---|---|---|
| Draft | Never published, or unpublished. The agent does not use it. | Publish |
| Published | The agent follows this version. | Unpublish |
| Published + Unpublished changes | You saved edits as a draft. The agent still follows the earlier published version. | Publish changes, Unpublish |
Unpublish takes the procedure away from the agent and keeps the draft.
Use what you know about the visitor
Steps, branches and Else can include these placeholders, filled in when the agent fetches the steps.
| Placeholder | Filled with |
|---|---|
{{visitor.name}} | The visitor's name, when one was given |
{{visitor.email}} | The email address the conversation has |
{{visitor.customer_id}} | The customer id your site sent with its identity token, or the one on the visitor's contact |
{{visitor.plan}} | Any custom attribute, by its key (here plan). {{visitor.attr.plan}} works too. |
Attributes include those your site sent with its identity token and, when the visitor's email is proven, those stored on their contact, such as answers a data form saved there. A value that is not known is replaced with an instruction to ask the visitor, so Confirm the refund goes to {{visitor.email}}. reaches the agent with the address in place or with a request to ask for it.
How the agent follows a procedure
The agent's instructions list the name and trigger of every published procedure. When a visitor's request matches a trigger, the agent fetches that procedure's steps before it answers, then:
- works through the steps in order, one at a time, asking the questions a step needs;
- takes the branch whose condition holds, or the Else instruction when none does;
- does not skip or reorder steps, and does not improvise an outcome the steps do not allow;
- treats the procedure as finished only when its last step is done.
Steps that name a tool
Calling the tool is the step: the agent calls it in the turn it reaches that step, without asking the visitor first.
- Custom action: the agent collects the action's inputs and calls it, as described in Custom actions.
- Data form: the agent asks for the form's fields and submits it. Once the form is saved, it calls the tool of the next step, if that step names one, before it writes to the visitor.
- Hand over to a human: the business has already decided, so the agent hands over rather than offering to. It never tells the visitor that a person will take over unless it has actually handed over in that turn.
- Mark the conversation resolved and Collect contact details work the same way. The agent has the contact tool only while lead capture is on with When the agent needs a follow-up or Before handing off to the team, or while nobody can reply live and the visitor's email is unknown. Otherwise, use a data form with an Email field.
If a step cannot be completed, the agent says so and hands over to a human. If the custom action or data form a step names has been deleted or switched off, the agent tells the visitor it will pass the request on, and hands over.
Each time the agent fetches a procedure it counts in the Action calls card on Analytics as a built-in action, for example Procedure: Cancel a subscription.
Example
A refund procedure with the trigger "A customer asks for a refund or reports a damaged delivery":
- Ask for the order number and what went wrong. Then call: the "Refund request" data form.
- Check the order. Then call: your "Look up order" custom action.
- If the order is older than 30 days, then explain the refund window has passed.
- Else, confirm the request is saved and the team will review it.
- Pass the conversation to the team. Then call: Hand over to a human.
Test a procedure
Send a matching message in the Test the agent drawer, or save an agent test that must call Procedure: Cancel a subscription. Both use only published procedures, and custom actions named in a step run for real.
Limits
- 30 procedures per workspace.
- 15 steps per procedure and 5 branches per step.
- Name 60 characters, trigger 500, step 1,000, each branch condition, branch instruction and Else 400.
- Procedures are available on every plan.
Common errors
| Message | Meaning |
|---|---|
| A workspace can have at most 30 procedures | Delete one you no longer use. |
| Describe when the agent should run it (the trigger) | The trigger is empty. |
| Step 3 needs some text | Every step needs its own sentence, even when it only calls a tool. |
| Step 2: every branch needs both a condition and what to do | Fill in both halves of the branch, or remove it. |
| Step 2: "otherwise" needs at least one branch above it | An Else instruction needs a filled-in branch on the same step. |
Something missing or wrong on this page? Tell us and we will fix it.
