# rclalithkumar/opslens architecture

> Architecture diagram of the GitHub repository rclalithkumar/opslens, 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/rclalithkumar/opslens
- Repository: https://github.com/rclalithkumar/opslens

## Overview

OpsLens is a Streamlit incident-investigation copilot. Engineers submit an incident; the analyzer retrieves internal evidence, checks its sufficiency, optionally searches the public web, and asks an LLM to produce a grounded investigation with hypotheses, evidence gaps, diagnostic checks, and confirmation status. The UI also presents evidence and an investigation trace. The graph follows shown calls and README-described workflow; unsampled implementation details are not inferred.

Main entry points: [`utils/incident_analyzer.py`](https://github.com/rclalithkumar/opslens/blob/main/utils/incident_analyzer.py) (Incident analyzer), [`utils/retriever.py`](https://github.com/rclalithkumar/opslens/blob/main/utils/retriever.py) (Semantic retriever), [`app.py`](https://github.com/rclalithkumar/opslens/blob/main/app.py) (Streamlit investigation UI), [`utils/web_search.py`](https://github.com/rclalithkumar/opslens/blob/main/utils/web_search.py) (Web search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Investigation interface"]
  node_ui["Streamlit investigation UI<br/>[app.py]"]
end

subgraph group_investigation["Investigation reasoning"]
  node_analyzer["Incident analyzer"]
  node_sufficiency["Evidence sufficiency"]
  node_evidence["Evidence formatting<br/>[evidence.py]"]
  node_prompts["Investigation prompts<br/>[prompts.py]"]
end

subgraph group_knowledge["Internal knowledge retrieval"]
  node_retriever["Semantic retriever<br/>[retriever.py]"]
  node_loader["PDF document loader<br/>[document_loader.py]"]
  node_splitter["Text chunking<br/>[text_splitter.py]"]
  node_embeddings["Embedding model<br/>[embeddings.py]"]
  node_vectorstore[("Persistent FAISS store<br/>[vector_store.py]")]
  node_kbsetup["Knowledge-base preparation"]
end

subgraph group_integrations["External integrations"]
  node_llm["LLM client<br/>[llm.py]"]
  node_groq{{"Groq"}}
  node_websearch["Web search<br/>[web_search.py]"]
  node_ddg{{"DuckDuckGo"}}
  node_config["Search settings<br/>[config.py]"]
end

node_engineer(("Engineer"))

node_engineer -->|"submits incident"| node_ui
node_ui -->|"starts investigation"| node_analyzer
node_analyzer -->|"retrieves evidence"| node_retriever
node_retriever -->|"loads PDFs"| node_loader
node_retriever -->|"chunks text"| node_splitter
node_retriever -->|"encodes text"| node_embeddings
node_retriever -->|"searches and persists"| node_vectorstore
node_analyzer -->|"assesses evidence"| node_sufficiency
node_analyzer -->|"searches if insufficient"| node_websearch
node_websearch -->|"reads settings"| node_config
node_websearch -->|"queries"| node_ddg
node_analyzer -->|"formats evidence"| node_evidence
node_analyzer -->|"builds prompt"| node_prompts
node_analyzer -->|"requests investigation"| node_llm
node_llm -->|"sends completion"| node_groq
node_ui -->|"formats display"| node_evidence
node_kbsetup -.->|"prepares knowledge base"| node_vectorstore

click node_ui "https://github.com/rclalithkumar/opslens/blob/main/app.py"
click node_analyzer "https://github.com/rclalithkumar/opslens/blob/main/utils/incident_analyzer.py"
click node_sufficiency "https://github.com/rclalithkumar/opslens/blob/main/utils/evidence_sufficiency.py"
click node_evidence "https://github.com/rclalithkumar/opslens/blob/main/utils/evidence.py"
click node_prompts "https://github.com/rclalithkumar/opslens/blob/main/utils/prompts.py"
click node_retriever "https://github.com/rclalithkumar/opslens/blob/main/utils/retriever.py"
click node_loader "https://github.com/rclalithkumar/opslens/blob/main/utils/document_loader.py"
click node_splitter "https://github.com/rclalithkumar/opslens/blob/main/utils/text_splitter.py"
click node_embeddings "https://github.com/rclalithkumar/opslens/blob/main/models/embeddings.py"
click node_vectorstore "https://github.com/rclalithkumar/opslens/blob/main/utils/vector_store.py"
click node_kbsetup "https://github.com/rclalithkumar/opslens/blob/main/create_knowledge_base.py"
click node_llm "https://github.com/rclalithkumar/opslens/blob/main/models/llm.py"
click node_websearch "https://github.com/rclalithkumar/opslens/blob/main/utils/web_search.py"
click node_config "https://github.com/rclalithkumar/opslens/blob/main/config/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_ui toneBlue
class node_analyzer,node_sufficiency,node_evidence,node_prompts toneAmber
class node_retriever,node_loader,node_splitter,node_embeddings,node_vectorstore,node_kbsetup toneMint
class node_llm,node_groq,node_websearch,node_ddg,node_config toneRose
class node_engineer toneIndigo
```

## Components

### Investigation interface

- [Streamlit investigation UI](https://github.com/rclalithkumar/opslens/blob/main/app.py): `app.py`

### Investigation reasoning

- [Incident analyzer](https://github.com/rclalithkumar/opslens/blob/main/utils/incident_analyzer.py): `utils/incident_analyzer.py`
- [Evidence sufficiency](https://github.com/rclalithkumar/opslens/blob/main/utils/evidence_sufficiency.py): `utils/evidence_sufficiency.py`
- [Evidence formatting](https://github.com/rclalithkumar/opslens/blob/main/utils/evidence.py): `utils/evidence.py`
- [Investigation prompts](https://github.com/rclalithkumar/opslens/blob/main/utils/prompts.py): `utils/prompts.py`

### Internal knowledge retrieval

- [Semantic retriever](https://github.com/rclalithkumar/opslens/blob/main/utils/retriever.py): `utils/retriever.py`
- [PDF document loader](https://github.com/rclalithkumar/opslens/blob/main/utils/document_loader.py): `utils/document_loader.py`
- [Text chunking](https://github.com/rclalithkumar/opslens/blob/main/utils/text_splitter.py): `utils/text_splitter.py`
- [Embedding model](https://github.com/rclalithkumar/opslens/blob/main/models/embeddings.py): `models/embeddings.py`
- [Persistent FAISS store](https://github.com/rclalithkumar/opslens/blob/main/utils/vector_store.py): `utils/vector_store.py`
- [Knowledge-base preparation](https://github.com/rclalithkumar/opslens/blob/main/create_knowledge_base.py): `create_knowledge_base.py`

### External integrations

- [LLM client](https://github.com/rclalithkumar/opslens/blob/main/models/llm.py): `models/llm.py`
- **Groq**
- [Web search](https://github.com/rclalithkumar/opslens/blob/main/utils/web_search.py): `utils/web_search.py`
- **DuckDuckGo**
- [Search settings](https://github.com/rclalithkumar/opslens/blob/main/config/config.py): `config/config.py`

### Other components

- **Engineer**

## Connections

- Engineer → Streamlit investigation UI: submits incident (evidence: `README.md`)
- Streamlit investigation UI → Incident analyzer: starts investigation (evidence: `README.md`)
- Incident analyzer → Semantic retriever: retrieves evidence (evidence: `utils/incident_analyzer.py`)
- Semantic retriever → PDF document loader: loads PDFs (evidence: `utils/retriever.py`)
- Semantic retriever → Text chunking: chunks text (evidence: `utils/retriever.py`)
- Semantic retriever → Embedding model: encodes text (evidence: `utils/retriever.py`)
- Semantic retriever → Persistent FAISS store: searches and persists (evidence: `utils/retriever.py`)
- Incident analyzer → Evidence sufficiency: assesses evidence (evidence: `utils/incident_analyzer.py`)
- Incident analyzer → Web search: searches if insufficient (evidence: `utils/incident_analyzer.py`)
- Web search → Search settings: reads settings (evidence: `utils/web_search.py`)
- Web search → DuckDuckGo: queries (evidence: `utils/web_search.py`)
- Incident analyzer → Evidence formatting: formats evidence (evidence: `utils/incident_analyzer.py`)
- Incident analyzer → Investigation prompts: builds prompt (evidence: `utils/incident_analyzer.py`)
- Incident analyzer → LLM client: requests investigation (evidence: `utils/incident_analyzer.py`)
- LLM client → Groq: sends completion (evidence: `models/llm.py`)
- Streamlit investigation UI → Evidence formatting: formats display (evidence: `app.py`)
- Knowledge-base preparation → Persistent FAISS store: prepares knowledge base
