What is safeagents?
safeagents is a small proxy that sits between a coding agent and its model API. Every tool call the model returns is checked before Claude Code, OpenCode, Pi, Hermes or any harness with a configurable base URL sees it; calls it blocks are replaced with a text notice, so nothing runs. It works with OpenAI Chat Completions and Anthropic Messages, streaming or not.
Checks run in three stages: rules on the request itself, such as undeclared tools or hosts that appear nowhere in the conversation; detectors from Hugging Face's atif-scan for patterns like reading /proc/1/environ or Kubernetes service-account tokens; and an optional judge model for suspicious calls. It is Apache-2.0 licensed and installs as a uv tool.
Is safeagents worth it?
Most agent safety tools live inside one harness. safeagents works at the API boundary instead: you point the agent's base URL at a local proxy, and every tool call the model returns is inspected before the harness runs it. That makes it agent-neutral, covering Claude Code, OpenCode, Pi, Hermes and 13 agents with setup guides, over both OpenAI and Anthropic APIs.
The checks are thoughtfully ordered. First, cheap rules: block tools the request never declared, and calls whose arguments contain a host that appears nowhere in the conversation, where the model's own earlier turns do not count. Next, atif-scan detectors for known escape and exfiltration patterns, such as reading /proc/1/environ, curl --noproxy, Kubernetes service-account tokens or unshare. Only suspicious calls reach an optional judge model, which sees what the user wrote and the findings but never the agent's reasoning, so the agent cannot argue its case. The judge can add blocks but never lift one.
The overhead is small: streaming adds no latency because a tool call is held only until its arguments are complete, and atif-scan costs about 10 to 20 ms per call on an M-series Mac. The limits are inherent. It catches what its rules and detectors recognise, so a novel attack in plain shell can pass, and it does nothing about what an allowed command then does. It is a useful layer in front of a sandbox, not a replacement for one. A --log-only mode lets you see what it would block before enforcing it.
Where it earns its place
A developer running Claude Code with broad shell permissions
Catch exfiltration or container-escape commands before they execute
Start safeagents in front of api.anthropic.com in log-only mode for a week, review the log, then enforce; set ANTHROPIC_BASE_URL to the local proxy.
A platform team evaluating agents on benchmark tasks
Stop agents from fetching published answers
Write a plugin with atif-scan's RegexDetector to block reads of answer files, as the README's example shows.
Before you commit
- Setup
- Run the install script (macOS, Linux, WSL or PowerShell), then safeagents start <API URL> --log-only and point your agent's base URL at http://127.0.0.1:8787.
- Integrations
- OpenAI Chat Completions and Anthropic Messages APIs; Claude Code, OpenCode, Pi, Hermes and 13 agents with guides; atif-scan detectors; Hugging Face Hub plugins.
- Data and privacy
- Runs locally and logs to ~/.safeagents/run; requests pass through to your chosen model API.
- Cost at scale
- Free; an optional judge model is billed by whoever serves it.
- Limits
- Default blocking threshold is high severity; checks only what its rules and detectors know.
What’s good
- Works with any agent that accepts a custom base URL
- Layered checks, with a judge that can only add blocks
- No streaming latency; about 10 to 20 ms per call
- Log-only mode before enforcing
- Plugins for custom checks
What’s not
- Pattern-based; novel attacks can pass
- Does not sandbox commands it allows
- Judge model adds cost and setup
Best for
Developers and teams running coding agents with real permissions who want a cheap, agent-neutral check on tool calls before they run.
safeagents: common questions
- Is safeagents worth it?
- safeagents adds a guard that works with any coding agent by sitting on the API line, and its design choices are sound, though it is a filter on known patterns, not a sandbox. We rate it 4.1 out of 5.
- How much does safeagents cost?
- Free and open source (Apache 2.0); an optional judge model adds its own cost.
- What are the downsides of safeagents?
- Pattern-based; novel attacks can pass; does not sandbox commands it allows; judge model adds cost and setup.
- Who is safeagents best for?
- Developers and teams running coding agents with real permissions who want a cheap, agent-neutral check on tool calls before they run.
- How much does safeagents cost for a team or in production?
- Free; an optional judge model is billed by whoever serves it.
- Is safeagents safe for company data?
- Runs locally and logs to ~/.safeagents/run; requests pass through to your chosen model API.
Answers checked Nov 15, 2026.