AI Agent Proxy
Overview
AI Agent Proxy is a security layer that protects AI agent applications by intercepting, analyzing, and securing communications between end users and AI agents. It provides real-time threat detection, guardrails enforcement, and response filtering for AI agent deployments running in customer environments.
Key Features
Threat Detection: Real-time scanning and blocking of malicious requests before they reach your AI agent
Request Guardrails: Enforce security policies on incoming requests to prevent attacks and policy violations
Response Guardrails: Scan and filter AI agent responses for sensitive data, policy violations, and security issues
Response Redaction: Automatically redact sensitive information from AI agent responses
Complete Visibility: Monitor all AI agent communications with comprehensive logging
Container-Based Deployment: Deploy as Docker containers alongside your AI agent infrastructure
Architecture
The AI Agent Proxy runs as a Docker container on the same VM as your AI agent container, providing a secure gateway for all AI agent traffic.
┌──────────────┐ ┌──────────────────────────────────┐ ┌──────────────┐
│ │ │ AI Agent Proxy │ │ AI Agent │
│ End User │ │ (Docker Container) │ │ Container │
│ │ │ │ │ │
└──────────────┘ └──────────────────────────────────┘ └──────────────┘
│ │ │
│ │ │
│ 1. Send Request │ │
│ ────────────────────────────────► │ │
│ │ │
│ ┌──────────────────────────────┐ │
│ │ 2. Request Guardrails & │ │
│ │ Threat Detection │ │
│ │ - Prompt Injection │ │
│ │ - SQL/Command Injection │ │
│ │ - PII Input Validation │ │
│ └──────────────────────────────┘ │
│ │ │
│ │ 3. Forward If Valid │
│ │ ─────────────────────────────────► │
│ │ │
│ │ │
│ │ 4. Return Response │
│ │ ◄───────────────────────────────── │
│ │ │
│ ┌──────────────────────────────┐ │
│ │ 5. Response Guardrails │ │
│ │ - PII Detection & Redaction │ │
│ │ - Sensitive Data Filtering │ │
│ │ - Content Policy Validation │ │
│ └──────────────────────────────┘ │
│ │ │
│ 6. Return Response │ │
│ (Original/Blocked/Redacted) │ │
│ ◄──────────────────────────────── │ │
│ │ │Traffic Flow:
End user sends request to AI Agent Proxy endpoint
Proxy performs threat detection and applies request guardrails
Valid requests are forwarded to AI agent container
AI agent processes request and returns response to proxy
Proxy receives response and applies response guardrails and redaction rules
End user receives final response (original, blocked, or redacted)
Deployment
Prerequisites
Docker installed on your VM
An AI agent application running as a Docker container
Network connectivity between proxy and AI agent containers
Docker Compose Setup
Create a docker-compose.yml file to run both the AI agent and proxy containers:
Environment Variables
Configure the AI Agent Proxy with the following environment variables:
TARGET_AGENT_URL
URL of your AI agent container
Yes
AKTO_DASHBOARD_TOKEN
Authentication token from Akto dashboard
Yes
GUARDRAILS_CONFIG
Path to guardrails configuration file
No
LOG_LEVEL
Logging level (info, debug, error)
No
PROXY_PORT
Port for proxy server (default: 3000)
No
ENABLE_REQUEST_LOGGING
Enable detailed request logging (true/false)
No
ENABLE_RESPONSE_REDACTION
Enable automatic PII redaction (true/false)
No
Start the Services
Configure Your Application
Update your application to route AI agent requests through the proxy:
Before:
After:
Security Features
1. Request Threat Detection
The proxy analyzes incoming requests for security threats including:
Prompt Injection: Detects attempts to manipulate AI agent behavior through malicious prompts
SQL Injection: Blocks SQL injection attempts in agent queries
Command Injection: Prevents malicious command execution attempts
Path Traversal: Detects unauthorized file system access attempts
Data Exfiltration: Identifies attempts to extract sensitive information
SSRF (Server-Side Request Forgery): Blocks unauthorized internal network access
2. Request Guardrails
Enforce security policies on incoming requests:
3. Response Guardrails
The proxy receives responses from the AI agent and applies security checks and data protection:
4. Response Handling
After receiving the response from the AI agent, the proxy applies guardrails and returns one of three types of responses to the end user:
Original Response: Request and response passed all security checks
Blocked Response: Security violation detected in request or response
Redacted Response: Sensitive data removed from AI agent response
Configuration
Basic Guardrails Configuration
Create a guardrails.yml file to define your security policies:
Advanced Configuration
Configure threat detection sensitivity and custom rules:
Monitoring & Logging
Container Logs
View real-time logs from the proxy:
Log Format
The proxy generates structured JSON logs:
Dashboard Integration
Connect to Akto dashboard for centralized monitoring:
Login to app.akto.io
Navigate to AI Security > Agent Proxy
View real-time metrics:
Request volume and trends
Threat detection statistics
Blocked request analysis
Top guardrails triggered
Response redaction statistics
Networking
Container Network Configuration
The proxy and AI agent containers communicate over a Docker network:
Exposing Proxy to End Users
For production deployments, use a reverse proxy or load balancer:
Using Nginx:
Best Practices
Network Isolation: Run containers in a dedicated Docker network for security
Resource Limits: Set CPU and memory limits for both containers
Regular Updates: Keep proxy and agent containers updated with latest security patches
Backup Configuration: Maintain version control for guardrails configuration
Monitor Performance: Track proxy latency to ensure minimal overhead
Tune Guardrails: Regularly review and optimize guardrail rules to reduce false positives
Secure Tokens: Store
AKTO_DASHBOARD_TOKENsecurely using Docker secrets or environment filesLog Rotation: Configure log rotation to prevent disk space issues
Troubleshooting
Common Issues
Proxy Cannot Connect to AI Agent
Symptoms: 502 Bad Gateway errors
Solutions:
Requests Being Blocked Incorrectly
Symptoms: Legitimate requests returning blocked status
Solutions:
Review guardrails configuration for overly strict rules
Check proxy logs for specific guardrail triggered
Adjust sensitivity levels or whitelist patterns
Temporarily disable specific guardrails for testing
High Latency
Symptoms: Slow response times through proxy
Solutions:
Container Restart Loops
Symptoms: Proxy container keeps restarting
Solutions:
Debug Mode
Enable debug logging for troubleshooting:
Get Support
There are multiple ways to request support from Akto. We are 24X7 available on the following:
In-app
intercomsupport. Message us with your query on intercom in Akto dashboard and someone will reply.Join our discord channel for community support.
Contact
[email protected]for email support.Contact us here.
Last updated
Was this helpful?