safeagents is a local proxy for running AI agents safely. It sits between the agent and the model server, checks every tool call the model initiates, and intercepts it before the coding harness executes it. Blocked calls are replaced with a text notification, so the coding harness does not perform any dangerous operations.
Key capabilities
- Request-level checks: A call is blocked if it uses a tool that was not declared in the request (tools loaded on demand via Claude Code's ToolSearch count as declared), or if its parameters contain a host (URL or bare IP) that has never appeared in the conversation. Calls targeting the proxy itself (stopping or killing the proxy, editing ~/.safeagents, redirecting the coding harness's base URL) are also blocked.
- atif-scan checks: Converts the conversation into an ATIF trajectory and runs atif-scan's detectors to identify behaviors such as reading /proc/1/environ, curl --noproxy, Kubernetes service account tokens, unshare/nsenter, and so on. Findings at or above --block-severity (default high) are blocked, while lighter findings are flagged as suspicious.
- Decision model (optional): Suspicious calls are sent to the judge model, which decides whether to allow or block. The judge can only add blocks, not remove them, and only sees user input, tool calls, and findings—not the agent's reasoning or tool results.
- Plugin mechanism: Supports loading custom atif-scan checks via --plugin MODULE:FACTORY or a path, and also supports loading plugins from the Hugging Face Hub (hf://OWNER/REPO). Plugins can add detectors, rules, and allow items.
- Trajectory redaction and publishing: safeagents scrub can identify and mask credentials, environment variable values, email addresses, home directories, and public IP addresses in trajectories. safeagents publish uploads the redacted copy to a Hugging Face dataset (private by default).
- Decision model benchmarking: safeagents-judge-bench scores decision models on 661 real agent tool calls, helping to choose --judge-model.
Usage
On macOS, Linux, or WSL, run the installation script (which automatically installs uv and adds safeagents to PATH). A corresponding script is also available for Windows PowerShell. After installation, start the background proxy and point the coding tool's base URL to the proxy. Use --log-only to report without blocking, which is convenient for observation. See docs/commands.md for all commands and options, and docs/ for setup guides covering 14 coding tools and OpenRouter.
Use cases
Suitable for scenarios where AI agents are run using coding tools and an additional layer of security protection is needed, especially when there is concern about agents making dangerous tool calls (such as reading sensitive files, accessing unauthorized hosts, or executing system commands). Also suitable for research or sharing scenarios that require auditing and redacting agent trajectories.
Limitations
- The coding tool must support setting a base URL.
- Under the default configuration, findings of medium severity are only flagged as suspicious and are not blocked unless a judge is configured or --block-severity is lowered.
- Plugins run as code within the proxy process, so only plugins from trusted repositories should be loaded, and commits should be pinned to ensure reproducibility.
- Redaction is best-effort; reports should be reviewed before publication.
- Detailed results and leaderboards for decision-model benchmarks can be found in the project documentation.