Which changes should trigger security tests?
Any change that alters what the agent reads, decides or can do. The table pairs each event with the test and the blocking level we recommend.
| Change | Risk | Test to replay | Blocking |
|---|---|---|---|
| System prompt edited | A refusal instruction disappears | Direct and indirect injection suite | Blocks the PR merge |
| Model or model version change | Different behavior against the same traps | Full suite with repetitions | Blocks the release |
| Tool added, tool schema or description edited | New capability or new injection through the description | Tool abuse and authorization tests | Blocks the merge |
| New data source (RAG, connector) | Untrusted content entering the context | Indirect injection through that source | Blocks the release |
| Dependency update | Orchestration logic changes | Functional tests and a short suite | Warns |
| Schedule (nightly, weekly) | Drift in a hosted model | Full attack suite | Alerts the team |
Which tools should you plug in, and how?
You combine a scenario tool with a deterministic check of tool calls. Promptfoo generates adversarial inputs from its "plugins": promptfoo redteam init --no-gui creates the configuration, promptfoo redteam run generates several hundred adversarial inputs, saved in redteam.yaml, and promptfoo redteam report shows the results. Its documentation gives an example of a scheduled GitHub Actions workflow (promptfoo/promptfoo-action@v1 with type: 'redteam') running daily and on demand. Plan a token budget: a red team run calls the model a very large number of times.
Garak (NVIDIA) runs from the command line, for example python -m garak --target_type openai --target_name <model> --spec probes.promptinject, and writes a JSONL report on every run. Its documentation does not describe an exit code tied to detected vulnerabilities: the pipeline must therefore read the report and decide for itself. PyRIT, an open source tool from Microsoft's AI Red Team, provides a command-line scanner for repeatable scans. To choose between them, see the Promptfoo, Garak and PyRIT comparison.
A minimal guardrail on a Promptfoo evaluation, which fails if a test failed:
```yaml
name: agent-security-tests
on:
pull_request:
paths: ["prompts/", "tools/", "promptfooconfig.yaml"]
permissions:
contents: read
jobs:
injection:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "24" }
- run: npx promptfoo@latest eval -c promptfooconfig.yaml -o results.json
env: { OPENAI_API_KEY: "${{ secrets.TEST_LLM_KEY }}" }
- run: |
FAILURES=$(jq '.results.stats.failures' results.json)
test "$FAILURES" -eq 0
`
The .results.stats.failures field and the use of jq follow the examples in Promptfoo's documentation; adapt the secret's name to your provider.
Which blocking thresholds should you set?
Set them on the agent's actions. A model can refuse in words and still act, so the reliable assertion targets tool calls and network output.
| Test type | Measure | Proposed blocking threshold |
|---|---|---|
| Forbidden action (send, delete, permission change triggered by untrusted content) | Observed tool call | A single occurrence blocks |
| Canary leak (unique string in a document) | Presence in the output or a request | A single occurrence blocks |
| Success rate of an attack family | Successes over n trials, with an interval | Blocks if the interval's upper bound exceeds the threshold (e.g. 10%) |
| Regression on an already fixed flaw | Case replayed identically | Blocks as soon as it succeeds again |
For the rate, count at least 35 trials per scenario if you want to demonstrate a rate below 10% with zero successes (upper bound of the 95% Wilson interval). Three trials prove nothing: models do not always answer the same way, even at temperature 0. Keep the heavy suite for model changes and nightly runs, and a short suite for PRs.
What should go in the test suite?
Each case is a small versioned folder in the repository: a trapped document or message, the task given to the agent and an assertion about what must not happen. Feed the suite three ways: the attacks of the prompt injection category in the OWASP Top 10 for LLM Applications (LLM01), your agent's real incidents, and every fixed flaw, which immediately becomes a regression test. Split it into three levels: a short suite (a few minutes) on every PR, a full suite before every release or model change, an extended suite at night. Record in each report the model version, the prompt and the tool list, so a result can be tied to a specific change.
What pitfalls does the pipeline itself introduce?
The main ones are secrets, caching and untrusted content processed by CI. GitHub's documentation advises avoiding the pull_request_target trigger when it is not necessary, because those workflows may have write access and access to secrets, and not checking out untrusted code in them; it also recommends a read-only default GITHUB_TOKEN and advises against self-hosted runners for public repositories. Use a test key with a capped budget, never a production key, and fake data.
On caching: Promptfoo's documentation shows a response cache (an example with a 24-hour lifetime). A response served from the cache no longer measures the model, so check that your regression runs really call the model. Finally, if your pipeline has a review agent read PRs or tickets, that content is untrusted too: this is the subject of coding agent security.
What does automation not replace?
It detects the return of attacks you already know. It does not replace:
- The attacker who adapts: they rephrase, chain several steps and exploit business context, where a suite replays fixed cases.
- Real authorization flaws: knowing whether user A can make the agent act on B's data requires understanding the architecture.
- Judgment on verdicts: a model grading the results makes mistakes, with false positives and false negatives; part of them must be reviewed.
- Chains across tools: a harmless read followed by a harmless write can amount to exfiltration.
Our production checklist lists the controls not to leave to automation.
How does CleanIssue fit with your CI/CD?
An engagement delivers a report with reproducible evidence: those are the attack cases to replay afterwards in your pipeline. The Agent Red Team Express (€1,900, 5 days, start within 48 hours after the quote and authorization are signed) covers one agent and its tools; several agents or pipelines fall under the Custom Red Team, quoted individually. Tests run on development or staging by default. For the framework, see AI agent pentesting. The first step is a free 30-minute discovery call.
Does your product ship an AI agent? CleanIssue tests what a stranger can make it do with the Agent Red Team Express (5 days, €1,900), or a custom red team for several agents and MCP servers. First step: a free 30-minute discovery call.
Related articles
Three adjacent analyses to keep exploring the same attack surface.
Promptfoo vs Garak vs PyRIT: AI Red Teaming Tools
Promptfoo, Garak and PyRIT compared for automated AI agent red teaming: versions, features, comparison table and limits against a manual test.
Coding agent security: Claude Code, Cursor, Copilot
Risks of coding agents on the developer workstation and in CI, with three verified incidents (CVE-2025-54135, CVE-2025-53773, Nx) and concrete measures.
Prompt injection training can make AI agents more vulnerable
PIPETTE (Waterloo, Zhejiang, KTH): the red teaming tool that found the most attacks produced the most fragile agent. What to change in your testing.
Sources
Related services
If this topic maps to a real risk in your stack, these are the most relevant CleanIssue audits.