# avikengineer007/ai-threat-hunting-threat-intelligence-agent architecture

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

- Interactive diagram: https://gitdiagram.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent
- Repository: https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent

## Overview

This is an autonomous threat-intelligence agent: scheduled or one-off collection feeds vulnerability, exploited-CVE, and ransomware data into a database; CVEs are analyzed, and a daily report is generated. The separate conversational CLI queries stored intelligence and can enrich IOCs on demand. The graph preserves documented capabilities whose implementation was not sampled; their edges are documented in the README or source index, not inferred from unsampled code.

Main entry points: [`scheduler/jobs.py`](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/scheduler/jobs.py) (Scheduler), [`database/connection.py`](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/database/connection.py) (SQLite Database), [`reasoning/gemini_client.py`](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/gemini_client.py) (Gemini Reasoning), [`database/models.py`](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/database/models.py) (Threat Models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Collection"]
  node_scheduler["Scheduler<br/>[jobs.py]"]
  node_base["Collector Base<br/>[base.py]"]
  node_nvd["NVD Collector<br/>[nvd_collector.py]"]
  node_cisa["CISA KEV Collector<br/>[cisa_collector.py]"]
  node_ransom["Ransomware Collector"]
end

subgraph group_data["Intelligence Data"]
  node_models["Threat Models<br/>[models.py]"]
  node_store[("SQLite Database<br/>[connection.py]")]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_analysis["Analysis &amp; Reports"]
  node_agent["Conversation Agent<br/>[agent.py]"]
  node_tools["Reasoning Tools<br/>[tools.py]"]
  node_gemini["Gemini Reasoning<br/>[gemini_client.py]"]
  node_enrichers["IOC Enrichers<br/>[enrichers.py]"]
  node_report["Report Generator"]
end

subgraph group_interaction["User Interface"]
  node_cli["Conversational CLI<br/>[cli.py]"]
  node_main["Daemon Entry<br/>[main.py]"]
end

node_nvd_api{{"NVD API"}}
node_kev_feed{{"CISA KEV Feed"}}
node_gemini_service{{"Google Gemini"}}
node_virustotal{{"VirusTotal API"}}
node_shodan{{"Shodan API"}}
node_user(("Analyst"))

node_main -->|"initializes schema"| node_store
node_main -->|"runs job; starts"| node_scheduler
node_scheduler -->|"runs collector"| node_nvd
node_scheduler -->|"runs collector"| node_cisa
node_scheduler -->|"runs collector"| node_ransom
node_nvd -->|"fetches CVEs"| node_nvd_api
node_cisa -->|"collects KEV entries"| node_kev_feed
node_nvd -->|"creates or updates"| node_models
node_cisa -->|"updates CVE records"| node_models
node_ransom -->|"saves activity"| node_models
node_scheduler -->|"queries and enriches CVEs"| node_models
node_scheduler -->|"analyzes CVEs"| node_gemini
node_scheduler -->|"generates report"| node_report
node_store -->|"creates schema"| node_models
node_report -->|"queries and saves report"| node_store
node_report -->|"requests overview"| node_gemini
node_gemini -->|"generates analysis"| node_gemini_service
node_user -->|"asks questions"| node_cli
node_cli -->|"submits queries"| node_agent
node_agent -->|"uses tools"| node_tools
node_tools -->|"queries and saves"| node_store
node_tools -->|"enriches IOC"| node_enrichers
node_tools -->|"classifies IOC"| node_gemini
node_enrichers -->|"checks reputation"| node_virustotal
node_enrichers -->|"looks up host"| node_shodan
node_nvd -->|"inherits collection behavior"| node_base
node_cisa -->|"inherits collection behavior"| node_base
node_ransom -->|"inherits collection behavior"| node_base
node_scheduler -->|"reads interval"| node_config
node_store -->|"reads database URL"| node_config
node_gemini -->|"reads API key"| node_config

click node_scheduler "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/scheduler/jobs.py"
click node_base "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/base.py"
click node_nvd "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/nvd_collector.py"
click node_cisa "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/cisa_collector.py"
click node_ransom "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/ransomware_collector.py"
click node_models "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/database/models.py"
click node_store "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/database/connection.py"
click node_agent "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/agent.py"
click node_tools "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/tools.py"
click node_gemini "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/gemini_client.py"
click node_enrichers "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/enrichers.py"
click node_report "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reporting/report_generator.py"
click node_cli "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/cli.py"
click node_main "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/main.py"
click node_config "https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/config.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_scheduler,node_base,node_nvd,node_cisa,node_ransom toneBlue
class node_models,node_store,node_config toneAmber
class node_agent,node_tools,node_gemini,node_enrichers,node_report,node_nvd_api,node_virustotal,node_shodan toneMint
class node_cli,node_main toneRose
class node_kev_feed,node_gemini_service,node_user toneIndigo
```

## Components

### Collection

- [Scheduler](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/scheduler/jobs.py): `scheduler/jobs.py`
- [Collector Base](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/base.py): `collectors/base.py`
- [NVD Collector](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/nvd_collector.py): `collectors/nvd_collector.py`
- [CISA KEV Collector](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/cisa_collector.py): `collectors/cisa_collector.py`
- [Ransomware Collector](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/ransomware_collector.py): `collectors/ransomware_collector.py`

### Intelligence Data

- [Threat Models](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/database/models.py): `database/models.py`
- [SQLite Database](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/database/connection.py): `database/connection.py`
- [Configuration](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/config.py): `config.py`

### Analysis & Reports

- [Conversation Agent](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/agent.py): `reasoning/agent.py`
- [Reasoning Tools](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/tools.py): `reasoning/tools.py`
- [Gemini Reasoning](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reasoning/gemini_client.py): `reasoning/gemini_client.py`
- [IOC Enrichers](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/collectors/enrichers.py): `collectors/enrichers.py`
- [Report Generator](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/reporting/report_generator.py): `reporting/report_generator.py`

### User Interface

- [Conversational CLI](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/cli.py): `cli.py`
- [Daemon Entry](https://github.com/avikengineer007/ai-threat-hunting-threat-intelligence-agent/blob/main/main.py): `main.py`

### Other components

- **NVD API**
- **CISA KEV Feed**
- **Google Gemini**
- **VirusTotal API**
- **Shodan API**
- **Analyst**

## Connections

- Daemon Entry → SQLite Database: initializes schema (evidence: `main.py`)
- Daemon Entry → Scheduler: runs job; starts (evidence: `main.py`)
- Scheduler → NVD Collector: runs collector (evidence: `scheduler/jobs.py`)
- Scheduler → CISA KEV Collector: runs collector (evidence: `scheduler/jobs.py`)
- Scheduler → Ransomware Collector: runs collector (evidence: `scheduler/jobs.py`)
- NVD Collector → NVD API: fetches CVEs (evidence: `collectors/nvd_collector.py`)
- CISA KEV Collector → CISA KEV Feed: collects KEV entries (evidence: `README.md`)
- NVD Collector → Threat Models: creates or updates (evidence: `collectors/nvd_collector.py`)
- CISA KEV Collector → Threat Models: updates CVE records (evidence: `collectors/cisa_collector.py`)
- Ransomware Collector → Threat Models: saves activity (evidence: `collectors/ransomware_collector.py`)
- Scheduler → Threat Models: queries and enriches CVEs (evidence: `scheduler/jobs.py`)
- Scheduler → Gemini Reasoning: analyzes CVEs (evidence: `scheduler/jobs.py`)
- Scheduler → Report Generator: generates report (evidence: `scheduler/jobs.py`)
- SQLite Database → Threat Models: creates schema (evidence: `database/connection.py`)
- Report Generator → SQLite Database: queries and saves report (evidence: `reporting/report_generator.py`)
- Report Generator → Gemini Reasoning: requests overview (evidence: `reporting/report_generator.py`)
- Gemini Reasoning → Google Gemini: generates analysis (evidence: `reasoning/gemini_client.py`)
- Analyst → Conversational CLI: asks questions (evidence: `README.md`)
- Conversational CLI → Conversation Agent: submits queries (evidence: `cli.py`)
- Conversation Agent → Reasoning Tools: uses tools (evidence: `reasoning/agent.py`)
- Reasoning Tools → SQLite Database: queries and saves (evidence: `reasoning/tools.py`)
- Reasoning Tools → IOC Enrichers: enriches IOC (evidence: `reasoning/tools.py`)
- Reasoning Tools → Gemini Reasoning: classifies IOC (evidence: `reasoning/tools.py`)
- IOC Enrichers → VirusTotal API: checks reputation (evidence: `collectors/enrichers.py`)
- IOC Enrichers → Shodan API: looks up host (evidence: `collectors/enrichers.py`)
- NVD Collector → Collector Base: inherits collection behavior (evidence: `collectors/nvd_collector.py`)
- CISA KEV Collector → Collector Base: inherits collection behavior (evidence: `collectors/cisa_collector.py`)
- Ransomware Collector → Collector Base: inherits collection behavior (evidence: `collectors/ransomware_collector.py`)
- Scheduler → Configuration: reads interval (evidence: `scheduler/jobs.py`)
- SQLite Database → Configuration: reads database URL (evidence: `database/connection.py`)
- Gemini Reasoning → Configuration: reads API key (evidence: `reasoning/gemini_client.py`)
