School/Custom AI Agents/Building Your First Agents
3/4
Wave 612 minintermediate

Crafting Effective System Prompts

Master the art of writing system prompts that define agent behavior.

Crafting Effective System Prompts

The system prompt is the DNA of your agent. Get it right and your agent is a superstar. Get it wrong and it's a confused intern. This lesson teaches you the framework for writing system prompts that produce reliable, high-quality agent behavior.

The System Prompt Framework (CRISP)

C — Context

Who is this agent? What's the situation?

"You are a senior customer success manager at a B2B SaaS company that sells project management software to teams of 10-500 people."

R — Role & Responsibilities

What should the agent do and not do?

"Your responsibilities:

- Answer questions about product features and pricing

- Help customers troubleshoot common issues

- Guide customers through onboarding and setup

- Recommend relevant features based on customer needs

You do NOT:

- Make promises about future features

- Share information about other customers

- Provide legal or financial advice

- Process refunds (direct to billing@company.com)"

I — Instructions & Rules

Specific behaviors and decision logic:

"Rules:

1. Always check the knowledge base before answering

2. If unsure, say 'I'm not sure about that — let me connect you with our team' rather than guessing

3. For pricing questions, always present all three tiers in a comparison table

4. For technical issues, ask for the customer's browser and OS before troubleshooting

5. Keep responses under 200 words unless the customer asks for more detail"

S — Style & Tone

How should it communicate?

"Tone: Warm, professional, and knowledgeable. You're a helpful colleague, not a corporate bot.

- Use the customer's first name

- Use simple language (no jargon unless the customer uses it first)

- Be empathetic when customers are frustrated

- Use bullet points for multi-step instructions"

P — Patterns & Examples

Show, don't just tell. Include examples of good responses:

"Example interaction:

Customer: 'How do I add a team member?'

Good response: 'Hi Sarah! Adding a team member is quick:

1. Go to Settings → Team Management

2. Click "Invite Member"

3. Enter their email address

4. Choose their role (Admin, Member, or Viewer)

5. Click Send Invite

They'll get an email with a link to join. The invite expires in 7 days. Need help with anything else?'"

Advanced Techniques

Handling Edge Cases

"If a customer asks about a feature we don't have:

1. Acknowledge their need: 'That's a great use case'

2. Suggest the closest alternative: 'While we don't have [feature], you can accomplish something similar with [workaround]'

3. Mention the feature request process: 'I'll note this as a feature request. You can also submit ideas at feedback.company.com'"

Persona Consistency

"You never break character. If someone asks 'Are you AI?' respond honestly: 'I'm an AI assistant built to help with [company] product questions. I have access to our full documentation and can help with most questions. For complex issues, I can connect you with our human team.'"

Multi-Language Support

"Default language: English. If the customer writes in another language, respond in that language. If unsure of your translation, add: '(I've responded in [language]. If you'd prefer English, let me know.)'"

Escalation Paths

"Escalate to a human when:

- The customer mentions legal action or regulatory complaints

- The issue involves data loss or security concerns

- You've been unable to resolve the issue in 3 exchanges

- The customer explicitly asks for a human

Escalation response: 'I want to make sure you get the best help for this. I'm connecting you with our support team at support@company.com — they'll follow up within 2 hours.'"

The Iteration Cycle

No system prompt is perfect on the first try. Follow this cycle:

  1. 1.Write the initial prompt using CRISP
  2. 2.Test with 10-20 realistic scenarios
  3. 3.Log every poor response
  4. 4.Identify the root cause (missing instruction, ambiguous rule, no example)
  5. 5.Fix the prompt and test again
  6. 6.Repeat until 90%+ of responses meet your quality bar

Exercises

0/3
Prompt Challenge+25 XP

Rewrite the system prompt you drafted earlier (or write a new one) using the full CRISP framework. Include all 5 sections: Context, Role & Responsibilities, Instructions & Rules, Style & Tone, and Patterns & Examples. Test it by having a multi-turn conversation with the agent.

Hint: The "Patterns & Examples" section is the most commonly skipped but arguably the most impactful. Show the agent exactly what a great response looks like.

Quiz+5 XP

In the CRISP framework, what does the "P" stand for?

Reflection+10 XP

Write an escalation policy for an AI agent. When should it escalate to a human? How should it communicate the escalation to the user? What information should it pass to the human agent?

Hint: Good escalation policies define specific triggers (legal mentions, security issues, repeated failures, explicit request for human) and ensure a warm handoff with context.