How to Write System Prompts That Make AI Agents Behave

A reliable agent isn't luck, it's structure
I used to think good prompts were about finding the right magic phrasing. They're not — they're about covering five specific parts, in order, every time. Nail these and the agent behaves the way you intend on the first try, not the fifth.
1. Role and expertise
Open by telling the agent exactly who it is. Specific beats vague by a wide margin.
- Weak: "You are a helpful assistant."
- Strong: "You are an elite B2B sales copywriter who specializes in cold outreach for SaaS startups."
2. Personality and voice
Name the tone explicitly — professional, witty, empathetic, bold, concise — and pair it with a "never sound like…" line. Vague tone instructions ("be professional") produce vague output; specific ones produce a consistent character.
3. Behavior rules
List the do's and don'ts. This is specifically where you prevent the failure modes you've already seen:
- Always ask a clarifying question if the request is ambiguous.
- Never invent statistics or cite sources that can't be verified.
- Keep replies under 150 words unless explicitly asked for more.
4. Output format
Tell it exactly how to respond — sections, bullet points, a table, structured data. Consistent structure is what makes an agent's output feel professional instead of improvised.
5. Examples — the part most people skip, and shouldn't
A single good example ("few-shot") teaches more than a paragraph of abstract rules. Show one ideal input and the ideal output, and the model pattern-matches to your actual standard instead of guessing at what you meant.
A template you can actually reuse
You are [ROLE], expert in [DOMAIN].
Voice: [3 personality adjectives]. Never sound [anti-pattern].
Always: [rule 1], [rule 2].
Never: [rule 3].
Respond in this format: [structure].
Example —
Input: [sample]
Output: [ideal response]
The mistakes I see most often
- Being vague — "be professional" means nothing without a concrete example of what that looks like for your brand.
- Overloading — ten conflicting rules confuse the model more than two clear priorities ever would. Cut, don't add.
- No format specified — without structure, output drifts between responses in ways that look inconsistent even when the content is fine.
- No examples — the single fastest fix for an inconsistent agent is one good example, not more rules.
Why I don't recommend writing these by hand anymore
Writing and tuning a prompt this way, by trial and error, takes more iterations than most people have patience for — you write something, test it, it's slightly off, you adjust, repeat. Prompt Studio does that iteration for you: pick the agent's personality and capabilities, and it assembles an engineered system prompt with the structure above already built in. Preview it free, then unlock the full Prompt Pack.
FAQ
Do examples need to be real, or can they be hypothetical?
They work best when they're close to a real case you've actually seen — a hypothetical "perfect" example sometimes misses the messiness of an actual request.
How many behavior rules is too many?
If you can't remember all of them without re-reading the prompt, that's roughly the model's problem too. Prioritize the three or four that actually prevent real failures you've observed.
What if my use case doesn't fit neatly into this template?
The five parts still apply — role, voice, rules, format, example — even if the content inside each one looks unusual for a niche use case. The structure is the point, not the specific wording.
Testing a prompt properly, not just once
A prompt that works on your first test isn't necessarily good — it's untested against edge cases. Before I trust one, I run it against the easy case, the ambiguous case, and the case where the request is slightly outside what it's supposed to handle. If it degrades gracefully on all three instead of just the first one, it's actually ready. Most prompt failures I've seen in practice happen on the second or third case, not the first.
Why I rewrite prompts instead of patching them
Once a prompt accumulates enough one-off patches — "also don't do X," "and remember Y" — it usually needs a full rewrite rather than another patch. Patched-together prompts tend to contradict themselves in subtle ways that are hard to spot by reading them, but show up clearly in inconsistent output. A clean rewrite every few months, incorporating everything you've learned, beats an endless patch job.
A final practical tip
Keep a running doc of every correction you've had to make to an agent's output. Once you've logged the same correction three times, that's your signal it belongs in the prompt itself, not in your head as a recurring manual fix.
Put it to work
Pair your new prompt with a ready-made agent in the marketplace and you've got a specialist working for you within minutes, not days.
Agents that do this for you
Try any of these live, free — right now.
Featured in our blog
More from the Vault Journal.
Ready to put an agent to work?
Try one live, free — see real output before you subscribe.
Browse the marketplace

