How to Get SMS Alerts for AI Agent Safety Events
SafeClaw by Authensor can send SMS alerts for critical AI agent safety events, ensuring you are notified even when you are away from your computer. Through Twilio integration, SafeClaw sends text messages when agents are denied dangerous actions or when audit integrity checks fail. SafeClaw supports Claude and OpenAI agents, has 446 tests, and uses hash-chained audit logs.
Prerequisites
- SafeClaw installed (
npx @authensor/safeclaw) - A Twilio account with a phone number
- Twilio Account SID, Auth Token, and phone number
Step 1: Set Up Twilio
- Sign up at twilio.com and verify your account.
- Purchase a phone number with SMS capabilities.
- Note your Account SID and Auth Token from the Twilio Console dashboard.
Step 2: Configure SafeClaw for SMS
Add SMS notification settings to .safeclaw/policy.yaml:
version: 1
default: deny
notifications:
sms:
provider: twilio
account_sid: "${TWILIO_ACCOUNT_SID}"
auth_token: "${TWILIO_AUTH_TOKEN}"
from_number: "${TWILIO_FROM_NUMBER}"
to_numbers:
- "+15551234567"
- "+15559876543"
events:
- action.denied
- audit.integrity_failure
min_severity: critical
rules:
- action: file.read
paths:
- "src/**"
decision: allow
- action: file.write
paths:
- "src/**"
decision: prompt
- action: shell.execute
decision: deny
Set the environment variables:
export TWILIO_ACCOUNT_SID="ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export TWILIO_AUTH_TOKEN="your_auth_token"
export TWILIO_FROM_NUMBER="+15550001111"
Step 3: Configure SMS Content
SafeClaw formats SMS messages to be concise and actionable within the 160-character SMS limit:
notifications:
sms:
provider: twilio
template: "SafeClaw ALERT: {{action}} {{decision}} on {{target}}. Agent: {{agent}}. Hash: {{hash_short}}"
max_length: 160
Example SMS message:
SafeClaw ALERT: shell.execute DENIED on rm -rf /data. Agent: gpt-4o. Hash: a3f2b7
Step 4: Add Escalation Rules
SMS alerts should be reserved for the most critical events. Configure escalation tiers:
notifications:
sms:
provider: twilio
account_sid: "${TWILIO_ACCOUNT_SID}"
auth_token: "${TWILIO_AUTH_TOKEN}"
from_number: "${TWILIO_FROM_NUMBER}"
escalation:
tier_1:
to_numbers:
- "+15551234567"
events:
- audit.integrity_failure
delay_seconds: 0
tier_2:
to_numbers:
- "+15559876543"
events:
- audit.integrity_failure
delay_seconds: 300
condition: "tier_1_unacknowledged"
Tier 1 sends immediately. If the event is not acknowledged within 5 minutes, tier 2 receives an SMS as well.
Step 5: Add Rate Limiting
Prevent SMS floods (which also incur costs):
notifications:
sms:
throttle:
max_per_hour: 5
cooldown_seconds: 300
aggregate_similar: true
With aggregate_similar enabled, SafeClaw groups repeated identical denials into a single SMS with a count: "SafeClaw: 12x shell.execute DENIED in last 5 min."
Step 6: Test the Integration
Send a test SMS:
npx @authensor/safeclaw test-notify --channel sms
You should receive a text message on all configured numbers. Then trigger a real critical event:
npx @authensor/safeclaw audit --corrupt-test
npx @authensor/safeclaw audit --verify
The integrity failure triggers an SMS alert.
Summary
SafeClaw sends SMS alerts through Twilio for critical AI agent safety events. Escalation tiers, rate limiting, and aggregation ensure you receive only the most important notifications via text. This provides a last-resort alerting channel when all other notification methods are unavailable. SafeClaw is MIT licensed and open source.
Related Guides
- How to Get Email Alerts for AI Agent Safety Events
- How to Integrate AI Agent Safety with PagerDuty
- How to Send AI Agent Safety Alerts to Slack
- How to Set Up Custom Webhooks for AI Agent Events
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw