Built a zero-latency AST bouncer for local agent tool-calling
Hey everyone, Like many of you, we got frustrated with the current state of safety guardrails for autonomous agents. When you're running local LLMs (via Ollama, vLLM, or LM Studio) to execute bash scripts or database queries, calling a remote cloud moderation endpoint (Bedrock, OpenAI Moderation) defeats the entire purpose of running locally: It adds 1,500ms–2,500ms of cloud latency to every…
Developers have created a zero-latency tool to prevent unsafe tool-calling in local agent systems. This innovation addresses the frustration many feel with current safety guardrails for autonomous agents. When running local LLMs to execute bash scripts or database queries, calling a remote cloud moderation service adds significant latency and breaks the local privacy guarantee. Furthermore, LLM-as-a-judge evaluators can still be vulnerable to jailbreak attempts.
The solution involves a deterministic compiler AST (Abstract Syntax Tree) evaluator. This in-process evaluator parses Python, SQL, and Bash code blocks directly in the caller's memory before execution. If an agent attempts to perform catastrophic filesystem deletes, database DDL purges, dynamic Python sandbox breakouts, unauthorized reads of sensitive paths, or high-entropy credential exfiltration, the tool execution is aborted within 40 microseconds (0.00004s) within Python memory, with zero OS syscalls spawned.
This powerful tool, named btp-guard, has been released on PyPI and can be installed using the command bash pip install btp-guard.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.