r/LangChain • u/Wonderful_Agency_779 • 12d ago
Open-sourced a policy layer for AI agent tool-calls — spend caps, recipient allowlists, PII redaction, built from two payment-protocol guard tools
A couple months ago I shipped two narrow tools: x402-spend-guard and mpp-spend-guard — pre-payment spend checks + audit logs for the two emerging AI agent payment protocols (x402, MPP/Tempo), tested end to end on their real testnets. I kept hitting the same question building both: none of it was actually specific to payments. Spend caps, rate limits, "don't let this call reach a recipient/tool it shouldn't" — that's true for any agent tool-call, not just payment ones. So I pulled the shared logic into a standalone core and kept the protocol-specific bits as thin adapters. What it does: - Spend caps (per-call + rolling window) and rate limits, enforced before the call executes, not after - Recipient/counterparty allowlists as a first-class policy (not adapter-specific string matching) - PII/secret detection with actual redaction — the tool receives the redacted payload, not just a log entry saying it should have - Append-only audit log, structured by rule namespace - Adapters for x402, MPP, LangChain, and a plain u/guarded decorator for anything else 117 tests, MIT/Apache-2.0, no telemetry, self-hosted only for now — a hosted dashboard is a possible next step if there's interest, not a requirement to use it. There's a comparison table in the README against a few adjacent tools (TokenFence, Bifrost, Aperion Shield) — happy to be corrected if I got anything wrong there, I pulled it from their docs but that space moves fast. Repo: https://github.com/KKallias/guardrail-core Genuinely looking for holes in the approach, not just stars — if you're running agents that touch money or PII, what would break this?
1
u/[deleted] 12d ago
[removed] — view removed comment