If your AI agent ignores instructions, calls the wrong tools, or goes off on tangents, the problem usually isn’t the model — it’s the system prompt. The system prompt is the agent’s job description: it sets the role, rules, and behavior for the entire session. Get it right and the agent becomes dramatically more reliable. Here’s the exact 6-part structure we use, plus a template you can copy.
Why the system prompt matters more than you think
A user prompt is a single task. The system prompt is persistent — it governs how the agent behaves on every turn, which tools it reaches for, and when it stops. A vague system prompt produces a vague, unpredictable agent no matter how good the underlying model is.
The 6 parts of a great agent prompt
Give it a clear role
Start by telling the agent who it is and its scope: “You are a support triage agent for an e-commerce store. You only handle order and refund questions.” A defined role prevents the agent from wandering into tasks it shouldn’t touch.
State the goal and ‘done’
Spell out the objective and the exact condition that means it’s finished. “Your goal is to categorize each ticket and draft a first reply. You are done when a draft and category are produced.” This is what stops loops and over-working.
List the tools and when to use them
Name each tool and its trigger: “Use search_orders when the customer references an order number. Use escalate when the request involves a chargeback.” Ambiguity here is a top cause of wrong tool calls.
Set the rules and guardrails
Put hard limits in their own section so they don’t get lost: what the agent must never do, when it must ask for human approval, and how to handle uncertainty (“If you’re unsure, ask rather than guess”).
Define the output format
Tell it exactly how to respond — plain text, JSON, a specific structure. Agents that feed other systems need strict formats: “Respond only with valid JSON matching this shape…” This prevents the malformed-output failures that crash pipelines.
Add one or two examples
Show, don’t just tell. A single example of an ideal input→output pair teaches the behavior faster than paragraphs of description.
The structure at a glance
Copy-paste template
Adapt this skeleton to your agent — fill in the brackets and delete what you don’t need:
# ROLE You are a [role] for [context]. You handle only [scope]. # GOAL Your goal is to [objective]. You are DONE when [explicit definition of done]. # TOOLS - [tool_1]: use when [condition]. - [tool_2]: use when [condition]. Never call more than [N] tools per task. # RULES - Never [forbidden action]. - For [risky action], STOP and ask for human approval. - If you are unsure or missing information, ask instead of guessing. - Stop after [N] steps even if the task is incomplete. # OUTPUT FORMAT Respond using exactly this format: [describe format / JSON shape] # EXAMPLE Input: [sample input] Output: [ideal output]
Common mistakes that break prompts
- Burying the key rule in a wall of text — give hard rules their own section.
- No stopping condition — always define “done” and a step cap.
- Contradictory instructions — the agent can’t follow rules that conflict.
- No output format — vague formatting breaks anything downstream.
- Telling without showing — one concrete example beats three paragraphs.
Frequently asked questions
What should an agent system prompt include?
How is a system prompt different from a user prompt?
Why does my agent ignore my instructions?
Should I tell the agent when to stop?
Further Reading
- Simple AI Agent Example: See One Work, Explained in Plain English
- Prompt Engineering: Best Practices That Actually Work
- How to Stop Your AI Agent From Failing or Hallucinating (2026 Fixes)
- How to Choose the Right AI Agent for Your Business (2026 Decision G…
- How to Build Your First AI Agent : A Beginner's Step-by-Step Guide
