Core Concepts
Core Concepts
Understanding AgentWall's key features and how they protect your AI agents.
Run-Level Tracking
What is a Run?
A run is a complete agent task, which may involve multiple LLM requests.
Why It Matters
- Budget per task: Limit spending per agent task, not just per API key
- Loop detection: Detect when an agent is stuck across multiple requests
- Debugging: See the full journey of an agent task
How to Use
Pass agentwall_run_id in your requests:
Loop Detection
The Problem
AI agents can get stuck in infinite loops:
This can cost thousands of dollars before anyone notices.
How AgentWall Detects Loops
AgentWall detects three types of loops:
| Type | Description | Detection |
|---|---|---|
| Exact | Same prompt repeated | 2nd occurrence |
| Similar | Nearly identical prompts | Jaccard similarity >85% |
| Oscillation | A→B→A→B pattern | 4th occurrence |
What Happens When a Loop is Detected
- Request is blocked (HTTP 429)
- Run is killed (no more requests allowed)
- Alert sent to Slack (if configured)
- Logged in dashboard
Example Response
Budget Enforcement
Three Levels of Budget
| Level | Scope | Use Case |
|---|---|---|
| Per-Run | Single agent task | "This task can't cost more than $1" |
| Daily | All requests today | "Don't spend more than $100/day" |
| Monthly | All requests this month | "Monthly budget is $1000" |
How It Works
Budget Exceeded Response
DLP (Data Loss Prevention)
What is DLP?
DLP scans requests and responses for sensitive data and masks it automatically.
Detected Patterns
| Category | Examples |
|---|---|
| API Keys | OpenAI, AWS, Stripe, GitHub, Slack |
| Credentials | Passwords, tokens, secrets |
| Financial | Credit cards (Visa, MC, Amex), IBANs |
| PII | Emails, phone numbers, SSNs |
| Infrastructure | Private IPs, internal URLs |
How It Works
Configuration
DLP is enabled by default. You can configure sensitivity in the dashboard:
- Strict: Block requests with sensitive data
- Redact: Mask sensitive data and continue (default)
- Log Only: Log but don't modify
Kill Switch
Manual Kill
Stop a runaway agent immediately from the dashboard:
- Go to Agent Runs
- Find the run
- Click Kill Run
All future requests with that run_id will be blocked.
Automatic Kill
AgentWall automatically kills runs when:
- Loop detected
- Budget exceeded
- Step limit reached (default: 30 steps)
- Timeout exceeded (default: 120 seconds)
Cost Tracking
Per-Request Cost
Every response includes cost information:
Supported Models
| Model | Input (per 1K) | Output (per 1K) |
|---|---|---|
| gpt-4 | $0.03 | $0.06 |
| gpt-4-turbo | $0.01 | $0.03 |
| gpt-3.5-turbo | $0.0005 | $0.0015 |
| claude-3-opus | $0.015 | $0.075 |
| claude-3-sonnet | $0.003 | $0.015 |
Architecture
Components
- FastAPI Proxy: Ultra-low latency (<10ms overhead)
- Redis: Run state and loop detection
- ClickHouse: High-performance logging
- Laravel Dashboard: Admin panel and alerts
Next: API Reference