Deploying an AI agent to production is exciting. Deploying an insecure AI agent to production is terrifying.
After helping secure multiple agent deployments, I created this checklist. Print it out, tape it to your monitor, and go through it before every deployment.
Pre-Deployment Checklist
Authentication & Access Control
- [ ] API keys stored in environment variables or secrets manager (never in code)
- [ ] Agent runs under a dedicated service account (not root)
- [ ] File system access restricted to specific directories
- [ ] Network access limited to required endpoints only
- [ ] SSH access to agent host uses key-based auth (no passwords)
Tool Security
- [ ] Shell command execution uses allowlist (not blocklist)
- [ ] File operations restricted to designated directories
- [ ] Web browsing sandboxed from local network
- [ ] Database access uses read-only credentials where possible
- [ ] All tool calls logged with timestamps and parameters
Prompt Injection Defense
- [ ] External content (web pages, emails, files) treated as untrusted
- [ ] Input validation on all user-facing interfaces
- [ ] System prompt includes injection resistance instructions
- [ ] Agent cannot modify its own system prompt or SOUL.md
- [ ] Regular testing with known injection techniques
Monitoring & Alerting
- [ ] All agent actions logged to persistent storage
- [ ] Alerts configured for unusual patterns (high API usage, unexpected file access)
- [ ] Cost monitoring with automatic cutoffs
- [ ] Error rate monitoring with escalation
- [ ] Regular log review schedule established
Data Protection
- [ ] No PII in agent memory or logs (or encrypted if necessary)
- [ ] Conversation history retention policy defined
- [ ] Data classification applied to agent-accessible information
- [ ] Backup and recovery procedures tested
- [ ] Data deletion procedures documented
Network Security
- [ ] Agent host behind firewall with minimal open ports
- [ ] HTTPS enforced for all API communications
- [ ] Webhook endpoints authenticated
- [ ] Rate limiting on all external-facing endpoints
- [ ] DNS filtering to block known malicious domains
Operational Security
- [ ] Incident response plan documented
- [ ] Agent can be killed remotely (kill switch)
- [ ] Rollback procedure tested
- [ ] Dependencies pinned to specific versions
- [ ] Regular security updates scheduled
The Most Common Failures
From my audits, the top 3 security failures are:
- Running as root (60% of deployments) — Create a dedicated user. It takes 2 minutes.
- API keys in config files committed to git (45%) — Use environment variables.
- No monitoring (80%) — If you cannot see what your agent is doing, you cannot secure it.
Quick Wins
If you only do three things:
- Create a non-root service account for your agent
- Move all secrets to environment variables
- Enable logging for all tool calls
These three changes eliminate 70% of the attack surface.
Going Deeper
This checklist covers the basics. For a comprehensive security hardening guide including advanced topics like container isolation, network segmentation, intrusion detection, and compliance frameworks for AI agents: AI Agent Security Hardening Guide
Free agent templates with security-focused boundary definitions built in: Free SOUL.md Starter Pack
Recommended Tools
📬 Subscribe to Build with AI Agent Newsletter
Weekly insights on building AI agents that actually work — use cases, architecture patterns, and lessons from production.
📖 Read the latest issue: The Best Path to an AI Agent Startup in 2026
Top comments (0)