Skip to main content

Humanbound CLI - command line interface for AI agent security testing.

Project description

Humanbound CLI

AI agent security testing — adversarial attacks, posture scoring, guardrails export, and firewall training. Runs locally or on the platform. No login required.

PyPI License

pip install humanbound-cli

Quick Start

# Configure your LLM provider
export HB_PROVIDER=openai
export HB_API_KEY=sk-...

# Run a security test
hb test --endpoint ./bot-config.json --repo . --wait

# View results
hb posture                         # Security score (0-100, A-F)
hb logs                            # Conversation logs
hb report -o report.html           # HTML report
hb guardrails -o rules.yaml        # Firewall rules

Full isolation with ollama — zero external API calls:

export HB_PROVIDER=ollama
export HB_MODEL=llama3.1:8b
hb test --endpoint ./bot-config.json --scope ./scope.yaml --wait

What It Does

Humanbound runs multi-turn adversarial attacks against your AI agent's live endpoint, evaluates responses using LLM-as-a-Judge, and produces structured findings aligned with OWASP Top 10 for LLM Applications and OWASP Agentic AI Threats.

Feature Local Platform
Multi-turn adversarial testing (OWASP) Yes Yes
Behavioral/QA testing Yes Yes
Posture score (0-100, A-F) Yes Yes + trends
HTML/JSON reports Yes Yes
Guardrails export Yes Yes (richer)
Firewall training Yes Yes (richer)
Finding lifecycle tracking Yes
Continuous monitoring Yes
Cross-session leakage detection Yes
Managed LLM (no key needed) Yes

Agent Configuration

Create a JSON file describing how to talk to your agent:

{
  "streaming": false,
  "thread_auth": {"endpoint": "", "headers": {}, "payload": {}},
  "thread_init": {
    "endpoint": "https://your-bot.com/sessions",
    "headers": {"Authorization": "Bearer token"},
    "payload": {}
  },
  "chat_completion": {
    "endpoint": "https://your-bot.com/chat",
    "headers": {"Authorization": "Bearer token"},
    "payload": {"message": "$PROMPT"}
  }
}

$PROMPT is where Humanbound injects test prompts.


Test Modes

# Default: threaded, progress spinner (~20 min)
hb test --endpoint ./config.json --wait

# Verbose: live progress bar + final results table
hb test --endpoint ./config.json --wait --verbose

# Debug: single-threaded, full turn-by-turn output
hb test --endpoint ./config.json --wait --debug

Test Categories

Category Flag Description
OWASP Agentic -t owasp_agentic (default) Multi-turn adversarial with score-guided escalation
OWASP Single-Turn -t owasp_single_turn Maximum-strength single prompts
Behavioral QA --qa Intent boundary + response quality testing

Testing Levels

Level Flag Duration
Unit (default) -l unit ~20 min
System --deep ~45 min
Acceptance --full ~90 min

Scope Discovery

hb test --endpoint ./config.json --repo . --wait            # Scan code for scope + tools (recommended)
hb test --endpoint ./config.json --scope ./scope.yaml --wait # Explicit scope file
hb test --endpoint ./config.json --prompt ./system.txt --wait # Extract from system prompt
hb test --endpoint ./config.json --wait                      # Auto-probe the bot

Defense

Guardrails Export

hb guardrails -o rules.yaml
hb guardrails --vendor openai -o openai_rules.json

Firewall Training

Train a Tier 2 classifier from test results:

hb firewall train                                  # From local test data
hb firewall train --import pyrit_results.json      # From PyRIT
hb firewall train --import results.json:promptfoo  # From promptfoo

Use with hb-firewall for runtime protection.


CI/CD

# .github/workflows/security.yml
- run: pip install humanbound-cli
- run: hb test --endpoint ./config.json --repo . --wait --fail-on high
  env:
    HB_PROVIDER: openai
    HB_API_KEY: ${{ secrets.OPENAI_KEY }}

Platform (With Login)

For posture tracking, finding lifecycle, continuous monitoring, and team collaboration:

hb login
hb connect --endpoint ./bot-config.json    # Create project + first test
hb test --wait                              # Re-test (project remembered)
hb posture --history                        # Posture trends
hb findings                                 # Finding lifecycle
hb monitor enable --schedule daily          # Continuous monitoring

Providers

Provider HB_PROVIDER Notes
OpenAI openai GPT-4o, GPT-4.1
Anthropic claude Claude 3.5, Claude 4
Google gemini Gemini Pro
Azure OpenAI azureopenai Requires HB_ENDPOINT
Grok (xAI) grok
Ollama ollama Full local isolation
hb config set provider openai
hb config set api-key sk-...

pytest Integration

import pytest

@pytest.mark.hb
def test_prompt_injection(hb):
    result = hb.test("llm001")
    assert result.passed

@pytest.mark.hb
def test_posture_threshold(hb_posture):
    assert hb_posture["score"] >= 70
pytest --hb tests/ --hb-fail-on=high

MCP Server

Expose CLI capabilities as tools for AI assistants:

pip install humanbound-cli[mcp]

# Claude Code
claude mcp add humanbound -- hb mcp

# Cursor (.cursor/mcp.json)
{"mcpServers": {"humanbound": {"command": "hb", "args": ["mcp"]}}}

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

humanbound_cli-1.1.0.tar.gz (316.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

humanbound_cli-1.1.0-py3-none-any.whl (383.4 kB view details)

Uploaded Python 3

File details

Details for the file humanbound_cli-1.1.0.tar.gz.

File metadata

  • Download URL: humanbound_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 316.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.12

File hashes

Hashes for humanbound_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 62ae8444f31d734d8be12bf2d319c75567f3be4b365447403c42c832076cc8bc
MD5 97d7721b90920a272eef6871ad0df1e5
BLAKE2b-256 ecc6886e64ed48f407f746fe29f275afac7767abc1a69f7b8412eab5bb5b6c14

See more details on using hashes here.

File details

Details for the file humanbound_cli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: humanbound_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 383.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.12

File hashes

Hashes for humanbound_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 005e70a993e01487d444c2cffebdb5bb68c31ad62d52962f9dba1eeba01a808f
MD5 ba1363da047c087fbae5d5e3acfd8bfc
BLAKE2b-256 2b16a28a6fe48bb1778eddae54932aa4d942dc1fe9dcbd7f9a66e679d56f633c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page