Security boundaries
Boundary 1: Policy Engine
Boundary 1: Policy Engine
Gate tool calls and agent actions with configurable rules.Actions:
allow (default), deny, request_approval, request_user_inputBoundary 2: Tool Runtime
Boundary 2: Tool Runtime
Every tool call passes through validation, policy checks, and output sanitization.Sandbox profiles are configured at the runner level, not per-tool:
Boundary 3: A2A / MCP Bridges
Boundary 3: A2A / MCP Bridges
External communication requires authentication and per-caller authorization.
Boundary 4: Agent Sandbox
Boundary 4: Agent Sandbox
Hard limits prevent runaway agents.
Default posture
AFK defaults to least privilege:| Setting | Default | Meaning |
|---|---|---|
| Tool policy | allow | Tools run unless explicitly denied |
| Tool output sanitization | True | Output is sanitized by default |
| A2A authentication | Required | No unauthenticated A2A |
| MCP authentication | Required | No unauthenticated MCP |
| Cost limits | None () | You must set max_total_cost_usd |
| Sandbox | None | Tools run in the host process |
Production hardening checklist
| Area | Action | Status |
|---|---|---|
| Cost | Set max_total_cost_usd on all agents | |
| Cost | Set max_steps and max_tool_calls | |
| Policy | Add deny rules for admin/destructive tools | |
| Policy | Add request_approval for mutating operations | |
| Tools | Enable sanitize_tool_output=True | |
| Tools | Set tool_output_max_chars | |
| Tools | Use sandbox profiles for code execution | |
| A2A/MCP | Configure auth providers with valid tokens | |
| A2A/MCP | Set per-caller agent access lists | |
| A2A/MCP | Enable rate limiting | |
| Secrets | Store API keys in environment variables | |
| Secrets | Use secret scope isolation per tool call | |
| Monitoring | Configure telemetry exporter (OTEL) | |
| Monitoring | Set up alerts for error rate and cost anomalies |
Secret isolation
AFK recommends isolating secrets at the environment level. Use separate environment scopes and the runner’sToolContext.metadata to control which credentials are available to each tool:
Threat model overview
| Threat | Mitigation |
|---|---|
| Prompt injection | Output sanitization, input validation |
| Runaway agents | Cost limits, step limits, wall time |
| Tool abuse | Policy engine, sandbox profiles |
| Unauthorized access | A2A/MCP auth, per-caller authorization |
| Secret leakage | Secret scope isolation, output sanitization |
| Cost explosion | max_total_cost_usd, circuit breakers |