Skip to content
QwryAI
Documentation
Pages

AI Agent Management

How your AI agent chooses and runs Procedures

How your agent decides which Procedure to follow, when a Procedure won't start, and how Procedure-only Actions keep sensitive tools on rails

When a message comes in, your agent looks at your Live Procedures, decides whether one applies, and if so, follows its steps. This page explains the rules behind that decision, so your Procedures behave predictably.

Most surprises with Procedures come from these rules: a Procedure that doesn't run on one channel, a flow that switches partway through, or an Action that never runs on its own. Knowing how a message is handled makes these easy to diagnose.

What happens on one message

Here's one message in a WhatsApp conversation, where you have an "Order not received" Procedure that uses @Get order status and @Create ticket:

  1. The customer sends a message

    The customer writes "My order still hasn't arrived."

  2. Your agent gathers the Procedures it can use

    Only Live, published Procedures are considered. A Procedure with a Channel chip is only considered on the channels it lists, so "Order not received" stays in the running on WhatsApp only if it has no Channel chip or its chip includes WhatsApp. Procedures that only start from No reply, API or ticket-event chips aren't considered for customer messages at all.

  3. Your agent picks at most one Procedure

    The "Order not received" trigger matches the request, so your agent starts it. Procedures come first: when a Procedure's When to trigger covers the request, your agent follows the Procedure instead of calling a matching Action on its own. If no Procedure applies, your agent answers without one.

  4. Your agent works through the steps in order

    It follows each step from the top. At a condition, it checks the branches from the top, follows the first one that matches, then carries on after the condition. When a step references an Action, your agent calls it, including Actions set to Only use in Procedures.

  5. Your agent waits when it needs the customer

    If a step needs something from the customer, such as an order number or a confirmation, your agent asks and stops there. On the next message, the Procedure continues where it left off, unless the customer asks for something another Procedure handles.

Only one Procedure runs at a time

For each message, your agent follows at most one Procedure: the one whose When to trigger best matches what the customer is asking for right now. It never follows two Procedures in the same reply.

This isn't a lock. While a Procedure is in progress, it stays selected when the customer's message continues it: answers, corrections, approvals, refusals, or questions about it. If the customer asks for what another of your Procedures handles, that Procedure replaces the active one.

Limiting a Procedure to some channels

By default, a Procedure can run on every channel your agent answers on. To limit it, add a Channel chip to When to trigger and pick the channels. The Procedure is then only considered in conversations on those channels.

What this means for you: if a Procedure runs in one channel but seems ignored in another, check its Channel chip first.

Procedure-only Actions

By default, your agent can call any Action on its own whenever the Action's When to use matches. Sometimes you want the opposite: an Action your agent should never reach for by itself, and only ever run as a step inside a Procedure. For example, a refund Action you only want run after the refund Procedure's checks have passed.

Turn on Only use in Procedures in the Action's settings to do that. The Action stays on, but:

  • Your agent never selects it on its own, so its When to use field is hidden. It no longer needs one.
  • It runs only when a Procedure step references it with @.

This keeps sensitive tools on rails: they can't run outside the flow you designed. See Actions for where to find the setting.

Waiting on the customer

When a step needs details from the customer, or their confirmation before an Action changes something, your agent treats it as a pause, not a failure. It asks the customer and stops. When the customer answers, approves, corrects a detail or says no, the same Procedure continues from that step.

Troubleshooting

My Procedure never triggers

Check that it's Live and published, and that its When to trigger describes the customer's request clearly and differently from your other Procedures. Overlapping triggers can let another Procedure win. If its only triggers are No reply, API or ticket events, it never starts from a customer message.

It works on the website but not on WhatsApp or another channel

Check the Channel chip in When to trigger. With one, the Procedure only runs on the channels it lists.

Two things should happen at once

Only one Procedure runs at a time. Combine the flow into one Procedure with conditions, rather than expecting two Procedures to run together.

A Procedure-only Action never runs

An Action with Only use in Procedures on runs only when a step references it with @. Check that a Procedure references it, and that the Procedure is Live and published.

My agent switched to a different flow partway through

The customer asked for something another Procedure handles. Make each When to trigger describe a distinct situation, so they don't overlap.

My agent stopped and is waiting

A step needs the customer's details or confirmation. This is a pause, not a failure: the Procedure continues from that step once the customer answers.

I can't turn my Procedure on

Your plan limits how many Procedures can be live at once: 4 on Free and Starter, 12 on Growth, unlimited on Enterprise. Pause a live Procedure first, or upgrade.

Frequently asked questions

Can a customer leave a Procedure before it finishes?

Yes. A Procedure isn't a lock. If the customer asks for something another Procedure handles, your agent moves to that Procedure.

Can an Action used in a Procedure also run outside it?

Yes, by default. Your agent can also call the Action on its own whenever its When to use matches. Turn on Only use in Procedures to stop that.

Do Procedure-only Actions need a When to use?

No. With Only use in Procedures on, your agent never decides when to call the Action, so its When to use field is hidden. The Procedure step that references the Action decides when it runs.

Do Procedures take priority over Actions?

Yes. When a Procedure's When to trigger covers the request, your agent follows the Procedure instead of calling a matching Action on its own. The Procedure runs its Actions itself.

Explore the documentation