# cage-challenge/cage-challenge-4 architecture

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

- Interactive diagram: https://gitdiagram.com/cage-challenge/cage-challenge-4
- Repository: https://github.com/cage-challenge/cage-challenge-4

## Overview

CybORG is a cyber-operations simulation gym for developing and evaluating autonomous defensive agents. A scenario generator creates an enterprise network and its agent roster; agents choose actions through the environment, the simulator applies them to shared network state, and observations and rewards support the next decision. The graph also shows red-team attack behavior, green-user activity, blue defensive capabilities, and agent wrappers. Several links are supported only by the README or source-index references; unsampled implementations and their internal call paths are not inferred.

Main entry points: [`CybORG/Simulator/SimulationController.py`](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/SimulationController.py) (Turn controller), [`CybORG/Simulator/State.py`](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/State.py) (Simulation state), [`CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py`](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py) (Enterprise scenario), [`CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py`](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py) (Abstract actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_environment["Environment API"]
  node_env["Gym environment<br/>[env.py]"]
  node_evaluation["Evaluation runner<br/>[evaluation.py]"]
end

subgraph group_scenario_agents["Scenarios and Agents"]
  node_scenario_gen["Enterprise scenario"]
  node_scenario["Scenario config<br/>[Scenario.py]"]
  node_agent_impl["Agent strategies"]
  node_green_agent["Green user agent"]
  node_wrappers["Agent wrappers"]
end

subgraph group_simulation["Simulation Runtime"]
  node_controller["Turn controller"]
  node_action_handler["Action dispatch<br/>[ActionHandler.py]"]
  node_abstract_actions["Abstract actions"]
  node_concrete_actions["Concrete exploits<br/>[ExploitAction.py]"]
  node_green_action["Green service access"]
end

subgraph group_domain["Network Domain"]
  node_state[("Simulation state<br/>[State.py]")]
  node_host["Hosts and services<br/>[Host.py]"]
  node_session["Agent sessions<br/>[Session.py]"]
  node_observation["Observations<br/>[Observation.py]"]
  node_reward["Reward calculation"]
end

node_user(("Agent developer"))

node_user -->|"uses"| node_env
node_env -->|"delegates"| node_controller
node_controller -->|"creates scenario"| node_scenario_gen
node_scenario_gen -->|"builds"| node_scenario
node_scenario_gen -->|"assigns agents"| node_agent_impl
node_scenario_gen -->|"assigns agents"| node_green_agent
node_agent_impl -->|"selects actions"| node_abstract_actions
node_controller -->|"dispatches"| node_action_handler
node_action_handler -->|"handles actions"| node_abstract_actions
node_abstract_actions -->|"selects exploit"| node_concrete_actions
node_abstract_actions -->|"executes on"| node_state
node_green_action -->|"executes on"| node_state
node_controller -->|"updates"| node_state
node_state -->|"manages"| node_host
node_state -->|"tracks"| node_session
node_controller -->|"filters state"| node_observation
node_controller -->|"calculates"| node_reward
node_wrappers -.->|"wraps"| node_env
node_evaluation -->|"evaluates"| node_env

click node_env "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/env.py"
click node_controller "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/SimulationController.py"
click node_scenario_gen "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py"
click node_scenario "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/Scenario.py"
click node_agent_impl "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Agents/SimpleAgents/FiniteStateRedAgent.py"
click node_green_agent "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Agents/SimpleAgents/EnterpriseGreenAgent.py"
click node_wrappers "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Agents/Wrappers/BlueFixedActionWrapper.py"
click node_action_handler "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/ActionHandler.py"
click node_abstract_actions "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py"
click node_concrete_actions "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/ConcreteActions/ExploitActions/ExploitAction.py"
click node_green_action "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/GreenActions/GreenAccessService.py"
click node_state "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/State.py"
click node_host "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Host.py"
click node_session "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/Session.py"
click node_observation "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/Observation.py"
click node_reward "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/RewardCalculator.py"
click node_evaluation "https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Evaluation/evaluation.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_env,node_evaluation toneBlue
class node_scenario_gen,node_scenario,node_agent_impl,node_green_agent,node_wrappers toneAmber
class node_controller,node_action_handler,node_abstract_actions,node_concrete_actions,node_green_action toneMint
class node_state,node_host,node_session,node_observation,node_reward toneRose
class node_user toneIndigo
```

## Components

### Environment API

- [Gym environment](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/env.py): `CybORG/env.py`
- [Evaluation runner](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Evaluation/evaluation.py): `CybORG/Evaluation/evaluation.py`

### Scenarios and Agents

- [Enterprise scenario](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py): `CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py`
- [Scenario config](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/Scenario.py): `CybORG/Shared/Scenario.py`
- [Agent strategies](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Agents/SimpleAgents/FiniteStateRedAgent.py): `CybORG/Agents/SimpleAgents/FiniteStateRedAgent.py`
- [Green user agent](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Agents/SimpleAgents/EnterpriseGreenAgent.py): `CybORG/Agents/SimpleAgents/EnterpriseGreenAgent.py`
- [Agent wrappers](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Agents/Wrappers/BlueFixedActionWrapper.py): `CybORG/Agents/Wrappers/BlueFixedActionWrapper.py`

### Simulation Runtime

- [Turn controller](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/SimulationController.py): `CybORG/Simulator/SimulationController.py`
- [Action dispatch](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/ActionHandler.py): `CybORG/Shared/ActionHandler.py`
- [Abstract actions](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py): `CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py`
- [Concrete exploits](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/ConcreteActions/ExploitActions/ExploitAction.py): `CybORG/Simulator/Actions/ConcreteActions/ExploitActions/ExploitAction.py`
- [Green service access](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Actions/GreenActions/GreenAccessService.py): `CybORG/Simulator/Actions/GreenActions/GreenAccessService.py`

### Network Domain

- [Simulation state](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/State.py): `CybORG/Simulator/State.py`
- [Hosts and services](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Simulator/Host.py): `CybORG/Simulator/Host.py`
- [Agent sessions](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/Session.py): `CybORG/Shared/Session.py`
- [Observations](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/Observation.py): `CybORG/Shared/Observation.py`
- [Reward calculation](https://github.com/cage-challenge/cage-challenge-4/blob/main/CybORG/Shared/RewardCalculator.py): `CybORG/Shared/RewardCalculator.py`

### Other components

- **Agent developer**

## Connections

- Agent developer → Gym environment: uses
- Gym environment → Turn controller: delegates (evidence: `CybORG/env.py`)
- Turn controller → Enterprise scenario: creates scenario (evidence: `CybORG/Simulator/SimulationController.py`)
- Enterprise scenario → Scenario config: builds (evidence: `CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py`)
- Enterprise scenario → Agent strategies: assigns agents (evidence: `CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py`)
- Enterprise scenario → Green user agent: assigns agents (evidence: `CybORG/Simulator/Scenarios/EnterpriseScenarioGenerator.py`)
- Agent strategies → Abstract actions: selects actions (evidence: `CybORG/Agents/SimpleAgents/FiniteStateRedAgent.py`)
- Turn controller → Action dispatch: dispatches (evidence: `CybORG/Simulator/SimulationController.py`)
- Action dispatch → Abstract actions: handles actions (evidence: `CybORG/Shared/ActionHandler.py`)
- Abstract actions → Concrete exploits: selects exploit (evidence: `CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py`)
- Abstract actions → Simulation state: executes on (evidence: `CybORG/Simulator/Actions/AbstractActions/ExploitRemoteService.py`)
- Green service access → Simulation state: executes on (evidence: `CybORG/Simulator/Actions/GreenActions/GreenAccessService.py`)
- Turn controller → Simulation state: updates (evidence: `CybORG/Simulator/SimulationController.py`)
- Simulation state → Hosts and services: manages (evidence: `CybORG/Simulator/State.py`)
- Simulation state → Agent sessions: tracks (evidence: `CybORG/Simulator/State.py`)
- Turn controller → Observations: filters state (evidence: `CybORG/Simulator/SimulationController.py`)
- Turn controller → Reward calculation: calculates (evidence: `CybORG/Simulator/SimulationController.py`)
- Agent wrappers → Gym environment: wraps (evidence: `CybORG/Agents/Wrappers/BlueFixedActionWrapper.py`)
- Evaluation runner → Gym environment: evaluates (evidence: `CybORG/Evaluation/evaluation.py`)
