# kutukam/autonomous-pentest-agent architecture

> Architecture diagram of the GitHub repository kutukam/autonomous-pentest-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kutukam/autonomous-pentest-agent
- Repository: https://github.com/kutukam/autonomous-pentest-agent

## Overview

Autonomous Pentest Agent is a Go-backed, multi-agent penetration-testing system with a Next.js control UI. The central workflow is task setup, planner-driven worker exploration, and persistence of discovered assets and findings for review. Major documented branches include traffic capture, human approval, manual finding retests, ScopeSentry asset sync, and reporting. The README and source index establish some subsystem relationships; unsampled implementation details are represented only where documented, and uncertain links are omitted or dashed.

Main entry points: [`agent/worker.go`](https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/worker.go) (Worker agents), [`server/server.go`](https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/server.go) (HTTP API), [`db/db.go`](https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/db.go) (PostgreSQL data), [`server/manager.go`](https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/manager.go) (Task manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webui["Web console<br/>[page.tsx]"]
  node_api["HTTP API<br/>[server.go]"]
end

subgraph group_runtime["Task runtime"]
  node_manager["Task manager<br/>[manager.go]"]
  node_engine["Task engine<br/>[engine.go]"]
  node_planner["Planner<br/>[planner.go]"]
  node_worker["Worker agents<br/>[worker.go]"]
  node_tools["Pentest tools<br/>[tools.go]"]
  node_guard["Approval guard<br/>[guard.go]"]
end

subgraph group_data["Exploration data"]
  node_pg[("PostgreSQL data<br/>[db.go]")]
  node_exploration[("Exploration graph<br/>[exploration.go]")]
  node_findings[("Findings<br/>[findings.go]")]
  node_evidence[("Finding evidence<br/>[store.go]")]
end

subgraph group_integrations["Services and integrations"]
  node_traffic["Traffic recorder<br/>[traffic.go]"]
  node_llm["LLM provider<br/>[pool.go]"]
  node_llmrecords["LLM records<br/>[llmrec.go]"]
  node_scope["ScopeSentry"]
  node_report["Report export<br/>[report.go]"]
end

subgraph group_operations["System operations"]
  node_notifications["Notifications<br/>[notify.go]"]
  node_retest["Finding retests<br/>[retester.go]"]
end

node_user(("Operator"))

node_user -->|"uses"| node_webui
node_webui -->|"requests"| node_api
node_api -.->|"serves tasks"| node_manager
node_manager -->|"persists state"| node_pg
node_manager -->|"starts proxy"| node_traffic
node_engine -->|"runs planning"| node_planner
node_engine -->|"runs work"| node_worker
node_worker -.->|"uses tools"| node_tools
node_worker -->|"gates calls"| node_guard
node_worker -.->|"records discoveries"| node_exploration
node_worker -.->|"records findings"| node_findings
node_traffic -->|"indexes exchanges"| node_pg
node_evidence -->|"snapshots traffic"| node_traffic
node_evidence -->|"stores bindings"| node_pg
node_api -->|"exposes records"| node_llmrecords
node_llmrecords -->|"records usage"| node_pg
node_user -->|"selects assets"| node_scope
node_scope -->|"syncs assets"| node_api
node_user -->|"starts retest"| node_retest
node_retest -->|"updates status"| node_findings
node_findings -.->|"exports results"| node_report
node_api -.->|"configures delivery"| node_notifications
node_llm -.->|"provides completions"| node_planner
node_llm -.->|"provides completions"| node_worker

click node_webui "https://github.com/kutukam/autonomous-pentest-agent/blob/main/web/src/app/(main)/function/tasks/page.tsx"
click node_api "https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/server.go"
click node_manager "https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/manager.go"
click node_engine "https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/engine.go"
click node_planner "https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/planner.go"
click node_worker "https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/worker.go"
click node_tools "https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/tools.go"
click node_guard "https://github.com/kutukam/autonomous-pentest-agent/blob/main/guard/guard.go"
click node_pg "https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/db.go"
click node_exploration "https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/exploration.go"
click node_findings "https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/findings.go"
click node_evidence "https://github.com/kutukam/autonomous-pentest-agent/blob/main/evidence/store.go"
click node_traffic "https://github.com/kutukam/autonomous-pentest-agent/blob/main/traffic/traffic.go"
click node_llm "https://github.com/kutukam/autonomous-pentest-agent/blob/main/llmpool/pool.go"
click node_llmrecords "https://github.com/kutukam/autonomous-pentest-agent/blob/main/llmrec/llmrec.go"
click node_report "https://github.com/kutukam/autonomous-pentest-agent/blob/main/report/report.go"
click node_notifications "https://github.com/kutukam/autonomous-pentest-agent/blob/main/notify/notify.go"
click node_retest "https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/retester.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webui,node_api toneBlue
class node_manager,node_engine,node_planner,node_worker,node_tools,node_guard toneAmber
class node_pg,node_exploration,node_findings,node_evidence toneMint
class node_traffic,node_llm,node_llmrecords,node_scope,node_report toneRose
class node_notifications,node_retest,node_user toneIndigo
```

## Components

### User interface

- [Web console](https://github.com/kutukam/autonomous-pentest-agent/blob/main/web/src/app/(main)/function/tasks/page.tsx): `web/src/app/(main)/function/tasks/page.tsx`
- [HTTP API](https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/server.go): `server/server.go`

### Task runtime

- [Task manager](https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/manager.go): `server/manager.go`
- [Task engine](https://github.com/kutukam/autonomous-pentest-agent/blob/main/server/engine.go): `server/engine.go`
- [Planner](https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/planner.go): `agent/planner.go`
- [Worker agents](https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/worker.go): `agent/worker.go`
- [Pentest tools](https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/tools.go): `agent/tools.go`
- [Approval guard](https://github.com/kutukam/autonomous-pentest-agent/blob/main/guard/guard.go): `guard/guard.go`

### Exploration data

- [PostgreSQL data](https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/db.go): `db/db.go`
- [Exploration graph](https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/exploration.go): `db/exploration.go`
- [Findings](https://github.com/kutukam/autonomous-pentest-agent/blob/main/db/findings.go): `db/findings.go`
- [Finding evidence](https://github.com/kutukam/autonomous-pentest-agent/blob/main/evidence/store.go): `evidence/store.go`

### Services and integrations

- [Traffic recorder](https://github.com/kutukam/autonomous-pentest-agent/blob/main/traffic/traffic.go): `traffic/traffic.go`
- [LLM provider](https://github.com/kutukam/autonomous-pentest-agent/blob/main/llmpool/pool.go): `llmpool/pool.go`
- [LLM records](https://github.com/kutukam/autonomous-pentest-agent/blob/main/llmrec/llmrec.go): `llmrec/llmrec.go`
- **ScopeSentry**
- [Report export](https://github.com/kutukam/autonomous-pentest-agent/blob/main/report/report.go): `report/report.go`

### System operations

- [Notifications](https://github.com/kutukam/autonomous-pentest-agent/blob/main/notify/notify.go): `notify/notify.go`
- [Finding retests](https://github.com/kutukam/autonomous-pentest-agent/blob/main/agent/retester.go): `agent/retester.go`

### Other components

- **Operator**

## Connections

- Operator → Web console: uses
- Web console → HTTP API: requests
- HTTP API → Task manager: serves tasks
- Task manager → PostgreSQL data: persists state (evidence: `server/manager.go`)
- Task manager → Traffic recorder: starts proxy (evidence: `server/manager.go`)
- Task engine → Planner: runs planning (evidence: `server/engine.go`)
- Task engine → Worker agents: runs work (evidence: `server/engine.go`)
- Worker agents → Pentest tools: uses tools
- Worker agents → Approval guard: gates calls (evidence: `agent/worker.go`)
- Worker agents → Exploration graph: records discoveries
- Worker agents → Findings: records findings
- Traffic recorder → PostgreSQL data: indexes exchanges (evidence: `traffic/traffic.go`)
- Finding evidence → Traffic recorder: snapshots traffic (evidence: `evidence/store.go`)
- Finding evidence → PostgreSQL data: stores bindings (evidence: `evidence/store.go`)
- HTTP API → LLM records: exposes records (evidence: `server/server.go`)
- LLM records → PostgreSQL data: records usage (evidence: `llmrec/llmrec.go`)
- Operator → ScopeSentry: selects assets
- ScopeSentry → HTTP API: syncs assets
- Operator → Finding retests: starts retest
- Finding retests → Findings: updates status
- Findings → Report export: exports results
- HTTP API → Notifications: configures delivery
- LLM provider → Planner: provides completions
- LLM provider → Worker agents: provides completions
