Hi all! I've been building Razorwire, an open-source (MIT) proxy that sits between an AI agent and its model provider (anything OpenAI-compatible). When the model asks for a tool call, Razorwire checks it against a YAML policy before the agent sees it. Blocked calls are removed from the response, so the agent has nothing to run.

The README opens with a real run: an agent told to drop the staging and production databases. Without Razorwire both are gone; with one policy rule, production survives.

Some Rust details:

  • tokio, axum and reqwest. No unsafe, and bad input never panics. Anything it can't parse or evaluate is blocked (it fails closed).
  • Policy conditions are CEL expressions, through the cel crate.
  • Streaming: an SSE gate passes text deltas through live (checked against a field allowlist) and holds everything from the first tool-call event until the whole reply can be checked. Then it forwards the held bytes unchanged or rebuilds the rest.
  • The audit log is JSONL with an HMAC chain across lines, checked by razorwire verify-log.
  • Static musl build for Linux with vendored OpenSSL. cargo install razorwire works too.

It also does human approval for risky calls (with Slack, Discord or ntfy alerts), a loop guard for agents stuck polling, and rollback through undo recipes run by your own executor.

Limits: only OpenAI-compatible payloads, tools the provider runs itself aren't checked, and it can't stop an agent that can reach the provider directly.

Repo: GitHub - razorwire-dev/razorwire: An action firewall for AI agents: a proxy that checks every tool call against a policy before the agent runs it. · GitHub

I'd love feedback on the code, especially the streaming part.

1 post - 1 participant

Read full topic