CI/CD Integration
Run Humanbound in CI/CD — use the humanbound/actions GitHub Action or the hb CLI to gate builds on agent security, write SARIF for the Security tab, and catch regressions.
Gate your builds on agent security: run Humanbound's adversarial tests in your pipeline and
fail the build when findings cross a severity threshold. On GitHub, use the official
humanbound/actions
Action; on GitLab and other systems, run the hb CLI directly.
How it works
- Your pipeline boots the agent (or points at a running one) and hands its endpoint to Humanbound.
- Humanbound attacks it — multi-turn adversarial conversations (OWASP-aligned prompt injection, tool misuse, data exfiltration, and more).
- An LLM judge scores every response and records findings with severities.
- The result gates your build — exit
0on a clean pass,1whenfail-onmatches, and2when the scan itself failed (runFailed, or every conversation errored — a broken scan can never read as green). On GitHub, the Action also writes the findings as SARIF, which an upload step sends to the Security tab, and puts a severity summary on the run page.
GitHub Actions
Use the humanbound/actions
Marketplace Action — it installs the CLI, runs the scan, gates the build, writes a severity
summary to the run page, and writes a SARIF file; the github/codeql-action/upload-sarif step
below uploads it to the Security tab (needs security-events: write).
# .github/workflows/security-test.yml
name: AI Security Tests
on: [pull_request]
jobs:
security:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # required to upload SARIF
steps:
- run: docker compose up -d agent # boot your agent, reachable on localhost
- uses: humanbound/actions@v1
id: hb
with:
# Your agent's config — inline here; a file or a build step also work.
endpoint: |
{
"streaming": null,
"chat_completion": {
"endpoint": "http://localhost:8000/chat",
"payload": { "content": "$PROMPT" }
}
}
# The attacker/judge LLM key (local mode). Use a repository secret.
provider-api-key: ${{ secrets.OPENAI_API_KEY }}
model: gpt-4.1
fail-on: high # fail the build on high-severity findings
- uses: github/codeql-action/upload-sarif@v3
# the != '' check matters: on an early failure the Action has no SARIF to
# output, and upload-sarif hard-fails on an empty sarif_file input
if: always() && steps.hb.outputs.sarif-file != ''
with:
sarif_file: ${{ steps.hb.outputs.sarif-file }}Findings gate the build via fail-on, land in Security → Code scanning through the
upload step, and are summarized on the workflow run page.
Local mode vs platform mode
The Action runs in one of two modes — set exactly one credential:
| Mode | Credential | Where the engine runs | Results |
|---|---|---|---|
| Local | provider-api-key (your own LLM key) | in the runner | job output + SARIF; no account needed |
| Platform | api-key (a Humanbound hb_… key) | on humanbound.ai | your dashboard, plus SARIF |
Platform mode uses a user API key — no hb login, no browser:
- uses: humanbound/actions@v1
with:
api-key: ${{ secrets.HUMANBOUND_API_KEY }} # hb_… key
org-id: ${{ vars.HUMANBOUND_ORG_ID }}
project-id: ${{ vars.HUMANBOUND_PROJECT_ID }}
fail-on: highBoth ids are required — a headless run has no stored selection. Create the key with the least privilege the job needs, pinned to one project:
hb api-keys create --name "GitHub CI" --scope write \
--org <org-id> --projects <project-id>Headless HUMANBOUND_API_KEY auth ships in CLI 2.8.0. The Action checks the installed
version and fails with a clear message on older releases — pin version: or omit it to
get the latest.
The Action supports many more inputs — scope discovery, test categories, SARIF controls, nightly deep scans, and artifacts. See the Marketplace listing for the complete inputs table and scenarios.
Fail-On Thresholds
Use fail-on (Action input) or --fail-on (CLI flag) to fail the build when vulnerabilities of
a certain severity are found:
| Threshold | Description |
|---|---|
critical | Fail only on critical severity findings |
high | Fail on high or critical findings |
medium | Fail on medium, high, or critical findings |
low | Fail on low, medium, high, or critical findings |
any | Fail on any finding (including info) |
In local mode, --fail-on also fails the build when the judge could not assess a conversation,
since it may hide a finding.
GitLab CI (and other CI systems)
Anywhere you can't use a GitHub Action, run the hb CLI directly. Install the engine extra
for local mode, point --endpoint at your agent, and gate with --fail-on:
# .gitlab-ci.yml
security-test:
stage: test
image: python:3.12
variables:
HB_PROVIDER: openai
HB_API_KEY: $OPENAI_API_KEY # attacker/judge LLM key (CI/CD variable)
HB_MODEL: gpt-4.1
script:
- pip install "humanbound[engine]"
# Keep the exit code, so the reports below are written even when the gate trips.
- hb test --local --endpoint ./agent-config.json --wait --fail-on high || HB_EXIT=$?
- hb logs --format junit -o humanbound-junit.xml
- hb logs --format json -o security-results.json
- exit ${HB_EXIT:-0}
artifacts:
reports:
junit: humanbound-junit.xml
paths:
- security-results.json
when: always--format junit writes a JUnit XML report that GitLab shows in the merge request's
Test summary: one test case per attack conversation, with the attack category as the class name and each
failure's severity and the judge's explanation. Jenkins reads the same file.
The same pattern works on Jenkins, CircleCI, and others — install humanbound[engine], run
hb test --local --endpoint <config> --wait --fail-on <severity>, then export results with
hb logs. See the CLI reference and
Agent Configuration for the endpoint config format.
Always use --wait in CI/CD so the test completes before the job finishes (the GitHub
Action does this for you). Use --fail-on to enforce a security quality gate.
Other CI systems (via the Docker image)
These snippets run the official ghcr.io/humanbound/humanbound image directly in
local mode — no Python install needed on the runner. See the Docker page for mount
and networking details (workspace mounts, host.docker.internal, platform-auth mounts).
GitLab CI
adversarial-test:
image:
name: ghcr.io/humanbound/humanbound:2
entrypoint: [""]
script:
- hb test --endpoint ./endpoint.json --wait --fail-on high
variables:
HB_PROVIDER: openai
HB_MODEL: gpt-4o-mini
HB_API_KEY: $OPENAI_API_KEYCircleCI
jobs:
adversarial-test:
docker:
- image: ghcr.io/humanbound/humanbound:2
steps:
- checkout
- run: hb test --endpoint ./endpoint.json --wait --fail-on highTelemetry (Whitebox Testing)
Telemetry enables whitebox agentic testing — Humanbound sees your agent's tool calls, memory operations, and retrieval steps for deeper judge evaluation.
Docker
Run the Humanbound CLI from the official Docker image — no Python install required. Covers the quickstart, file mounts, and platform auth; see CI/CD for pipeline examples.