Loops and outbound
Loops are how work happens without anyone asking: on a schedule, after an event, through several steps, with people approving along the way. This page covers when and how to use them, and when outbound messaging belongs in raia Control instead.
Do you need a Loop?
If someone asks and the agent answers, you don't. Reach for a Loop when the work:
- Starts from a schedule, a webhook or an incoming email.
- Has several steps in a set order.
- Branches depending on what happened.
- Needs a person to approve something.
- Needs a lasting record of each run.
Triggers
A Loop can start by hand, on a schedule (down to every few minutes), from a webhook, or when an email arrives. Examples include a new lead in your CRM, a conversation ending, a ticket being marked as a bug, a morning summary, or a weekly changelog.
For each trigger, decide whether two runs may overlap, give each run a clear objective, and set any trigger limits that are offered.
Three kinds of step
An agent does the work
Sends a task to a named raia cX agent, which uses its own knowledge, instructions and tools. Use it when the step needs domain knowledge, retrieval or external actions. The agent can also send an email with a recipient, subject and body built from earlier results.
The Loop AI processes the result
Reshapes, summarizes, classifies or scores what came before, with no agent involved. Use it for simple, self-contained transformations. It can't take actions in other systems.
A person decides
Pauses the run until enough named people approve or reject. A rejection can send the work back to an earlier step with feedback, so it's revised rather than abandoned.
Branches, outcomes and safety limits
Branch on named results, values, thresholds and human decisions: go to the next step, jump to a named step, finish, or fail. Define the outcome the run must produce, so success is checked rather than assumed.
Set safety limits on every Loop: caps on tokens, time, number of steps and external actions. They stop a run that goes wrong from running on.
Each run keeps a permanent history of what happened. Publishing a new version of a Loop affects new runs only, never runs already in progress.
Proof that it happened
An agent saying "done" is not evidence. When the outcome matters, design the step that proves it: a case number from the CRM, a saved record, a returned ID.
Common shapes
| Shape | Flow |
|---|---|
| Document every conversation | Conversation ends, webhook, Loop, agent creates the record |
| Morning digest | Schedule, agent fetches and prioritizes, Loop AI formats, email step |
| Approved action | Event, agent drafts, person decides, agent acts, result checked |
| New-lead follow-up | CRM event, agent enriches, agent drafts, person approves, message sent, CRM updated |
See the Pattern library for each of these in detail.
raia Control or a Loop?
raia Control runs outbound campaigns: missions over imported contact lists, with ongoing sequences and campaign reporting. A Loop handles messages triggered by a single event.
| The request | Use |
|---|---|
| Message everyone on a list, with follow-ups over time | raia Control |
| Reply to each new website lead with one personalized email | A Loop triggered by the new lead |
| Find and prepare prospects, then hand them to a campaign | A Loop for preparation, then raia Control for the campaign |
Don't choose Control just because the request mentions outbound. And don't build a Loop for every prospect when the real need is a campaign.
Before any outbound message goes live
- People have consented to hear from you on this channel.
- Unsubscribe requests are honored and suppression lists are applied.
- The message types are permitted for this audience.
- Provider sending limits are known.
- Someone owns legal and compliance sign-off.
- Early messages are reviewed by a person before automation takes over.