A merge-request check that fails when the AgentGuardian AIVSS score drops below your floor, with the SARIF report surfaced through GitLab’s security-dashboard pipeline-report contract.Documentation Index
Fetch the complete documentation index at: https://docs.agentguardian.io/llms.txt
Use this file to discover all available pages before exploring further.
When to add this
- The first time an LLM agent lands in
mainand needs a regression gate on merge requests. - On every release branch before tagging.
- For any change that touches the agent’s system prompt, tool surface, memory layer, or framework graph.
Wire it up
Create.gitlab-ci.yml (or add a redteam job to your existing
pipeline):
.gitlab-ci.yml
artifacts.when: alwaysis mandatory — without it, a failed--fail-underwould suppress the SARIF and leave reviewers without the annotations they need.artifacts.reports.sastis what feeds GitLab’s Security & Compliance → Vulnerability Report. The SARIF emitter produces a schema-valid file every time, so the report contract is satisfied without a converter step.rulesscope the job to merge-request and main-branch pipelines so a feature-branch push doesn’t burn LLM budget.
Pick a target
Replacemy_app.graph:graph with the dotted reference to your real
framework-native object. Supported --framework values: adk,
autogen, crewai, langgraph, openai_agents, strands.
For a hosted HTTP agent, swap the framework flags for:
AGENT_GUARDIAN_AUTH_BEARER from a masked CI variable.
Add the provider secret
In GitLab: Settings → CI/CD → Variables → Add variable. Add the key matching your--model choice — GEMINI_API_KEY,
OPENAI_API_KEY, ANTHROPIC_API_KEY. Mark it Masked and
Protected if you only want main-branch pipelines to read it.
For a free offline smoke check, use --model stub — but note that
stub runs are non-authoritative (mode_authoritative=false) and
always fail --fail-under regardless of the numeric score. See
AIVSS score → mode_authoritative.
How to interpret the exit code
GitLab CI uses the same exit codes the GitHub workflow does. The job fails on anything non-zero; the SARIF is still uploaded because ofartifacts.when: always.
| Code | Constant | What to do |
|---|---|---|
0 | EXIT_OK | Merge. |
1 | EXIT_FAIL_UNDER | Block merge. Read the SARIF in the merge-request widget. |
2 | EXIT_CONFIG | Fix the .gitlab-ci.yml script. Not a security regression. |
3 | EXIT_TARGET_UNREACHABLE | Add a health-check step before redteam. |
4 | EXIT_LLM_PROVIDER | Check the provider secret and rerun. |
5 | EXIT_SANDBOX | Inspect the job log; fix the target reference. |
130 | EXIT_USER_INTERRUPT | Job was cancelled. Re-run; raise --budget-usd if it was timing out. |
Tune the floor
Same progression as the GitHub Actions page:- First two weeks —
--fail-under 60. Catches catastrophic regressions, lets the team see what a real swarm finds. - Steady state —
--fail-under 70. Matches the WARNING/POOR boundary; rejects merges that introduce a medium-severity ASI01 / ASI02 finding. - Hardened release branch —
--fail-under 80. Matches the GOOD/WARNING boundary; only ships when the agent has no high-severity outstanding findings.
src/agent_guardian/models/severity.py.
Cap the spend
Pass--budget-usd so a runaway provider can never cost more than
budgeted per pipeline. The swarm soft-stops new attack turns at 80 %
of the cap and reserves the remainder for the report emission step.
gemini:gemini-2.5-flash --mode full run the typical cost is
~$0.06; 0.10 gives headroom + the soft-stop reserve.
Next step
Reports
Open the
scan.sarif and the signed scan.json every job emits.Fail builds on high risk
Add a finding gate on top of the score gate.
GitHub Actions
The same flow on GitHub, with Code Scanning annotations.
CLI reference
Every flag on
agent-guardian scan.