What is a System Prompt?
The system prompt is your primary way to control an agent’s behavior. It’s set once per conversation and influences every response the agent generates.The Anatomy of a Great System Prompt
1. Role Definition
Start by clearly defining what the agent is:- Good
- Weak
- Specific role (data analyst, not generic assistant)
- Clear domain (fintech, financial data)
- Defined capabilities (SQL, visualization)
2. Behavioral Guidelines
Define how the agent should act:3. Tool Usage Instructions
Guide the agent on when and how to use available tools:4. Constraints and Boundaries
Set clear limits:5. Output Format
Specify how responses should be structured:Complete Example
Here’s a production-ready system prompt for a customer support agent:Common Mistakes
Being Too Vague
- ❌ Vague
- ✅ Specific
Conflicting Instructions
- ❌ Conflicting
- ✅ Clear
Overloading with Instructions
Too many rules can confuse the model. Prioritize the most important guidelines:- ❌ Overloaded
- ✅ Focused
Tips for Iteration
- Start simple — Begin with a basic prompt and add complexity as needed
- Test edge cases — See how the agent handles unusual requests
- Watch tool usage — Verify the agent uses tools appropriately
- Check for consistency — Same type of input should yield similar behavior
- Refine based on failures — Add specific guidance when the agent makes mistakes
Quick Reference
| Section | Purpose | Example |
|---|---|---|
| Role | Who is the agent? | ”You are a code review assistant…” |
| Capabilities | What can it do? | ”You can search code, explain patterns…” |
| Behavior | How should it act? | ”Be thorough but concise…” |
| Tool usage | When to use tools? | ”Use search_code for questions about…” |
| Constraints | What’s off-limits? | ”Never suggest deleting production code…” |
| Format | How to structure output? | ”Use code blocks, explain reasoning…” |
Next: Tool Descriptions →
