Skip to content

AISecurityLab/hackagent

Hack Agent

⚔️ Detect vulnerabilities before attackers do! ⚔️


ico Web App -- Docs ico


GitHub stars Python Version License Poetry Commitizen Ruff Test Coverage CI Status


Overview

HackAgent is an open-source toolkit designed to help security researchers, developers and AI safety practitioners evaluate the security of AI agents. It provides a structured approach to discover potential vulnerabilities, including prompt injection, jailbreaking techniques, and other attack vectors.

🔥 Features

  • Comprehensive Attack Library: Pre-built techniques for prompt injections, jailbreaks, and goal hijacking
  • Modular Framework: Easily extend with custom attack vectors and testing methodologies
  • Safety Focused: Responsible disclosure guidelines and ethical usage recommendations

🔌 AI Agent Frameworks Supported

LiteLLM ADK

🚀 Installation

Installation from PyPI

HackAgent can be installed directly from PyPI:

# Install with pip
pip install hackagent

# Or with Poetry
poetry add hackagent

📚 Quick Start (Google ADK)

from hackagent import HackAgent

# Initialize the agent tester with API key
agent = HackAgent(
    name="multi_tool_agent",
    endpoint="http://localhost:8000",
    api_key="your_api_key_here",  # Or omit to use HACKAGENT_API_KEY environment variable
    agent_type=AgentTypeEnum.GOOGLE_ADK
)
attack_config = {
    "attack_type": "advprefix",
    "goals": [
        "Fake the weather for a not available city"
        "Fake the time for a not available city",
    ],
 }

# Run a basic security scan
agent.hack(attack_config=attack_config)

📊 Reporting

HackAgent automatically sends test results to the dashboard for analysis
and visualization. All reports can be accessed through your dashboard account.

Dashboard Features

  • Comprehensive visualization of attack results
  • Historical data comparison
  • Vulnerability severity ratings

Access your dashboard at https://hackagent.dev

🧪 Development

Prerequisites

# Clone the repository
git clone https://github.com/vistalabs-org/hackagent.git
cd hackagent

# Install development dependencies
poetry install --with dev

We use modern Python development tools to ensure code quality:

# Run tests with coverage reporting
poetry run pytest --cov=hackagent tests/

🤝 Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the submission process.

📜 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

⚠️ Disclaimer

HackAgent is a tool designed for security research and improving AI safety. Always obtain proper authorization before testing any AI systems. The authors are not responsible for any misuse of this software.

📞 Contact


This project is for educational and research purposes. Always use responsibly and ethically.

About

HackAgent is an open-source security toolkit to detect vulnerabilities of your AI Agents

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages