# pentagi-oss/pentagi architecture

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

- Interactive diagram: https://gitdiagram.com/pentagi-oss/pentagi
- Repository: https://github.com/pentagi-oss/pentagi

## Overview

PentAGI is a self-hosted AI penetration-testing system. The principal workflow starts with a security engineer configuring and launching a flow in the web UI; the backend coordinates autonomous specialist agents, which use isolated security tools and external intelligence against a target, persist activity, and expose progress and reports. Supporting layers include provider adapters, GraphQL/API services, durable storage, knowledge-graph memory, and observability. The README documents these capabilities; sampled source confirms frontend routing/task rendering and selected backend subsystems, but not the full agent execution wiring.

Main entry points: [`backend/pkg/providers/performer.go`](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/providers/performer.go) (Autonomous agent team), [`backend/pkg/server/router.go`](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/server/router.go) (HTTP and GraphQL API), [`backend/pkg/server/services`](https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/server/services) (Domain services), [`frontend/src/app.tsx`](https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/app.tsx) (PentAGI web UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web experience"]
  node_web["PentAGI web UI<br/>[app.tsx]"]
  node_flowtasks["Flow task view<br/>[flow-tasks.tsx]"]
  node_graphqlclient["GraphQL client<br/>[apollo.ts]"]
end

subgraph group_backend["API and state"]
  node_api["HTTP and GraphQL API<br/>[router.go]"]
  node_auth["Authentication"]
  node_services["Domain services"]
  node_database[("Persistent records")]
  node_subscriptions["Live event channels<br/>[controller.go]"]
end

subgraph group_agents["Testing workflow"]
  node_queue["Task queue<br/>[queue.go]"]
  node_agentsystem["Autonomous agent team<br/>[performer.go]"]
  node_tools["Security tool suite"]
  node_docker["Isolated execution<br/>[client.go]"]
  node_reporting["Vulnerability reports<br/>[report.go]"]
end

subgraph group_integrations["External systems"]
  node_llm["LLM providers<br/>[handlers.go]"]
  node_search["Web search systems<br/>[search.go]"]
  node_browser["Web intelligence<br/>[browser.go]"]
  node_memory["Knowledge graph<br/>[client.go]"]
  node_observability["Telemetry and analytics<br/>[obs.go]"]
end

subgraph group_setup["Installation"]
  node_installer["Setup wizard<br/>[app.go]"]
end

node_engineer(("Security engineer"))
node_target(("System under test"))

node_engineer -->|"configures and launches"| node_web
node_web -->|"uses"| node_graphqlclient
node_graphqlclient -.->|"sends GraphQL requests"| node_api
node_api -.->|"authenticates requests"| node_auth
node_api -.->|"routes operations"| node_services
node_services -.->|"reads and writes"| node_database
node_services -.->|"publishes live updates"| node_subscriptions
node_subscriptions -.->|"streams progress"| node_flowtasks
node_flowtasks -->|"renders task progress"| node_web
node_services -.->|"dispatches work"| node_queue
node_queue -->|"delivers tasks"| node_agentsystem
node_agentsystem -->|"requests reasoning"| node_llm
node_agentsystem -->|"selects and invokes"| node_tools
node_tools -->|"executes in sandbox"| node_docker
node_docker -->|"runs security tests"| node_target
node_agentsystem -->|"gathers intelligence"| node_search
node_agentsystem -->|"browses sources"| node_browser
node_agentsystem -->|"stores knowledge"| node_memory
node_agentsystem -->|"persists activity"| node_database
node_agentsystem -->|"generates findings"| node_reporting
node_api -->|"reports telemetry"| node_observability
node_engineer -->|"configures deployment"| node_installer

click node_web "https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/app.tsx"
click node_flowtasks "https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/features/flows/tasks/flow-tasks.tsx"
click node_graphqlclient "https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/lib/apollo.ts"
click node_api "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/server/router.go"
click node_auth "https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/server/auth"
click node_services "https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/server/services"
click node_database "https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/database"
click node_subscriptions "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/graph/subscriptions/controller.go"
click node_queue "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/queue/queue.go"
click node_agentsystem "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/providers/performer.go"
click node_tools "https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/tools"
click node_docker "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/docker/client.go"
click node_reporting "https://github.com/pentagi-oss/pentagi/blob/main/backend/cmd/ctester/report.go"
click node_llm "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/providers/handlers.go"
click node_search "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/tools/search.go"
click node_browser "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/tools/browser.go"
click node_memory "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/graphiti/client.go"
click node_observability "https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/observability/obs.go"
click node_installer "https://github.com/pentagi-oss/pentagi/blob/main/backend/cmd/installer/wizard/app.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_web,node_flowtasks,node_graphqlclient toneBlue
class node_api,node_auth,node_services,node_database,node_subscriptions toneAmber
class node_queue,node_agentsystem,node_tools,node_docker,node_reporting toneMint
class node_llm,node_search,node_browser,node_memory,node_observability toneRose
class node_installer,node_engineer,node_target toneIndigo
```

## Components

### Web experience

- [PentAGI web UI](https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/app.tsx): `frontend/src/app.tsx`
- [Flow task view](https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/features/flows/tasks/flow-tasks.tsx): `frontend/src/features/flows/tasks/flow-tasks.tsx`
- [GraphQL client](https://github.com/pentagi-oss/pentagi/blob/main/frontend/src/lib/apollo.ts): `frontend/src/lib/apollo.ts`

### API and state

- [HTTP and GraphQL API](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/server/router.go): `backend/pkg/server/router.go`
- [Authentication](https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/server/auth): `backend/pkg/server/auth`
- [Domain services](https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/server/services): `backend/pkg/server/services`
- [Persistent records](https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/database): `backend/pkg/database`
- [Live event channels](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/graph/subscriptions/controller.go): `backend/pkg/graph/subscriptions/controller.go`

### Testing workflow

- [Task queue](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/queue/queue.go): `backend/pkg/queue/queue.go`
- [Autonomous agent team](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/providers/performer.go): `backend/pkg/providers/performer.go`
- [Security tool suite](https://github.com/pentagi-oss/pentagi/tree/main/backend/pkg/tools): `backend/pkg/tools`
- [Isolated execution](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/docker/client.go): `backend/pkg/docker/client.go`
- [Vulnerability reports](https://github.com/pentagi-oss/pentagi/blob/main/backend/cmd/ctester/report.go): `backend/cmd/ctester/report.go`

### External systems

- [LLM providers](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/providers/handlers.go): `backend/pkg/providers/handlers.go`
- [Web search systems](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/tools/search.go): `backend/pkg/tools/search.go`
- [Web intelligence](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/tools/browser.go): `backend/pkg/tools/browser.go`
- [Knowledge graph](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/graphiti/client.go): `backend/pkg/graphiti/client.go`
- [Telemetry and analytics](https://github.com/pentagi-oss/pentagi/blob/main/backend/pkg/observability/obs.go): `backend/pkg/observability/obs.go`

### Installation

- [Setup wizard](https://github.com/pentagi-oss/pentagi/blob/main/backend/cmd/installer/wizard/app.go): `backend/cmd/installer/wizard/app.go`

### Other components

- **Security engineer**
- **System under test**

## Connections

- Security engineer → PentAGI web UI: configures and launches (evidence: `README.md`)
- PentAGI web UI → GraphQL client: uses (evidence: `frontend/src/app.tsx`)
- GraphQL client → HTTP and GraphQL API: sends GraphQL requests
- HTTP and GraphQL API → Authentication: authenticates requests
- HTTP and GraphQL API → Domain services: routes operations
- Domain services → Persistent records: reads and writes
- Domain services → Live event channels: publishes live updates
- Live event channels → Flow task view: streams progress
- Flow task view → PentAGI web UI: renders task progress (evidence: `frontend/src/features/flows/tasks/flow-tasks.tsx`)
- Domain services → Task queue: dispatches work
- Task queue → Autonomous agent team: delivers tasks (evidence: `README.md`)
- Autonomous agent team → LLM providers: requests reasoning (evidence: `README.md`)
- Autonomous agent team → Security tool suite: selects and invokes (evidence: `README.md`)
- Security tool suite → Isolated execution: executes in sandbox (evidence: `README.md`)
- Isolated execution → System under test: runs security tests (evidence: `README.md`)
- Autonomous agent team → Web search systems: gathers intelligence (evidence: `README.md`)
- Autonomous agent team → Web intelligence: browses sources (evidence: `README.md`)
- Autonomous agent team → Knowledge graph: stores knowledge (evidence: `README.md`)
- Autonomous agent team → Persistent records: persists activity (evidence: `README.md`)
- Autonomous agent team → Vulnerability reports: generates findings (evidence: `README.md`)
- HTTP and GraphQL API → Telemetry and analytics: reports telemetry (evidence: `README.md`)
- Security engineer → Setup wizard: configures deployment (evidence: `README.md`)
