Content Safety and Moderation › Real-World Considerations
AI Agent HandbookAll chapters Content Safety and Moderation › Real-World ConsiderationsOne section · Sections in this chapter7 / 13 ↓
As you deploy your agent, you'll encounter situations that require judgment. Here are some common scenarios and how to think about them:
Scenario 1: Educational vs. Harmful Content
Sometimes users ask about harmful topics for legitimate reasons. For example:
User: How do phishing attacks work? I want to protect my team.This is very different from asking how to conduct a phishing attack. Your agent should be able to help with the educational request while still refusing the harmful one. The key is intent and framing.
You can help your agent distinguish by including examples in your system prompt:
system_prompt = """When users ask about harmful topics:
HELP with:
- Understanding threats to protect against them
- Learning about security vulnerabilities to fix them
- Academic or educational discussions
DO NOT HELP with:
- Conducting attacks or harmful activities
- Exploiting vulnerabilities
- Evading security measures
If the intent is unclear, ask the user to clarify their goal."""Scenario 2: Cultural and Contextual Sensitivity
What's considered appropriate varies by culture and context. Your agent should be aware of this:
system_prompt = """Be culturally sensitive and context-aware:
- Avoid assumptions about the user's background or beliefs
- If discussing sensitive topics, acknowledge different perspectives
- When in doubt about appropriateness, err on the side of caution
- If you're unsure about cultural context, ask the user"""Scenario 3: Evolving Safety Requirements
Safety isn't static. As you learn from real usage, you'll discover new edge cases and refine your guidelines. Build in a process for updating your safety measures:
- Log refusals: Keep track of when and why your agent declines requests
- Review regularly: Look for patterns in refusals and user reactions
- Update guidelines: Refine your system prompts and filters based on what you learn
- Test changes: Before deploying updates, test them against known edge cases