How procedures run in a conversation
Understand how the agent picks a procedure, follows its steps, asks for missing details, calls actions and when it stops or escalates.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
When a customer writes, the agent decides whether one of your procedures applies and then follows it step by step. This page explains what happens at each point, so you can write procedures that behave as you expect and fix the ones that do not.
For how to write them, start with procedures overview.
From message to procedure
- The customer sends a message.
- The agent compares the conversation with the When to use line of each procedure.
- If one fits, the agent starts it. If none fits, the agent answers from sources alone.
- The agent keeps the procedure in view for the rest of the conversation, until it is done or the topic changes.
The Playground shows the chosen procedure and the current step in the trace. See Playground.
Following the steps
The agent works through the steps in order, but it is not a script. It reads the whole procedure, then adapts to the conversation.
- Skips what is already known. If the customer gave the order number in the first message, the step "Ask for the order number" is done.
- Asks for what is missing. If a step needs information, the agent asks, and uses Collect data when you named it.
- Branches on conditions. For "If under 30 days, offer a refund", the agent checks the order date, then continues on the matching branch.
- Calls actions. When a step names an action, such as a Shopify lookup, the agent calls it and uses the result in the next step.
When two procedures could apply
The agent chooses the best match. If a request touches two procedures, for example a refund and an address change, it finishes the first and then moves on to the second. To keep choices clear:
- Give each procedure a distinct When to use line.
- Do not repeat the same condition across procedures.
- Put shared rules, such as how to greet a customer, in the agent's behavior, not in every procedure.
When a procedure ends
A procedure ends when the last step is done, when the customer changes topic or when it escalates. A step that says "escalate" calls Escalate to human, which creates a ticket with a summary of what has been done so far.
If an action fails, for example a lookup returns an error, the agent tells the customer it could not complete the step and follows the fallback you wrote. If you did not write one, it escalates.
Note: A procedure guides the agent. Guardrails always apply on top. A step cannot make the agent discuss a refused topic.
Troubleshoot a procedure
| Symptom | Likely cause | Fix |
|---|---|---|
| The procedure never starts | The When to use line is too narrow | Describe the customer's request in their words. |
| The wrong procedure starts | Two lines overlap | Make each one more specific. |
| A step is skipped | The step is vague | Write one action per step. |
| The agent invents a policy | The rule is not written down | Add it to the procedure or a source. |
After any edit, replay your tests to confirm other procedures still behave.