βœ“
Field Note Β· Nov 26, 2026 Β· 8 min read

Automating OWASP LLM & Agentic Guardrail Gates in CI/CD with Promptfoo, Garak & LlamaFirewall

Shift AI security left: combine Promptfoo commit assertions, Garak adversarial probing, and runtime LlamaFirewall alignment checks aligned to OWASP LLM01-LLM10 and ASI01-ASI05.

Automating OWASP LLM & Agentic Guardrail Gates in CI/CD with Promptfoo, Garak & LlamaFirewall
Authorized Security Research & Defensive Notice This technical guide is strictly intended for authorized security testing, QA debugging, and defensive engineering on systems, devices, and applications you own or have explicit, written authorization to audit. ToolWar strictly prohibits the use of these techniques or utilities for unauthorized access or destructive activities.

Shipping an AI assistant or autonomous MCP agent with only a polite system prompt is equivalent to deploying a web application with client-side validation alone. As teams adopt agentic frameworks and tool-calling pipelines, security engineering needs repeatable, deterministic CI/CD test gates anchored to the OWASP LLM & Agentic Security Matrix.

Three Distinct Testing Layers (Do Not Confuse Them)

  1. Fast Commit Regression Gates (Promptfoo): Runs in seconds on every pull request touching prompt templates, RAG retrieval queries, or tool JSON schemas. Uses deterministic assertions (not-contains, schema checks) against synthetic canary tokens (LLM02, LLM07).
  2. Scheduled Staging Robustness Sweeps (Garak & PyRIT): Stress-tests staging models across encoding tricks, multi-turn goal drift, and hallucination resistance before major model or prompt releases.
  3. Inline Runtime Inspection (LlamaFirewall, Llama Prompt Guard 2 & LLM Guard): Screens untrusted external inputs (emails, web pages, SIEM logs) and validates planned agent tool calls in real time (ASI01, ASI02).

Promptfoo vs Garak: Choosing the Right Tool for Each Stage

ADVERTISEMENT
Evaluation Dimension Promptfoo CI Suite Garak Robustness Harness
Primary Role PR regression assertions & prompt matrices Broad automated probe & vulnerability discovery
Execution Speed Seconds per PR in GitHub Actions Minutes to hours on staging endpoints
Best OWASP Coverage LLM02, LLM05, LLM07 LLM01, LLM07, LLM09
Ideal Trigger Every PR modifying prompts or RAG filters Nightly or pre-release staging QA

Explore the full metric breakdown in our live comparison: Promptfoo vs Garak on ToolWar.

Writing Safe, AdSense & Production-Clean CI Assertions

  • Use Synthetic Canaries Only: Never run evaluation scripts against production vector databases or real customer PII. Create mocked staging records with fake TOOLWAR_CANARY_TOKEN_001 strings to test tenant isolation cleanly.
  • Benchmark False-Positive Rate: When deploying Llama Prompt Guard 2 or LLM Guard in front of developer/SecOps assistants, always test against benign cybersecurity queries (terms like SQL, CVE, chmod) using the OWASP Defense Benchmark Suite so normal engineering traffic is not blocked.
  • Combine Semantic Guardrails with Hard Policy Gates: Pair classifier models with non-LLM deterministic enforcement such as OPA Rego Policies and gVisor Container Sandboxes so worst-case prompt injections hit closed permissions.
ADVERTISEMENT
KS

Kapil Soni

Updated test bio for ToolWar lead researcher

πŸ’¬ Discussion

0 comments
No comments yet. Have insights or questions regarding this article? Join the discussion!