# confident-ai/deepteam architecture

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

- Interactive diagram: https://gitdiagram.com/confident-ai/deepteam
- Repository: https://github.com/confident-ai/deepteam

## Overview

DeepTeam is a local LLM red-teaming framework: an engineer configures a target model and risk scenarios, the framework simulates attacks, submits test cases to the target, and evaluates replies with LLM-as-a-judge metrics to produce scored findings. Its broader product includes guardrails, trace analysis, code scanning, risk-framework mappings, a CLI, and an optional hosted results integration. The sampled sources substantiate attack refinement and vulnerability assessment/evaluation; unsampled subsystem wiring is represented only where documented, so some links are intentionally omitted.

Main entry points: [`deepteam/vulnerabilities`](https://github.com/confident-ai/deepteam/tree/main/deepteam/vulnerabilities) (Vulnerability scenarios), [`deepteam/red_teamer/red_teamer.py`](https://github.com/confident-ai/deepteam/blob/main/deepteam/red_teamer/red_teamer.py) (Red team runner), [`deepteam/red_teamer/risk_assessment.py`](https://github.com/confident-ai/deepteam/blob/main/deepteam/red_teamer/risk_assessment.py) (Risk assessment and reports), [`deepteam/test_case`](https://github.com/confident-ai/deepteam/tree/main/deepteam/test_case) (Red-team test cases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_assessment["Red-team assessment"]
  node_redteamer["Red team runner<br/>[red_teamer.py]"]
  node_vulnerabilities["Vulnerability scenarios"]
  node_metrics["Judge metrics"]
  node_testcase["Red-team test cases"]
  node_frameworks["Risk frameworks"]
end

subgraph group_testing["Test generation"]
  node_attackengine["Attack refinement<br/>[attack_engine.py]"]
  node_attacktypes["Single- and multi-turn attacks"]
  node_simulator["Attack simulation"]
end

subgraph group_protection["Protection and analysis"]
  node_guardrails["Runtime guardrails<br/>[guardrails.py]"]
  node_trace["Trace scanner<br/>[trace_scanner.py]"]
  node_codescanner["Code scanner<br/>[code_scanner.py]"]
end

subgraph group_interfaces["Interfaces and reporting"]
  node_cli["Command-line interface<br/>[main.py]"]
  node_confidentapi["Platform integration<br/>[api.py]"]
  node_reporting["Risk assessment and reports<br/>[risk_assessment.py]"]
end

node_engineer(("Engineer"))
node_target(("Target LLM system"))
node_confident(("Confident AI"))

node_engineer -->|"configures and runs"| node_redteamer
node_redteamer -->|"selects scenarios"| node_vulnerabilities
node_vulnerabilities -->|"simulates attacks"| node_attacktypes
node_vulnerabilities -->|"generates test inputs"| node_simulator
node_vulnerabilities -->|"refines inputs"| node_attackengine
node_attackengine -->|"generates variations"| node_simulator
node_vulnerabilities -->|"creates test cases"| node_testcase
node_vulnerabilities -->|"submits test inputs"| node_target
node_target -->|"returns responses"| node_testcase
node_vulnerabilities -->|"evaluates responses"| node_metrics
node_metrics -->|"adds scores and reasons"| node_testcase
node_frameworks -->|"categorizes risks"| node_vulnerabilities
node_engineer -->|"configures protection"| node_guardrails
node_engineer -->|"submits traces"| node_trace
node_engineer -->|"scans source"| node_codescanner
node_codescanner -->|"produces findings"| node_reporting
node_engineer -->|"runs commands"| node_cli
node_cli -->|"configures assessment"| node_redteamer
node_redteamer -->|"returns assessment results"| node_reporting
node_reporting -.->|"syncs results"| node_confidentapi
node_confidentapi -.->|"transfers risk data"| node_confident

click node_redteamer "https://github.com/confident-ai/deepteam/blob/main/deepteam/red_teamer/red_teamer.py"
click node_vulnerabilities "https://github.com/confident-ai/deepteam/tree/main/deepteam/vulnerabilities"
click node_metrics "https://github.com/confident-ai/deepteam/tree/main/deepteam/metrics"
click node_testcase "https://github.com/confident-ai/deepteam/tree/main/deepteam/test_case"
click node_attackengine "https://github.com/confident-ai/deepteam/blob/main/deepteam/attacks/attack_engine/attack_engine.py"
click node_attacktypes "https://github.com/confident-ai/deepteam/tree/main/deepteam/attacks"
click node_simulator "https://github.com/confident-ai/deepteam/blob/main/deepteam/attacks/attack_simulator/attack_simulator.py"
click node_frameworks "https://github.com/confident-ai/deepteam/tree/main/deepteam/frameworks"
click node_guardrails "https://github.com/confident-ai/deepteam/blob/main/deepteam/guardrails/guardrails.py"
click node_trace "https://github.com/confident-ai/deepteam/blob/main/deepteam/trace_scanner/trace_scanner.py"
click node_codescanner "https://github.com/confident-ai/deepteam/blob/main/deepteam/code_scanner/code_scanner.py"
click node_cli "https://github.com/confident-ai/deepteam/blob/main/deepteam/cli/main.py"
click node_confidentapi "https://github.com/confident-ai/deepteam/blob/main/deepteam/confident/api.py"
click node_reporting "https://github.com/confident-ai/deepteam/blob/main/deepteam/red_teamer/risk_assessment.py"

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_redteamer,node_vulnerabilities,node_metrics,node_testcase,node_frameworks toneBlue
class node_attackengine,node_attacktypes,node_simulator toneAmber
class node_guardrails,node_trace,node_codescanner toneMint
class node_cli,node_confidentapi,node_reporting toneRose
class node_engineer,node_target,node_confident toneIndigo
```

## Components

### Red-team assessment

- [Red team runner](https://github.com/confident-ai/deepteam/blob/main/deepteam/red_teamer/red_teamer.py): `deepteam/red_teamer/red_teamer.py`
- [Vulnerability scenarios](https://github.com/confident-ai/deepteam/tree/main/deepteam/vulnerabilities): `deepteam/vulnerabilities`
- [Judge metrics](https://github.com/confident-ai/deepteam/tree/main/deepteam/metrics): `deepteam/metrics`
- [Red-team test cases](https://github.com/confident-ai/deepteam/tree/main/deepteam/test_case): `deepteam/test_case`
- [Risk frameworks](https://github.com/confident-ai/deepteam/tree/main/deepteam/frameworks): `deepteam/frameworks`

### Test generation

- [Attack refinement](https://github.com/confident-ai/deepteam/blob/main/deepteam/attacks/attack_engine/attack_engine.py): `deepteam/attacks/attack_engine/attack_engine.py`
- [Single- and multi-turn attacks](https://github.com/confident-ai/deepteam/tree/main/deepteam/attacks): `deepteam/attacks`
- [Attack simulation](https://github.com/confident-ai/deepteam/blob/main/deepteam/attacks/attack_simulator/attack_simulator.py): `deepteam/attacks/attack_simulator/attack_simulator.py`

### Protection and analysis

- [Runtime guardrails](https://github.com/confident-ai/deepteam/blob/main/deepteam/guardrails/guardrails.py): `deepteam/guardrails/guardrails.py`
- [Trace scanner](https://github.com/confident-ai/deepteam/blob/main/deepteam/trace_scanner/trace_scanner.py): `deepteam/trace_scanner/trace_scanner.py`
- [Code scanner](https://github.com/confident-ai/deepteam/blob/main/deepteam/code_scanner/code_scanner.py): `deepteam/code_scanner/code_scanner.py`

### Interfaces and reporting

- [Command-line interface](https://github.com/confident-ai/deepteam/blob/main/deepteam/cli/main.py): `deepteam/cli/main.py`
- [Platform integration](https://github.com/confident-ai/deepteam/blob/main/deepteam/confident/api.py): `deepteam/confident/api.py`
- [Risk assessment and reports](https://github.com/confident-ai/deepteam/blob/main/deepteam/red_teamer/risk_assessment.py): `deepteam/red_teamer/risk_assessment.py`

### Other components

- **Engineer**
- **Target LLM system**
- **Confident AI**

## Connections

- Engineer → Red team runner: configures and runs
- Red team runner → Vulnerability scenarios: selects scenarios
- Vulnerability scenarios → Single- and multi-turn attacks: simulates attacks
- Vulnerability scenarios → Attack simulation: generates test inputs
- Vulnerability scenarios → Attack refinement: refines inputs
- Attack refinement → Attack simulation: generates variations
- Vulnerability scenarios → Red-team test cases: creates test cases
- Vulnerability scenarios → Target LLM system: submits test inputs
- Target LLM system → Red-team test cases: returns responses
- Vulnerability scenarios → Judge metrics: evaluates responses
- Judge metrics → Red-team test cases: adds scores and reasons
- Risk frameworks → Vulnerability scenarios: categorizes risks
- Engineer → Runtime guardrails: configures protection
- Engineer → Trace scanner: submits traces
- Engineer → Code scanner: scans source
- Code scanner → Risk assessment and reports: produces findings
- Engineer → Command-line interface: runs commands
- Command-line interface → Red team runner: configures assessment
- Red team runner → Risk assessment and reports: returns assessment results
- Risk assessment and reports → Platform integration: syncs results
- Platform integration → Confident AI: transfers risk data
