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
celcrate. - 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 razorwireworks 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.
I'd love feedback on the code, especially the streaming part.
1 post - 1 participant
