pentestagent

Autonomous AI penetration-testing agent with TUI, Docker tools and MCP integration

Overview

PentestAgent is an AI-assisted penetration testing tool that runs in a terminal interface and drives real security tools on your behalf. It connects to models through LiteLLM-supported providers such as OpenAI or Anthropic, so operators can bring their own API key and model choice. The project is distributed under the MIT license and requires Python 3.10 or newer.

The tool targets security professionals who want an agent to handle reconnaissance and testing tasks while they keep control of the session. Its terminal interface exposes commands for setting a target, listing tools, taking notes, checking memory use, and producing a report from the work performed. Work can also run inside Docker, including a Kali-based image that carries common pentesting utilities.

What separates PentestAgent from a simple chat wrapper is its mode structure and its ability to delegate work to subordinate agents. A single instruction, a self-directed single task, a coordinated multi-agent crew, and a guided interactive chat are all available from the same interface. Prebuilt attack playbooks give structured approaches to specific security assessments, and built-in tools cover terminal access, browser use, notes, and web search.

Best for

  • Penetration testers
  • Security consultants
  • Red team operators
  • Security researchers

How to use

  1. Clone the repository and run the setup script for your platform, or create a virtual environment and install the package with its extras.
  2. Install Chromium through Playwright if you intend to use the browser tool.
  3. Create a .env file holding an API key for your provider and the model identifier to use.
  4. Launch the tool with the pentestagent command, optionally passing a target address.
  5. Choose an operating mode and issue commands from the terminal interface.
  6. Run a playbook with the run command and a named playbook when a structured assessment is needed.

What it can do

Multiple operating modes

The terminal interface provides distinct ways to work. An assist mode carries out one instruction with tool execution, an agent mode runs a single task without step-by-step input, a crew mode uses an orchestrator that starts specialized workers, and an interact mode keeps a conversation going so the agent can guide the operator through a test. Operators choose the mode with a slash command.

Self-spawning child agents

A built-in tool lets a running agent create a subordinate instance over stdio. That child has its own runtime, model client, conversation history, and notes, and its tools are added to the parent's toolset after it starts. The parent can then hand scoped subtasks to children and collect results, which supports hierarchical workflows without external orchestration.

Prebuilt attack playbooks

The project ships black-box security testing playbooks that lay out a structured approach for particular assessments. A playbook is selected at launch with the run command together with a target, giving the agent a defined path through the work rather than an open-ended prompt.

Built-in tool set

Agents can use a terminal, a browser, a notes store, and web search, the last of which needs a Tavily API key. External capability can be added through the Model Context Protocol, and the interface includes a command for viewing or adding MCP servers. A Chromium install through Playwright is required for the browser tool.

Docker execution

Tools can run inside a Docker container for isolation and to use pre-installed pentesting utilities. A base image includes nmap, netcat, and curl, while a Kali image adds tools such as metasploit, sqlmap, and hydra. Images can be pulled prebuilt or compiled locally with Docker Compose.

Session notes and reporting

The interface includes commands to show saved notes and to generate a report from the current session. Conversation history can be browsed and restored, and token or memory usage can be checked, which helps operators keep track of long engagements.

How it works

Setup starts by cloning the repository and running the provided setup script, which builds a virtual environment and installs dependencies. The operator then supplies provider credentials and a model name in a .env file. Any model supported by LiteLLM can be used, and custom OpenAI-compatible or Anthropic-compatible endpoints can be set through base URL variables. Launching the command opens the terminal interface, where the operator sets a target and picks a mode. Tools can run on the host or inside Docker, and MCP servers extend the available tools.

The agent acts on operator instructions and can spawn isolated children to handle scoped subtasks. Even in the self-directed mode, the human decides the target, the mode, and which playbook to run, and can stop a running agent at any time. Notes are kept during the session and a report is generated on request, so the operator reviews and approves the resulting output rather than the tool acting without oversight.

Supervised

Agents can execute multi-step tasks and delegate to child agents, but the operator sets the target and mode, selects playbooks, can halt a run, and reviews notes and reports.

Where it fits

  • Run a structured web assessment against a designated target using a prebuilt playbook.
  • Delegate separate subnet scans to isolated child agents and collect their results.
  • Use the interactive mode to get guidance while working through a penetration test.
  • Execute pentesting tools inside a Kali-based container to keep the host isolated.

Good fit

  • black-box security testing using the bundled attack playbooks
  • running autonomous single-task penetration testing through the agent mode
  • multi-agent orchestration where an agent spawns isolated child agents for scoped subtasks
  • isolated tool execution inside a Docker container with preinstalled pentesting tools

Not a fit

  • users without an API key for a supported LLM provider, since a provider key is required
  • environments that cannot install Python 3.10+ or Playwright Chromium for the browser tool
  • teams wanting a hosted managed service, since this is a command-line tool installed locally

How to evaluate

  1. Confirm you have an API key for OpenAI, Anthropic, or another LiteLLM-supported provider before setup.
  2. Verify your environment meets the Python 3.10+ requirement and can install Playwright Chromium.
  3. Decide whether you need Docker isolation with the base or Kali image, and whether Docker is available.
  4. Check whether the interactive, agent, crew, or assist mode matches how you want to drive testing.
  5. Confirm scope and target definitions suit your engagement, including the playbook approach for black-box testing.

Our take

PentestAgent is a locally installed command-line agent for penetration testing that connects to a wide range of LLM providers through LiteLLM. It offers several operating modes, from single-shot instructions to autonomous tasks and a multi-agent crew, plus prebuilt attack playbooks for black-box testing. Docker support lets it run tools inside an isolated base or Kali container with common pentesting utilities available. It is a developer-oriented tool that requires Python, provider API keys, and some setup effort.

Alternatives

AgentPricingAutonomyBest for
hermes-agent—SupervisedAI researchers, Developers, System administrators, DevOps engineers, Technical founders
deer-flow—SupervisedSoftware developers, AI and agent engineers, Research engineers, Technical teams building agent workflows, Data pipeline builders
OpenMausBot—SupervisedDevelopers and engineers, Technical founders and small product teams, DevOps and IT administrators, Operations specialists who coordinate recurring tasks, AI power users comfortable with command-line tools
Toonflow-app—SupervisedShort drama creators, Comic video producers, Storyboard artists, Previsualization artists, Video editors, Independent animators, Content studio operators
rowboat—SupervisedSoftware engineers, Engineering managers, Product managers, Support teams, Operations leads, Founders, Research and knowledge workers
artemis—SupervisedMobile QA engineers, Test automation engineers, AI coding assistant users, Android developers, CI and DevOps engineers

FAQ

What do I need before installing PentestAgent?
You need Python 3.10 or newer and an API key for OpenAI, Anthropic, or another LiteLLM-supported provider. The browser tool also requires installing Playwright Chromium.
How does PentestAgent connect to an LLM provider?
It reads a provider API key and model name from a .env file, and any LiteLLM-supported model can be used. You can also point it at OpenAI-compatible or Anthropic-compatible endpoints through custom base settings.
Can I run the pentesting tools in an isolated environment?
Yes. Docker support lets tools run inside a container, using either a base image with utilities like nmap, netcat, and curl, or a Kali image with additional tools such as metasploit, sqlmap, and hydra.
What operating modes are available?
The TUI offers assist for a single instruction with tool execution, agent for autonomous single-task work, crew for multi-agent orchestration, and interact for guided chat during a pentest.
What are playbooks used for?
Playbooks provide a structured approach to specific security assessments for black-box testing, and you can run one by specifying it with a target through the command line.
How does the multi-agent spawning work?
The spawn_mcp_agent tool lets a running agent create an isolated child agent connected over stdio, with its own runtime, model client, history, and notes. The child's tools become available to the parent on the next tool call.
How is PentestAgent licensed?
It is released under the MIT License, which permits use, modification, and distribution with the license notice included.
How is PentestAgent priced?
The project sources do not state a price or plan. You supply your own LLM provider API key, so model usage costs come from your chosen provider rather than from the listing.

Comments

No comments yet.

Embed a listing badge

Featured on AI Agents Marketplace
<a href="https://aiagentsmarketplace.dev/agents/pentestagent"><img src="https://aiagentsmarketplace.dev/badges/featured.svg" alt="Featured on AI Agents Marketplace" width="262" height="36"></a>
See badge options