Gating agent tool calls against business rules in ~130ms, no model needed

Ok-Buyer-9421 · reddit · 2026-11-24

After a test agent kept issuing refunds the policy never allowed, the author built a pre-execution gate: before any refund or approval runs, the call and order facts are written to a small text record and checked against the company's rules as tests. Pattern-based checks with no model calls run in 130ms each, blocked exactly the calls a hand-written guard caught, and double as an audit trail. Implemented via plain function calling, with the gate sitting where an MCP proxy would. Open-sourced as Agentests (MIT).

Original post →

More from coding & agent

coding & agent channel →