Action Restrictions and Permissions › The Problem with Unrestricted Actions
Michael BrenndoerferAugust 14, 20252 min read
AI Agent HandbookAll chapters Part 13 of 15Safety and Governance - Keeping the Agent Aligned
Action Restrictions and Permissions › The Problem with Unrestricted ActionsOne section · Sections in this chapter2 / 11 ↓
Sections in this chapter11
Let's start by understanding what can go wrong. Imagine you've given your assistant the ability to send emails on your behalf. Here's a simple tool implementation:
In[3]:
Code## Using Claude Sonnet 4.5 for its strong tool use capabilities
import os
from anthropic import Anthropic
import smtplib
from email.mime.text import MIMEText
def send_email(to_address, subject, body):
"""Send an email via SMTP"""
msg = MIMEText(body)
msg['Subject'] = subject
msg['From'] = 'your.email@example.com'
msg['To'] = to_address
with smtplib.SMTP('smtp.example.com', 587) as server:
server.starttls()
server.login('your.email@example.com', 'PASSWORD')
server.send_message(msg)
return f"Email sent to {to_address}"
## Define the tool for the agent
tools = [{
"name": "send_email",
"description": "Send an email to a specified address",
"input_schema": {
"type": "object",
"properties": {
"to_address": {"type": "string"},
"subject": {"type": "string"},
"body": {"type": "string"}
},
"required": ["to_address", "subject", "body"]
}
}]This works, but it's dangerous. The agent can now send any email to anyone, at any time, without asking. What if it misunderstands a request? What if a user tries to trick it into spamming someone? What if there's a bug in your code that causes it to send the same email repeatedly?
These aren't hypothetical concerns. When you give an agent the power to take actions in the real world, you need safeguards. Let's explore how to add them.