> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetecho.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing Agent Prompts

> How to write system prompts that produce consistent, reliable voice calls.

## The system prompt is everything

Your agent's `system_prompt` is the complete definition of how the call will go. The AI receives nothing else — no product docs, no account history, no implicit context. Everything the AI knows and everything it says comes from this prompt.

A well-written prompt produces calls that are on-brand, on-topic, and reliably structured. A vague prompt produces inconsistent calls that drift off topic.

***

## Rule 1 — Always define the opening line

The most common mistake is writing a prompt that explains the agent's role but doesn't tell it what to say when the call connects.

When a call is picked up, the AI needs to speak first. If you don't tell it exactly what to say, it will improvise — and that improvisation is often awkward.

<CodeGroup>
  ```text Vague (avoid) theme={null}
  You are a billing assistant for {{business_name}}. Help users with payment issues.
  ```

  ```text Explicit (recommended) theme={null}
  You are a billing assistant for {{business_name}}.

  Start the call by saying: "Hi, is this {{recipient_first_name}}? Great — I'm calling
  from {{business_name}} about your recent payment. {{message}} Do you have a moment?"
  ```
</CodeGroup>

Be explicit. Include the exact phrasing. Use `{{recipient_first_name}}` to personalise the greeting.

***

## Rule 2 — Define scope boundaries

Tell the agent what it should and should not handle. Without this, the AI will attempt to answer anything a caller asks — often poorly.

```text theme={null}
Your only goal is to confirm or reschedule the appointment.
Do not discuss billing, account changes, refunds, or anything outside of scheduling.
If the caller asks about something out of scope, say: "I'm only able to help with
scheduling today — for anything else, please contact us at hello@yourcompany.com."
```

Explicit "do not" instructions are more reliable than vague "focus on" instructions.

***

## Rule 3 — Use `{{context}}` for per-call nuance

The `context` field lets you pass runtime information into the call without hardcoding it into the agent.

```text System prompt theme={null}
Additional context for this call: {{context}}
```

```json Notification request theme={null}
{
  "context": "Customer has attempted to reschedule twice. Be understanding but firm about the policy."
}
```

This keeps your agent generic while allowing each call to be personalized.

***

## Rule 4 — End the call explicitly

Tell the agent when and how to end the call. Without this, calls can drag on or end abruptly.

```text theme={null}
Once you have confirmed or rescheduled the appointment, thank the caller by name and
end the call with: "Thanks {{recipient_first_name}}, have a great rest of your day!"
Do not continue the conversation after this point.
```

***

## Rule 5 — One question at a time

If your agent collects information, instruct it to ask one question at a time. Asking multiple questions in one turn overwhelms callers and leads to partial answers.

```text theme={null}
Ask one question at a time. Wait for the caller's response before moving to the next question.
Do not list multiple questions in a single turn.
```

***

## Using `output_schema` as a guide

If your agent has an `output_schema`, reference the fields in the prompt so the AI knows what to collect:

```text theme={null}
During the call, you need to collect:
- Whether the user confirmed (yes/no)
- If they want to reschedule, their preferred day and time

At the end of the call, you will have collected enough information to fill:
- "confirmed": true or false
- "reschedule_request": their preferred time, or null if confirmed
```

Describing the expected output in the prompt leads to more reliable extraction.

***

## Full prompt example

Here's a complete, production-quality prompt for an appointment confirmation agent:

```text theme={null}
You are a scheduling assistant calling on behalf of {{business_name}}.

Start the call by saying: "Hi, is this {{recipient_first_name}}? Great — I'm calling
from {{business_name}} to confirm your appointment on {{appointment_time}} with
{{doctor_name}}. Does that time still work for you?"

If they confirm:
- Thank them and confirm the appointment is set.
- End with: "Perfect! We'll see you then. Have a great day, {{recipient_first_name}}!"

If they need to reschedule:
- Say: "No problem at all. What day and time would work better for you?"
- Collect their preferred time.
- Say: "Got it — I'll pass that along and someone will confirm the new time with you shortly."
- End warmly.

If they do not answer or ask to call back:
- Leave a brief message and end the call.

Rules:
- Do not discuss billing, medical questions, or anything outside of scheduling.
- Ask one question at a time.
- Be warm, brief, and professional.
- Do not call the caller by their last name.

Additional context: {{context}}
```

***

## Prompt checklist

<AccordionGroup>
  <Accordion title="Opening line defined?">
    Does the prompt include the exact words the AI should say when the call connects? Is `{{recipient_first_name}}` used for personalization?
  </Accordion>

  <Accordion title="Scope boundaries set?">
    Does the prompt explicitly say what the agent should and should not handle?
  </Accordion>

  <Accordion title="Error paths covered?">
    What should the agent do if the caller doesn't answer, hangs up, or asks something off-topic? These paths should be defined.
  </Accordion>

  <Accordion title="Call ending defined?">
    Does the prompt tell the agent exactly when and how to end the call?
  </Accordion>

  <Accordion title="All custom variables declared?">
    Every `{{token}}` in the prompt (except built-ins) must be passed in `variables` at notification time. Check that all tokens are covered.
  </Accordion>

  <Accordion title="Output schema referenced?">
    If you have an `output_schema`, does the prompt tell the agent what information to collect?
  </Accordion>
</AccordionGroup>
