Ethical Guidelines and Human Oversight › Encoding Ethics in System Prompts
Michael BrenndoerferAugust 16, 20253 min read
AI Agent HandbookAll chapters Part 13 of 15Safety and Governance - Keeping the Agent Aligned
Ethical Guidelines and Human Oversight › Encoding Ethics in System PromptsOne section · Sections in this chapter4 / 12 ↓
Sections in this chapter12
The simplest way to implement ethical guidelines is through your system prompt. Here's how you might structure it:
In[2]:
Code## Using Claude Sonnet 4.5 for its strong alignment with ethical guidelines
import os
from anthropic import Anthropic
client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
system_prompt = """You are a personal assistant designed to help your user while upholding
strong ethical principles.
Core Ethical Guidelines:
1. RESPECT AUTONOMY
- Always ask before making significant decisions
- Present options rather than choosing for the user
- Explain your reasoning so the user can make informed choices
2. PROTECT PRIVACY
- Never share personal information without explicit permission
- Redact sensitive details when summarizing
- Ask before accessing new data sources
3. ENSURE FAIRNESS
- Treat all people equitably
- Don't make assumptions based on demographics
- Refuse requests that involve discriminatory treatment
4. BE TRANSPARENT
- Explain what actions you're taking and why
- Be clear about limitations and uncertainties
- Never take hidden actions
5. ACT BENEFICENTLY
- Consider the impact on others, not just the user
- Warn about potential negative consequences
- Suggest alternatives when actions might cause harm
When facing an ethical dilemma:
1. Identify which principles are in tension
2. Explain the tradeoffs to the user
3. Ask for guidance rather than making assumptions
You are a tool to empower the user, not to replace their judgment."""
def ask_assistant(user_message, conversation_history=None):
if conversation_history is None:
conversation_history = []
conversation_history.append({"role": "user", "content": user_message})
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=2048,
system=system_prompt,
messages=conversation_history,
)
return response.content[0].text, conversation_historyLet's test this with an ethically complex request:
In[4]:
Coderesult, history = ask_assistant(
"I'm running late for a meeting. Cancel my 3pm appointment and don't tell them why."
)
print(result)The agent should respond something like:
I understand you're in a difficult situation, but I have some concerns about this request:
1. Canceling without explanation might damage your relationship with the person you're
meeting. They've set aside time for you.
2. Being transparent about why you're canceling (even just "something urgent came up")
is more respectful and maintains trust.
Here are some options:
A) Cancel with a brief, honest explanation: "Something urgent came up, I need to
reschedule. Are you available tomorrow?"
B) Ask me to check if the meeting can be shortened rather than canceled
C) Let me help you find a better time to reschedule, with an apology for the short notice
Which approach would you prefer? I'm happy to help with any of these.Notice how the agent doesn't just follow the instruction. It identifies the ethical tension (efficiency versus respect for others), explains the concern, and offers alternatives that better align with ethical principles. This is what ethical guidelines in action look like.