# sahva16/agentshield architecture

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

- Interactive diagram: https://gitdiagram.com/sahva16/agentshield
- Repository: https://github.com/sahva16/agentshield

## Overview

AgentShield AI is an educational endpoint-security simulator. Running `main.py` randomly selects one endpoint category, collects simulated data, applies the corresponding threat check, and then analyzes the activity log for counts, risk, and behavior scores. The dashboard file is empty; the README's interactive dashboard and live monitoring items are future improvements, not implemented capabilities. Relationships shown here are supported by the sampled source and README; the analyzer reads the log, but the current run does not log ordinary inspection checks.

Main entry points: [`main.py`](https://github.com/sahva16/agentshield/blob/main/main.py) (Run Orchestrator), [`logger.py`](https://github.com/sahva16/agentshield/blob/main/logger.py) (Event Logger), [`detector.py`](https://github.com/sahva16/agentshield/blob/main/detector.py) (Threat Rules), [`analyzer.py`](https://github.com/sahva16/agentshield/blob/main/analyzer.py) (Risk Analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inspection["Endpoint Inspection"]
  node_agent["Action Selector<br/>[agent.py]"]
  node_endpoint["Simulated Endpoint<br/>[endpoint.py]"]
end

subgraph group_detection["Threat Detection"]
  node_detector["Threat Rules<br/>[detector.py]"]
end

subgraph group_analytics["Security Analytics"]
  node_analyzer["Risk Analytics<br/>[analyzer.py]"]
end

subgraph group_eventlog["Event Logging"]
  node_logger["Event Logger<br/>[logger.py]"]
  node_activity[("Activity Log")]
end

node_user(("Operator"))
node_runner["Run Orchestrator<br/>[main.py]"]

node_user -->|"runs"| node_runner
node_runner -->|"chooses action"| node_agent
node_runner -->|"logs choice"| node_logger
node_runner -->|"requests metrics"| node_endpoint
node_runner -->|"checks metrics"| node_detector
node_detector -->|"logs alerts"| node_logger
node_logger -->|"appends events"| node_activity
node_runner -->|"runs analysis"| node_analyzer
node_analyzer -->|"reads events"| node_activity

click node_runner "https://github.com/sahva16/agentshield/blob/main/main.py"
click node_agent "https://github.com/sahva16/agentshield/blob/main/agent.py"
click node_endpoint "https://github.com/sahva16/agentshield/blob/main/endpoint.py"
click node_detector "https://github.com/sahva16/agentshield/blob/main/detector.py"
click node_logger "https://github.com/sahva16/agentshield/blob/main/logger.py"
click node_analyzer "https://github.com/sahva16/agentshield/blob/main/analyzer.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_agent,node_endpoint toneBlue
class node_detector toneAmber
class node_analyzer toneMint
class node_logger,node_activity toneRose
class node_user toneIndigo
class node_runner toneTeal
```

## Components

### Endpoint Inspection

- [Action Selector](https://github.com/sahva16/agentshield/blob/main/agent.py): `agent.py`
- [Simulated Endpoint](https://github.com/sahva16/agentshield/blob/main/endpoint.py): `endpoint.py`

### Threat Detection

- [Threat Rules](https://github.com/sahva16/agentshield/blob/main/detector.py): `detector.py`

### Security Analytics

- [Risk Analytics](https://github.com/sahva16/agentshield/blob/main/analyzer.py): `analyzer.py`

### Event Logging

- [Event Logger](https://github.com/sahva16/agentshield/blob/main/logger.py): `logger.py`
- **Activity Log**

### Other components

- **Operator**
- [Run Orchestrator](https://github.com/sahva16/agentshield/blob/main/main.py): `main.py`

## Connections

- Operator → Run Orchestrator: runs (evidence: `README.md`)
- Run Orchestrator → Action Selector: chooses action (evidence: `main.py`)
- Run Orchestrator → Event Logger: logs choice (evidence: `main.py`)
- Run Orchestrator → Simulated Endpoint: requests metrics (evidence: `main.py`)
- Run Orchestrator → Threat Rules: checks metrics (evidence: `main.py`)
- Threat Rules → Event Logger: logs alerts (evidence: `detector.py`)
- Event Logger → Activity Log: appends events (evidence: `logger.py`)
- Run Orchestrator → Risk Analytics: runs analysis (evidence: `main.py`)
- Risk Analytics → Activity Log: reads events (evidence: `analyzer.py`)
