Skip to main content
Good agents start with good instructions. This guide walks you through writing a clear, structured prompt for your AI agent - step by step.

Why Your Prompt Matters

Your agent behaves exactly as you instruct it. Vague instructions produce vague behavior. The more specific and structured your prompt, the more consistently your agent performs — across every conversation, every edge case, every user.

The 5-Part Structure

Every agent prompt should have these five sections. Follow them in order.

1. Identity

Define who your agent is. Give it a name, a role, and a clear purpose. This sets the foundation for everything else. Write it like this:
Example:

2. Style

Tell your agent how to communicate — tone, length, language level. Be specific. “Be friendly” means nothing. “Keep responses to 2 sentences and never use jargon” does. Things to specify:
  • Response length (e.g. 2–3 sentences max)
  • Tone (e.g. warm, professional, direct)
  • Whether to use the customer’s name
  • How formal or casual the language should be
Example:

3. Rules

List what your agent must always do — and must never do. These are your guardrails.

4. Task

Break the agent’s job into numbered steps. One action per step. This is the core flow the agent follows in every conversation.
If your agent handles multiple use cases (e.g. returns AND product questions), write a separate task flow for each one.

5. Objection Handling

Tell your agent what to do when things don’t go smoothly. Cover at least three situations: confusion, frustration, and out-of-scope requests.

Using Variables

Variables let you personalize conversations automatically. They pull in real data — like a customer’s name or order number — without hardcoding it. Write variables in double curly braces: {{variable_name}} Common examples: Where to use them:
  • Greeting: "Hi {{customer_name}}, thanks for reaching out!"
  • Confirmation: "I've updated your order {{order_number}}."
  • Escalation: "Connecting you now, {{customer_name}}. One moment."
  • Closing: "Thanks for calling {{company_name}}. Have a great day!"
A variable only works if it’s been passed into the conversation or extracted during the call. If the data isn’t available, the agent will say the placeholder literally — like customer_name. Always make sure variable names match exactly what your system sends.
For a full variable reference, see the Extract Variables Guide.

Connecting Tools

If your agent has access to external tools or APIs, your prompt needs to tell it when to use them — and what to do after. Write each one as a trigger condition:
List a trigger rule for every tool your agent has access to. Don’t assume the agent will figure out when to use them on its own.

Controlling How Data Is Formatted

Voice agents don’t always speak numbers, names, and codes the way you expect. Without explicit instructions, an agent might read a phone number as “four hundred fifteen million…” instead of digit by digit - or pronounce an order ID incorrectly. Tell your agent exactly how to speak each type of data.

Why This Matters

The same value can be spoken in multiple valid ways. Your agent has no way to know which format you want unless you specify it clearly.

How to Write Voice Formatting Rules

Add speaking instructions to your Style or Rules section. Be explicit — say exactly how the agent should read values out loud.
If your voice agent handles phone numbers, addresses, dates, verification codes, or IDs, add a speaking rule for each one. Clear pronunciation rules make conversations much easier for callers to understand.

Common Mistakes to Avoid

These are the most frequent reasons an agent behaves inconsistently or unexpectedly.
  • Too vague on tone. “Be professional” is not enough. Say exactly what professional looks like for your brand.
  • Missing the unhappy path. Most prompts only describe the ideal flow. Always write what happens when something goes wrong.
  • Combining steps. If a step has two actions, split it into two steps.
  • Skipping tool triggers. If a tool isn’t mentioned in the instructions, the agent won’t know when to use it.
  • Untested variables. Always verify your variables are being passed in correctly before going live.
  • No formatting rules for data. If you don’t specify how to handle phone numbers, amounts, state names, or IDs, your agent will pick a format on its own — and it’s often wrong.