# neothecapt/redteamagent architecture

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

- Interactive diagram: https://gitdiagram.com/neothecapt/redteamagent
- Repository: https://github.com/neothecapt/redteamagent

## Overview

RedTeam Agent is an autonomous penetration-testing workflow for CTF/lab targets, with an optional local GUI for managing projects and observing runs. The documented engagement proceeds through recon, collection, testing, exploit/OSINT, and reporting; the GUI provides project setup, run control, progress, cases, events, documents, and artifacts. Backend excerpts show run supervision, persistence, summaries, and WebSocket streaming. Agent internals and several GUI/API subsystems are not included in the excerpts, so those branches rely on README statements; unsampled links are documented rather than inferred from names.

Main entry points: [`orchestrator/backend/app/main.py`](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/main.py) (HTTP and WS API), [`orchestrator/frontend/src/routes/ShellPage.tsx`](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/frontend/src/routes/ShellPage.tsx) (Orchestrator UI), [`agent/scripts`](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts) (Recon), [`orchestrator/backend/app/services/runs.py`](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/runs.py) (Run supervision)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engagement["Engagement workflow"]
  node_recon["Recon"]
  node_collect["Case collection"]
  node_test["Test pipeline"]
  node_exploit_osint["Exploit and OSINT"]
  node_report["Report synthesis"]
end

subgraph group_agent["Agent capabilities"]
  node_specialists["Specialist agents"]
  node_pentest_tools["Containerized tools"]
end

subgraph group_backend["Orchestrator backend"]
  node_run_supervisor["Run supervision<br/>[runs.py]"]
  node_runtime_launcher["Runtime launcher<br/>[launcher.py]"]
  node_run_summary["Run summaries<br/>[run_summary.py]"]
  node_api_routes["HTTP and WS API<br/>[main.py]"]
  node_live_events["Live event stream<br/>[ws.py]"]
end

subgraph group_frontend["Orchestrator UI"]
  node_web_app["Orchestrator UI<br/>[ShellPage.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_state["Persistent state"]
  node_sqlite[("Orchestrator database<br/>[db.py]")]
  node_engagement_files["Engagement artifacts"]
end

node_operator(("Operator"))
node_target{{"Lab target"}}
node_ai_cli{{"AI CLI"}}
node_gui_user(("GUI user"))

node_operator -->|"starts engagement"| node_ai_cli
node_ai_cli -->|"begins workflow"| node_recon
node_recon -->|"feeds intelligence"| node_collect
node_collect -->|"queues cases"| node_test
node_test -->|"advances findings"| node_exploit_osint
node_exploit_osint -->|"informs report"| node_report
node_recon -->|"uses agents"| node_specialists
node_test -->|"uses tools"| node_pentest_tools
node_exploit_osint -.->|"uses tools"| node_pentest_tools
node_target -->|"provides target"| node_recon
node_report -->|"writes results"| node_engagement_files
node_gui_user -->|"manages runs"| node_web_app
node_web_app -->|"requests data"| node_api_client
node_api_client -->|"calls endpoints"| node_api_routes
node_api_routes -->|"delegates run actions"| node_run_supervisor
node_run_supervisor -->|"prepares runtime"| node_runtime_launcher
node_run_supervisor -->|"persists run state"| node_sqlite
node_api_routes -->|"serves summaries"| node_run_summary
node_run_summary -->|"reads run data"| node_sqlite
node_api_routes -->|"streams run updates"| node_live_events
node_web_app -->|"subscribes to updates"| node_live_events
node_web_app -->|"views cases documents artifacts"| node_api_routes

click node_recon "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_collect "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_test "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_exploit_osint "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_report "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_specialists "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_pentest_tools "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"
click node_web_app "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/frontend/src/routes/ShellPage.tsx"
click node_api_client "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/frontend/src/lib/api.ts"
click node_run_supervisor "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/runs.py"
click node_runtime_launcher "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/launcher.py"
click node_run_summary "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/run_summary.py"
click node_api_routes "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/main.py"
click node_live_events "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/ws.py"
click node_sqlite "https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/db.py"
click node_engagement_files "https://github.com/neothecapt/redteamagent/tree/master/agent/scripts"

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_recon,node_collect,node_test,node_exploit_osint,node_report,node_gui_user toneBlue
class node_specialists,node_pentest_tools toneAmber
class node_run_supervisor,node_runtime_launcher,node_run_summary,node_api_routes,node_live_events toneMint
class node_web_app,node_api_client toneRose
class node_sqlite,node_engagement_files,node_operator,node_target,node_ai_cli toneIndigo
```

## Components

### Engagement workflow

- [Recon](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`
- [Case collection](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`
- [Test pipeline](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`
- [Exploit and OSINT](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`
- [Report synthesis](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`

### Agent capabilities

- [Specialist agents](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`
- [Containerized tools](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`

### Orchestrator backend

- [Run supervision](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/runs.py): `orchestrator/backend/app/services/runs.py`
- [Runtime launcher](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/launcher.py): `orchestrator/backend/app/services/launcher.py`
- [Run summaries](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/services/run_summary.py): `orchestrator/backend/app/services/run_summary.py`
- [HTTP and WS API](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/main.py): `orchestrator/backend/app/main.py`
- [Live event stream](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/ws.py): `orchestrator/backend/app/ws.py`

### Orchestrator UI

- [Orchestrator UI](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/frontend/src/routes/ShellPage.tsx): `orchestrator/frontend/src/routes/ShellPage.tsx`
- [API client](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/frontend/src/lib/api.ts): `orchestrator/frontend/src/lib/api.ts`

### Persistent state

- [Orchestrator database](https://github.com/neothecapt/redteamagent/blob/master/orchestrator/backend/app/db.py): `orchestrator/backend/app/db.py`
- [Engagement artifacts](https://github.com/neothecapt/redteamagent/tree/master/agent/scripts): `agent/scripts`

### Other components

- **Operator**
- **Lab target**
- **AI CLI**
- **GUI user**

## Connections

- Operator → AI CLI: starts engagement (evidence: `README.md`)
- AI CLI → Recon: begins workflow (evidence: `README.md`)
- Recon → Case collection: feeds intelligence (evidence: `README.md`)
- Case collection → Test pipeline: queues cases (evidence: `README.md`)
- Test pipeline → Exploit and OSINT: advances findings (evidence: `README.md`)
- Exploit and OSINT → Report synthesis: informs report (evidence: `README.md`)
- Recon → Specialist agents: uses agents (evidence: `README.md`)
- Test pipeline → Containerized tools: uses tools (evidence: `README.md`)
- Exploit and OSINT → Containerized tools: uses tools (evidence: `README.md`)
- Lab target → Recon: provides target (evidence: `README.md`)
- Report synthesis → Engagement artifacts: writes results (evidence: `README.md`)
- GUI user → Orchestrator UI: manages runs (evidence: `README.md`)
- Orchestrator UI → API client: requests data (evidence: `orchestrator/frontend/src/routes/ShellPage.tsx`)
- API client → HTTP and WS API: calls endpoints (evidence: `README.md`)
- HTTP and WS API → Run supervision: delegates run actions (evidence: `orchestrator/backend/app/main.py`)
- Run supervision → Runtime launcher: prepares runtime (evidence: `orchestrator/backend/app/services/runs.py`)
- Run supervision → Orchestrator database: persists run state (evidence: `orchestrator/backend/app/services/runs.py`)
- HTTP and WS API → Run summaries: serves summaries
- Run summaries → Orchestrator database: reads run data (evidence: `orchestrator/backend/app/services/run_summary.py`)
- HTTP and WS API → Live event stream: streams run updates (evidence: `orchestrator/backend/app/main.py`)
- Orchestrator UI → Live event stream: subscribes to updates
- Orchestrator UI → HTTP and WS API: views cases documents artifacts (evidence: `README.md`)
