When you deploy an autonomous AI agent with shell, database, or file-system tools, every untrusted webpage, GitHub issue comment, or retrieved RAG chunk is a potential remote code execution (RCE) vector.
Most teams rely on secondary LLM guardrail calls that add 400ms–1,200ms of latency and cost extra tokens on every turn. Today I built and hardened PromptGuard , a deterministic, zero-dependency FastAPI microservice ( app.py ) that intercepts prompt overrides, delimiter spoofing, and dangerous Python AST execution payloads in under 0.5ms .
Here is the complete architecture, the AST walker implementation, and the 8 pytest + TestClient invariant suites we use to verify it.
1.…