Writing High-Quality Prompts
Copy page
A complete guide to writing sub agent prompts: structure, operating principles, role and personality statements, output formats, and escalation rules.
A well-structured prompt is the foundation of reliable agent behavior. This page covers the recommended sections for a sub agent prompt and how to write each one effectively.
Use the Agent Prompt for shared instructions
The Agent Prompt is inherited by all sub-agents in an agent and is often underutilized. Use it for instructions you don't want to repeat across every sub-agent: MCP tool usage guidelines, global constraints, output conventions, and other rules that apply universally. Reserve sub-agent prompts for role-specific behavior.
Structure your sub-agent prompt in this order:
- Role and mission — who the agent is and what it optimizes for
- Scope and non-goals — prevents accidental overreach
- Operating principles — directness vs suggestions, decision frameworks
- Workflow checklist — steps the agent can follow
- Tool-use policy — what tools to use and when
- Output format — headings, verbosity limits, evidence expectations
- Uncertainty and escalation — when to ask, when to proceed, when to defer
- Few-shot examples (optional) — examples that demonstrate the expected behavior and output quality
1. Role and mission
The role and mission sets the sub agent's identity and paradigm in 2-4 sentences. It should:
- Declare what excellence looks like for this role
- Describe concrete behaviors the best humans in this role would exhibit
Write in second person ("You are...", "Do..."). Avoid first-person commitments ("I will...") unless the agent is expected to do so.
Template:
Example:
2. Scope and non-goals
Use scope and non-goals to prevent the agent from accidentally overreaching. Useful when tool permissions are broad or the task description could be interpreted widely.
Example:
3. Operating principles
Use a mix of direct requirements and suggestions:
- Direct requirements (must/never) for correctness and safety
- Suggestions (prefer/consider) where multiple strategies can work
Guidance:
- Prefer "Do X" over "It's good to X"
- Provide a default path and an escape hatch
- Avoid long background explanations unless they change behavior
4. Workflow checklist
Use a checklist to guide the agent's behavior. This is useful whether the agent is a single sub agent with multiple tools or a coordinator that delegates to specialists.
Example:
5. Tool-use policy
Make tool usage explicit — which tools to prefer, in what order, and what to avoid:
6. Output format
The output format is the most important section for multi-agent integration. If a coordinator aggregates results from multiple specialists, the output format is a shared interface. Define it precisely:
- Exact headings the output must include
- Severity levels or categories for findings
- Evidence expectations (line numbers, file paths, short excerpts)
- Verbosity bounds (e.g., "max 1-2 screens unless asked for more")
7. Uncertainty and escalation
Define when the agent should ask for help vs proceed with assumptions:
8. Few-shot examples (optional)
- 2-3 well-chosen examples outperform more
- Order matters: place the most representative example last (recency effect)
- One weak example degrades all examples — curate carefully
Overview
Design AI agents that are focused, safe, and reliable. Learn the principles, patterns, and techniques for building high-quality agent systems.
Multiagent Workflows
Design multiagent workflows with coordinator sub agents that delegate to specialists, aggregate results and drive the overall process forward.