Skip to main content

Overview

Security is critical for production voice agents. This guide covers essential security practices for protecting your agent and user data.

API Key Security

Never Hardcode Keys

Use .env Files

Important: Add .env to .gitignore:

Rotate Keys Regularly

Rotate API keys every 90 days:

Input Validation

Validate All Tool Inputs

Sanitize String Inputs

Prevent SQL Injection

Use Parameterized Queries

Use ORM

Protect Sensitive Data

Don’t Log Sensitive Information

Encrypt Sensitive Data

Mask Data in Responses

Rate Limiting

Limit Tool Calls

Authentication

Verify User Identity

HTTPS/TLS

Use Secure Connections

Error Messages

Don’t Expose Internal Details

Security Checklist

Before deploying:
  • API keys stored in environment variables
  • .env added to .gitignore
  • Input validation on all tools
  • Parameterized database queries
  • Sensitive data not logged
  • HTTPS/WSS connections only
  • Rate limiting implemented
  • Authentication for sensitive operations
  • Generic error messages

Next Steps

Deployment

Deploy securely

Best Practices

Follow best practices