How to Get Email Alerts for AI Agent Safety Events
SafeClaw by Authensor sends email alerts for AI agent safety events, delivering detailed notifications about denied actions, policy violations, and audit integrity failures directly to your inbox. With support for SMTP, SendGrid, and Amazon SES, SafeClaw fits into any email infrastructure. It works with Claude and OpenAI agents, ships with 446 tests, and provides hash-chained audit logging.
Prerequisites
- SafeClaw installed (
npx @authensor/safeclaw) - An SMTP server, SendGrid account, or Amazon SES configuration
- Recipient email addresses
Step 1: Install SafeClaw
If you have not already, initialize SafeClaw in your project:
npx @authensor/safeclaw
Step 2: Configure SMTP Email
Add email settings to .safeclaw/policy.yaml:
version: 1
default: deny
notifications:
email:
provider: smtp
host: "${SMTP_HOST}"
port: 587
secure: true
auth:
user: "${SMTP_USER}"
pass: "${SMTP_PASS}"
from: "safeclaw@yourcompany.com"
to:
- "security-team@yourcompany.com"
- "devops@yourcompany.com"
subject_prefix: "[SafeClaw]"
events:
- action.denied
- audit.integrity_failure
- policy.violation
rules:
- action: file.read
paths:
- "src/**"
decision: allow
- action: file.write
paths:
- "src/**"
decision: prompt
- action: shell.execute
decision: deny
Set environment variables:
export SMTP_HOST="smtp.yourcompany.com"
export SMTP_USER="safeclaw@yourcompany.com"
export SMTP_PASS="your_smtp_password"
Step 3: Use SendGrid Instead (Optional)
If you prefer SendGrid:
notifications:
email:
provider: sendgrid
api_key: "${SENDGRID_API_KEY}"
from: "safeclaw@yourcompany.com"
to:
- "security-team@yourcompany.com"
template_id: "d-xxxxxxxxxxxxxxxxxxxxxxxxx"
SafeClaw passes structured data (action type, decision, target, agent, hash) as dynamic template variables, letting you design custom email templates in SendGrid's template editor.
Step 4: Configure HTML Email Content
SafeClaw generates HTML emails with structured information. Customize the template:
notifications:
email:
format: html
template:
header_color: "#FF4444"
include_fields:
- action_type
- target_resource
- decision
- agent_identifier
- timestamp
- audit_hash
- policy_rule
include_audit_context: true
context_entries: 5
The include_audit_context option includes the 5 most recent audit log entries surrounding the event, giving recipients immediate context for the alert.
Step 5: Set Up Daily Digest Reports
Instead of (or in addition to) per-event emails, configure a daily digest:
notifications:
email:
digest:
enabled: true
schedule: "0 8 *"
to:
- "engineering-leads@yourcompany.com"
include:
- total_actions_24h
- denied_count
- prompted_count
- allowed_count
- top_denied_actions
- audit_chain_status
- unique_agents
This sends a daily report at 8 AM summarizing all AI agent activity over the past 24 hours, including a breakdown of the most frequently denied actions and overall audit health.
Step 6: Test the Integration
Send a test email:
npx @authensor/safeclaw test-notify --channel email
Check your inbox for the test message. Then trigger a real denied action to confirm production delivery:
npx @authensor/safeclaw wrap -- node my-agent.js
npx @authensor/safeclaw audit --tail 5
The denial should trigger an email within seconds (or minutes, depending on your SMTP provider's delivery time).
Summary
SafeClaw integrates with any email infrastructure to deliver AI agent safety alerts. HTML-formatted messages with audit context give recipients immediate actionable information. Daily digests provide management-level visibility into agent behavior. SafeClaw is MIT licensed and open source.
Related Guides
- How to Get SMS Alerts for AI Agent Safety Events
- How to Send AI Agent Safety Alerts to Slack
- How to Integrate AI Agent Safety with PagerDuty
- How to Send AI Agent Audit Logs to Splunk
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw