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

# Write a system prompt your agent follows

> Structure a system prompt, keep it short, and move flows, phases and reference material to the place each runs best.

The system prompt on the **Agent** page tells your agent who it is, who it
talks to and how to behave in every conversation. It is read in full before
every reply, on every channel. A prompt the model can follow is short,
organized and specific. This page explains how to write one, and when a rule
belongs somewhere other than the prompt.

## Structure the prompt in sections

Give each kind of instruction its own Markdown heading, in this order, and
keep each section to what only that section needs. Models pay more attention
to text that is clearly labelled, and you will find rules faster when you edit.

| Section | What it holds |
| - | - |
| `# Personality` | Who the agent is: its name, its role and the business it works for. |
| `# Business context` | Who calls or writes in, why they usually do, and what the agent can and cannot help with. |
| `# Tone` | How it sounds, said once: formality, warmth, and how long a reply should be. |
| `# Goal` | What a good conversation achieves, in the order it usually happens. |
| `# Guardrails` | What the agent must never do or say, whatever the customer asks. |
| `# Tools` | When each tool runs, what it needs first, and what to do when it fails. |
| `# Error handling` | What to say when something goes wrong and how to hand over to a person. |

A short example:

```markdown theme={null}
# Personality
You are Nora, the support assistant for Acme Outdoor, an online shop for
camping gear.

# Tone
Warm and plain. Two sentences at most unless the customer asks for detail.

# Goal
Help customers track orders, start returns and choose the right gear.

# Guardrails
- Never promise a refund amount. The returns team decides it.
- Never ask for a full card number.

# Tools
- Use `lookup_order` once you have the order number. If it fails twice,
  apologise and offer to have the team email the customer.
```

## Keep it short and direct

* **Say each thing once.** Repeating the tone in every section makes the
  prompt longer without making it stronger.
* **Write instructions, not explanations.** "Ask for the order number first"
  works better than a paragraph about why order numbers matter.
* **Name the one or two rules that matter most** and mark them, for example
  "This step is important." Marking everything marks nothing.
* **Use the customer's words.** Write examples of what customers actually say,
  so the agent recognizes them.
* **Prefer short lists** to long paragraphs, and keep headings in sentence case.

## Give guardrails their own section

Non-negotiable rules go under `# Guardrails` in the prompt or in the separate
**Guardrails** editor under the agent's behavior settings. Keep them short and
absolute: what the agent never does, never says and never promises. Rules the
agent may bend depending on the situation belong in the goal or in a procedure.

## Describe tools and their failures

The prompt should say when each tool runs, which details the agent must
collect first and in what order, and what it does when the tool fails. For
example: confirm the customer's name and order number, call the tool, and after
two failures stop retrying and offer a callback or a transfer. A tool's own
description in **Tools** explains each parameter; give an example for any value
with a fixed format, such as an email address, a phone number or a booking code.

## Why long prompts hurt

A long prompt is harder to follow. Rules near the middle get skipped, rules in
different sections start to contradict each other, and every reply costs more
and starts later because the model reads the whole prompt each time.

Once the system prompt reaches **5,000 characters**, a card under the editor
shows its length, amber up to 10,000 characters and red beyond. From the card:

![System prompt editor with a card below it that reads Long prompts are harder for the agent to follow reliably, an amber 7,288 characters count, an Optimize with Mastermind button and a Prompting guide link](https://mintcdn.com/centillion/bQuf3h6URioB1FS5/images/agents/prompting-guide-01-long-prompt-card.webp?fit=max\&auto=format\&n=bQuf3h6URioB1FS5\&q=85\&s=80031da295af3d339421b83b1784880d)

The card under a 7,288-character system prompt, with the count, Optimize with Mastermind and the link to this guide.

* **Optimize with Mastermind** saves your draft and opens
  [Mastermind](https://cntillion.com/docs/agents/mastermind.md). It reads the prompt, your procedures,
  workflow, tools and knowledge, then proposes one set of changes: which flows
  become procedures, which phases become workflow steps, which reference
  material moves into knowledge, and how the prompt is reorganized. Nothing
  changes until you choose **Approve and apply** on its card. Every change is
  saved to your draft with **Undo**, and nothing reaches customers until you
  publish.
* **Prompting guide** opens this page.
* **Dismiss** closes the card for this agent in this browser. The character
  count and an **Optimize** button stay in the editor's footer, beside the
  timezone.

The card is shown to teammates who can edit the agent.

## Move each part to where it runs best

Most long prompts hold three kinds of text that work better elsewhere.

| What you wrote | Where it belongs | Why |
| - | - | - |
| A step-by-step flow for one task, such as a return or a booking | A [procedure](https://cntillion.com/docs/agents/procedures.md) | The agent loads it only when the customer's intent matches its trigger. A structured procedure runs its steps in a fixed order. |
| Separate phases of a conversation, such as qualify, then sign, then hand over | A [workflow](https://cntillion.com/docs/agents/releases-and-workflows.md#design-a-workflow) | Each step gets its own short prompt, and conditions decide when the conversation moves on. |
| Facts that change: prices, policies, opening hours, long lists | [Knowledge](https://cntillion.com/docs/agents/knowledge.md) | The agent looks them up when they are relevant, and you update them without touching the prompt. |
| Who the agent is, its tone, its goal and its guardrails | The system prompt | These apply to every reply. |

Only five free-form procedures can be active at once, so merge related flows
into one procedure or keep the shortest ones in the prompt.

## Choose a model for the job

Smaller models answer faster and cost less; larger models follow long or
subtle instructions more reliably and choose tools more precisely. Start with
the default, then compare two or three models on the same tests before you
switch. For a voice agent, speed usually matters more than for chat. Each
workflow step can use its own model, so a demanding phase can run on a larger
model while the rest stays fast.

## Iterate with tests

1. Turn real conversations that went wrong into [tests](https://cntillion.com/docs/agents/tests.md).
2. Change one thing in the prompt at a time.
3. Run the same tests again and compare the results before you publish.
4. Add [success evaluation](https://cntillion.com/docs/agents/releases-and-workflows.md#success-evaluation) criteria for the outcomes you care about, such
   as a completed booking, and watch them after you publish.

## Related

> [card] [Create an agent](https://cntillion.com/docs/agents/create-an-agent.md#instructions)
>
> Where the system prompt and guardrails editors are.

> [card] [Mastermind](https://cntillion.com/docs/agents/mastermind.md)
>
> Ask for a review of your prompt, or let Mastermind restructure it.

> [card] [Procedures](https://cntillion.com/docs/agents/procedures.md)
>
> Reusable tasks with flexible instructions or fixed steps.

> [card] [Workflows](https://cntillion.com/docs/agents/releases-and-workflows.md#design-a-workflow)
>
> Conversation phases, each with its own prompt.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.