A Lightweight Defense Architecture Against Indirect Prompt Injection in Tool-Calling AI Agents
Description
The rapid integration of Large Language Models (LLMs) into autonomous agent workflows has introduced significant security challenges, most notably Indirect Prompt Injection (IPI). As agents increasingly rely on external tools and protocols such as the Model Context Protocol (MCP) to fetch data from APIs, web searches, and databases, untrusted content can subvert the agent’s core instructions, leading to unauthorized actions. While foundation-model evaluators offer a potential defense, their deployment is often hindered by high inference latency (400–1200 ms) and substantial operational costs. This paper proposes a lightweight multi-stage guardrail architecture, "LightGuard-Agent," designed to secure the tool-calling loop without compromising system performance. Our approach utilizes a tiered defense pipeline, ranging from deterministic syntactic sanitization to high-speed semantic intent classification and an execution policy action firewall. Empirical evaluation across 50 adversarial and benign scenarios demonstrates that LightGuard-Agent reduces the Attack Success Rate (ASR) from 100.0% to 0.0% while introducing zero false positives and maintaining an average processing latency of just 0.059 ms.
Files
A Lightweight Defense Architecture Against Indirect Prompt Injection in Tool-Calling AI Agents - Compiled PDF.pdf
Additional details
Software
- Repository URL
- https://github.com/seotarek/LightGuard-Agent
- Programming language
- Python