๐Ÿ” agent-pentest

February 8, 2026 ยท View on GitHub

Red team your AI agents before deployment.

One command. 41 attack vectors. Instant safety score.

npx agent-pentest scan --url https://your-agent.api.com

What It Does

Runs 41 automated adversarial tests against any AI agent endpoint in 4 categories:

CategoryVectorsWhat It Tests
๐Ÿ’‰ Prompt Injection11DAN, instruction override, delimiter bypass, CoT hijack
๐Ÿ“ค Data Exfiltration10System prompt leak, API key extraction, env probing
๐Ÿ”“ Jailbreak10Roleplay, emotional manipulation, translation bypass
๐Ÿ›ก๏ธ Safety Bypass10Harmful content, medical misinfo, fraud, CSAM

Returns a Safety Score (A-F) with detailed vulnerability report.

Quick Start

# Scan an agent (POST endpoint with JSON body)
npx agent-pentest scan --url https://my-agent.api.com/chat

# Custom body template
npx agent-pentest scan --url https://my-agent.api.com/chat \
  --body-template '{"prompt": "{{PAYLOAD}}", "max_tokens": 500}'

# Custom headers
npx agent-pentest scan --url https://my-agent.api.com/chat \
  -H "Authorization:Bearer sk-xxx" -H "X-Api-Key:my-key"

# Save report as markdown
npx agent-pentest scan --url https://my-agent.api.com/chat \
  --save report.md

# JSON output for CI/CD
npx agent-pentest scan --url https://my-agent.api.com/chat \
  --output json

# Fail CI if grade below B
npx agent-pentest scan --url https://my-agent.api.com/chat \
  --fail-under B

Commands

scan โ€” Run a security scan

FlagDescriptionDefault
-u, --url <url>Target agent endpoint (required)โ€”
-m, --methodHTTP method (POST/GET)POST
-H, --headerCustom headers (Key:Value)โ€”
-b, --body-templateBody with {{PAYLOAD}} placeholder{"message": "..."}
-t, --timeoutRequest timeout (ms)30000
-c, --concurrencyParallel requests3
-o, --outputFormat: terminal, json, markdownterminal
--save <path>Save report to fileโ€”
--fail-under <grade>Exit code 1 if below gradeโ€”
--categoriesFilter vector categoriesall

vectors โ€” List all attack vectors

npx agent-pentest vectors
npx agent-pentest vectors --category prompt-injection

CI/CD Integration

GitHub Action

- name: Agent Safety Scan
  run: npx agent-pentest scan --url ${{ secrets.AGENT_URL }} --fail-under B --output json --save safety-report.json

Safety Score

GradeScoreMeaning
A90-100Excellent โ€” resistant to all tested vectors
B80-89Good โ€” minor warnings, no critical failures
C70-79Fair โ€” some vulnerabilities detected
D50-69Poor โ€” significant vulnerabilities
F0-49Critical โ€” agent is highly vulnerable

PoE Receipt

Every scan generates a signed Proof of Execution receipt:

  • SHA-256 hash of all results
  • Timestamped signature for compliance audit trails
  • Protocol: agent-pentest-v1

License

MIT โ€” Berlin AI Labs