A single big prompt works for a demo, but on real calls it drifts: the agent forgets steps, invents data, or can't reliably hand off to a human. The fix is a structured flow — a graph of nodes, each with one job and explicit transitions. Let's make that concrete with an order-status agent, broken down node by node.
This is the Order Status (AI Flow) template — a real, multi-branch flow you can deploy. (For a from-scratch overview, see how to build a voice bot in 2026.)
Why a flow instead of one big prompt
In a structured AI Flow, the conversation is a graph: each node has a focused instruction and a set of functions it can call to move to the next node. The agent can only do what the current node allows, so it can't skip identity checks, can't wander, and always has a defined path to a human. The trade-off vs a free-form prompt is a little more upfront design for a lot more reliability.
The order-status flow, node by node
1. greet — Greets the caller, introduces the agent, and asks whether they have an order ID or would prefer to look up by phone number. It can call two functions: lookup_by_order_id or lookup_by_phone. If the caller asks for a person, it calls transfer_to_human.
2. lookup_by_order_id / lookup_by_phone — These are data-lookup functions (an HTTP call to your backend). The order-ID lookup takes the ID the caller said (e.g. "EM-1042"); the phone lookup uses their number. Crucially, the agent is told to read back only real order data — never make it up.
3. show_status — With the order found, it reads the status plainly and asks if the caller needs anything else. Yes → more_help; no → end_call.
4. not_found — If no order matched, it says so honestly and offers to try the other lookup method or transfer to a human — it doesn't pretend or guess.
5. transfer_to_human — A clean escape hatch to a live agent, available from the start of the call.
6. end_call — Wraps up politely once the caller is done.
What makes this reliable
- No hallucinated data — order details come from a real lookup function, and the agent is instructed never to invent them.
- Always an exit to a human —
transfer_to_humanis reachable throughout. - Honest failure — the
not_foundbranch handles "we couldn't find it" gracefully instead of bluffing. - Natural speech — nodes instruct the agent to speak conversationally (contractions, no markdown), so the structure never sounds robotic.
Beyond order status
The same pattern — greet → branch → data lookup → resolve/transfer → end — generalizes to any transactional call: balance enquiries, ticket status, delivery tracking, KYC checks. Start from the Empty AI Flow template and add your own nodes and lookup functions.
Try it
The order-status agent is a working template — see it in action on the order-status voicebot, or build your own flow on the Edesy voice AI platform.