Skip to main content

HackAgent - AI Agent Security Testing Toolkit

AI Security Red-Team Toolkit


App -- Docs -- API

Security Policy



Python Version License uv Commitizen Ruff Test Coverage CI Status

What is HackAgent?

HackAgent is a comprehensive Python SDK and CLI designed to help security researchers, developers, and AI safety practitioners evaluate and strengthen the security of AI agents.

As AI agents become more powerful and autonomous, they face security challenges that traditional testing tools cannot address:

Threat Description
Prompt Injection Malicious inputs that hijack agent behavior
Jailbreaking Bypassing safety guardrails and content filters
Goal Hijacking Manipulating agents to pursue unintended objectives
Tool Misuse Exploiting agent capabilities for unauthorized actions

HackAgent automates testing for these vulnerabilities using research-backed attack techniques, helping you identify and fix security issues before they are exploited.

HackAgent CLI Demo

Interactive TUI with real-time attack progress and visual reporting.

Get Started Now

Quick Install

python3 -m venv .venv
source .venv/bin/activate
pip install hackagent

No API key required: HackAgent works locally out of the box. The base install imports without the interface and technique extras:

pip install 'hackagent[tui]'      # textual
pip install 'hackagent[web]'      # flask and the dashboard bundle
pip install 'hackagent[browser]'  # playwright
pip install 'hackagent[rag]'      # faiss and numpy
pip install 'hackagent[vision]'   # Pillow
pip install 'hackagent[hf]'       # HuggingFace datasets

Standalone binary (no Python required)

Every GitHub Release ships a self-contained archive per platform:

Platform Asset
Linux x86_64 hackagent-<version>-linux-x86_64.tar.gz
macOS arm64 hackagent-<version>-macos-arm64.tar.gz
Windows x86_64 hackagent-<version>-windows-x86_64.zip

Extract the archive and run the hackagent launcher inside it — no Python, pip or uv install needed. Keep the extracted folder intact; the launcher loads the libraries next to it.

Note: the WEB provider drives a real browser through Playwright (pip install 'hackagent[browser]'). The browser binaries cannot be embedded in the archive (or in the PyPI package). Before using hackagent web-based targets, install them once with playwright install.

Questions? Join community discussions or email ais@ai4i.it.

Architecture

HackAgent uses a modular pipeline to test agent robustness end-to-end.

Component Description
Attack Engine Orchestrates attacks using AdvPrefix, AutoDAN-Turbo, PAIR, TAP, FlipAttack, BoN, h4rm3l, CipherChat, PAP, and Static Template
Generator LLM role that creates adversarial prompts to test the target agent
Judge LLM role that evaluates whether attacks bypass safety measures
Target Agent Your AI agent under test across supported frameworks
Datasets Pre-built benchmark presets plus custom HuggingFace/file/URL JSON datasets

Supported Frameworks

Google ADK OpenAI SDK LiteLLM LangChain

Reporting

HackAgent supports both local and remote reporting.

  • A campaign records its results in local SQLite, readable offline.
  • Set execution.storage.backend: remote (with base_url and api_key_env) to send a run to a HackAgent server instead.

hackagent web serves the HackAgent dashboard — the same app as app.hackagent.dev — from your own machine, against your cloud data when an API key is configured and against the local SQLite database (read-only) when it is not. Your API key stays in the CLI process and is never exposed to the browser.

hackagent web

Install it with pip install 'hackagent[web]'; see the web command docs for modes and options.

Responsible Use

HackAgent is designed for authorized security testing only. Always obtain explicit permission before testing any AI system.

Do

  • Test your own agents
  • Conduct authorized pentesting
  • Follow coordinated disclosure
  • Share security knowledge responsibly

Don't

  • Test systems without permission
  • Exploit vulnerabilities maliciously
  • Violate terms of service
  • Share harmful exploit instructions irresponsibly

Read the full guidelines: Responsible Disclosure

Contributing

Contributions are welcome. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.

License

Licensed under Apache-2.0. See LICENSE.

Disclaimer

HackAgent is intended for security research and AI safety improvement. The authors are not responsible for misuse.

Metadata

Release files for hackagent 0.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hackagent 0.15.0
File Size Uploaded Provenance Actions
hackagent-0.15.0.tar.gz 794.5 kB Without provenance Details for hackagent-0.15.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hackagent 0.15.0
File Interpreter ABI Platform Actions
hackagent-0.15.0-py3-none-any.whl Python 3 none any Details for hackagent-0.15.0-py3-none-any.whl

Total release size: 1.8 MB

Release files / hackagent-0.15.0.tar.gz

Download URL hackagent-0.15.0.tar.gz
Size 794.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2c9dcea396a2d5a47cef944ef38def244f997dc07a523d2fe07dced82f44b7c9
BLAKE2b-256 checksum
How to use checksums
c379f775959e8468adc19aa3049d1e525a761ac596d064253dfa359c85e323b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hackagent-0.15.0-py3-none-any.whl

Download URL hackagent-0.15.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5d714cbedddb0af78b0076f10402c3fbc919d44a2c4ebd0a6ce75a5705895f73
BLAKE2b-256 checksum
How to use checksums
d1f4aa2364dd1215615dabf7cf980c1821524c65ce3e705cd3478e374941fb6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for hackagent 0.15.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.15.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page