# punithcse/opspilot-ai architecture

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

- Interactive diagram: https://gitdiagram.com/punithcse/opspilot-ai
- Repository: https://github.com/punithcse/opspilot-ai

## Overview

OpsPilot AI is a Streamlit incident-analysis suite: an engineer uploads logs, then a LangGraph workflow redacts and analyzes them, prepares evidence-backed remediation and drafts, and pauses for human approval before external actions. The README documents the main workflow and product capabilities; source excerpts and the SOURCE INDEX support the principal module links. Some UI and dispatch details are documented rather than fully visible in the excerpts.

Main entry points: [`orchestration/graph.py`](https://github.com/punithcse/opspilot-ai/blob/main/orchestration/graph.py) (Workflow graph), [`app.py`](https://github.com/punithcse/opspilot-ai/blob/main/app.py) (Streamlit app), [`llm/client.py`](https://github.com/punithcse/opspilot-ai/blob/main/llm/client.py) (LLM client), [`agents/log_agent.py`](https://github.com/punithcse/opspilot-ai/blob/main/agents/log_agent.py) (Log intelligence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Incident workflow"]
  node_graph["Workflow graph<br/>[graph.py]"]
  node_state["Incident state<br/>[state.py]"]
  node_redactor["Security redaction<br/>[redactor.py]"]
  node_log_agent["Log intelligence<br/>[log_agent.py]"]
  node_parser["Log parser<br/>[log_parser.py]"]
  node_classifier["Event classification<br/>[classifier.py]"]
  node_root_agent["Root cause"]
  node_remediation["Remediation agent"]
  node_cookbook["Cookbook agent<br/>[cookbook_agent.py]"]
  node_jira_agent["Jira draft agent<br/>[jira_agent.py]"]
  node_notification_agent["Slack draft agent"]
  node_approval{{"Human approval<br/>[graph.py]"}}
end

subgraph group_knowledge["Analysis and knowledge"]
  node_knowledge_agent["Knowledge agent<br/>[knowledge_agent.py]"]
  node_retriever["Runbook retrieval<br/>[retriever.py]"]
  node_rag_ingestion["Runbook indexing<br/>[ingestion.py]"]
  node_embeddings["Local embeddings<br/>[embeddings.py]"]
  node_playbook["Fallback playbook<br/>[playbook.py]"]
end

subgraph group_platform["Runtime services"]
  node_config["Configuration<br/>[config.py]"]
  node_jira_integration["Jira integration<br/>[jira.py]"]
  node_slack_integration["Slack integration<br/>[slack.py]"]
  node_llm["LLM client<br/>[client.py]"]
  node_agent_base["Agent tracing<br/>[base.py]"]
  node_history[("SQLite history and cache<br/>[history.py]")]
end

subgraph group_experience["User experience"]
  node_app["Streamlit app<br/>[app.py]"]
  node_ui_components["UI components<br/>[components.py]"]
  node_ui_theme["UI theme<br/>[theme.py]"]
  node_report["Report export<br/>[report.py]"]
end

node_engineer(("On-call engineer"))
node_jira_service["Jira service"]
node_slack_service["Slack webhook"]

node_engineer -->|"uploads logs"| node_app
node_app -->|"renders interface"| node_ui_components
node_app -->|"uses theme"| node_ui_theme
node_app -->|"starts analysis"| node_graph
node_app -->|"exports report"| node_report
node_graph -->|"redacts input"| node_redactor
node_graph -->|"runs triage"| node_log_agent
node_graph -->|"runs diagnosis"| node_root_agent
node_graph -->|"runs retrieval"| node_knowledge_agent
node_graph -->|"runs fixes"| node_remediation
node_graph -->|"runs checklist"| node_cookbook
node_graph -->|"drafts ticket"| node_jira_agent
node_graph -->|"drafts alert"| node_notification_agent
node_graph -->|"pauses for approval"| node_approval
node_approval -->|"resumes workflow"| node_graph
node_graph -->|"shares incident data"| node_state
node_log_agent -->|"parses logs"| node_parser
node_log_agent -->|"summarizes events"| node_classifier
node_classifier -->|"uses parsed entries"| node_parser
node_root_agent -->|"uses event summary"| node_classifier
node_root_agent -->|"uses fallback knowledge"| node_playbook
node_knowledge_agent -->|"searches runbooks"| node_retriever
node_knowledge_agent -->|"reads incident memory"| node_history
node_retriever -->|"builds stale index"| node_rag_ingestion
node_rag_ingestion -->|"creates embeddings"| node_embeddings
node_remediation -->|"uses fallback guidance"| node_playbook
node_jira_agent -->|"creates approved ticket"| node_jira_integration
node_notification_agent -->|"sends approved alert"| node_slack_integration
node_jira_integration -.->|"calls Jira API"| node_jira_service
node_slack_integration -.->|"posts webhook"| node_slack_service
node_log_agent -->|"requests analysis"| node_llm
node_root_agent -->|"requests reasoning"| node_llm
node_remediation -->|"requests fixes"| node_llm
node_cookbook -->|"requests checklist"| node_llm
node_llm -->|"reads and writes cache"| node_history
node_agent_base -->|"records usage"| node_llm
node_graph -->|"saves incident"| node_history
node_app -->|"loads settings"| node_config

click node_app "https://github.com/punithcse/opspilot-ai/blob/main/app.py"
click node_ui_components "https://github.com/punithcse/opspilot-ai/blob/main/ui/components.py"
click node_ui_theme "https://github.com/punithcse/opspilot-ai/blob/main/ui/theme.py"
click node_report "https://github.com/punithcse/opspilot-ai/blob/main/ui/report.py"
click node_config "https://github.com/punithcse/opspilot-ai/blob/main/config.py"
click node_graph "https://github.com/punithcse/opspilot-ai/blob/main/orchestration/graph.py"
click node_state "https://github.com/punithcse/opspilot-ai/blob/main/orchestration/state.py"
click node_redactor "https://github.com/punithcse/opspilot-ai/blob/main/security/redactor.py"
click node_log_agent "https://github.com/punithcse/opspilot-ai/blob/main/agents/log_agent.py"
click node_parser "https://github.com/punithcse/opspilot-ai/blob/main/ingestion/log_parser.py"
click node_classifier "https://github.com/punithcse/opspilot-ai/blob/main/ingestion/classifier.py"
click node_root_agent "https://github.com/punithcse/opspilot-ai/blob/main/agents/root_cause_agent.py"
click node_knowledge_agent "https://github.com/punithcse/opspilot-ai/blob/main/agents/knowledge_agent.py"
click node_retriever "https://github.com/punithcse/opspilot-ai/blob/main/rag/retriever.py"
click node_rag_ingestion "https://github.com/punithcse/opspilot-ai/blob/main/rag/ingestion.py"
click node_embeddings "https://github.com/punithcse/opspilot-ai/blob/main/rag/embeddings.py"
click node_playbook "https://github.com/punithcse/opspilot-ai/blob/main/agents/playbook.py"
click node_remediation "https://github.com/punithcse/opspilot-ai/blob/main/agents/remediation_agent.py"
click node_cookbook "https://github.com/punithcse/opspilot-ai/blob/main/agents/cookbook_agent.py"
click node_jira_agent "https://github.com/punithcse/opspilot-ai/blob/main/agents/jira_agent.py"
click node_notification_agent "https://github.com/punithcse/opspilot-ai/blob/main/agents/notification_agent.py"
click node_approval "https://github.com/punithcse/opspilot-ai/blob/main/orchestration/graph.py"
click node_jira_integration "https://github.com/punithcse/opspilot-ai/blob/main/integrations/jira.py"
click node_slack_integration "https://github.com/punithcse/opspilot-ai/blob/main/integrations/slack.py"
click node_llm "https://github.com/punithcse/opspilot-ai/blob/main/llm/client.py"
click node_agent_base "https://github.com/punithcse/opspilot-ai/blob/main/agents/base.py"
click node_history "https://github.com/punithcse/opspilot-ai/blob/main/storage/history.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_graph,node_state,node_redactor,node_log_agent,node_parser,node_classifier,node_root_agent,node_remediation,node_cookbook,node_jira_agent,node_notification_agent,node_approval toneBlue
class node_knowledge_agent,node_retriever,node_rag_ingestion,node_embeddings,node_playbook toneAmber
class node_config,node_jira_integration,node_slack_integration,node_llm,node_agent_base,node_history,node_slack_service toneMint
class node_app,node_ui_components,node_ui_theme,node_report toneRose
class node_engineer,node_jira_service toneIndigo
```

## Components

### Incident workflow

- [Workflow graph](https://github.com/punithcse/opspilot-ai/blob/main/orchestration/graph.py): `orchestration/graph.py`
- [Incident state](https://github.com/punithcse/opspilot-ai/blob/main/orchestration/state.py): `orchestration/state.py`
- [Security redaction](https://github.com/punithcse/opspilot-ai/blob/main/security/redactor.py): `security/redactor.py`
- [Log intelligence](https://github.com/punithcse/opspilot-ai/blob/main/agents/log_agent.py): `agents/log_agent.py`
- [Log parser](https://github.com/punithcse/opspilot-ai/blob/main/ingestion/log_parser.py): `ingestion/log_parser.py`
- [Event classification](https://github.com/punithcse/opspilot-ai/blob/main/ingestion/classifier.py): `ingestion/classifier.py`
- [Root cause](https://github.com/punithcse/opspilot-ai/blob/main/agents/root_cause_agent.py): `agents/root_cause_agent.py`
- [Remediation agent](https://github.com/punithcse/opspilot-ai/blob/main/agents/remediation_agent.py): `agents/remediation_agent.py`
- [Cookbook agent](https://github.com/punithcse/opspilot-ai/blob/main/agents/cookbook_agent.py): `agents/cookbook_agent.py`
- [Jira draft agent](https://github.com/punithcse/opspilot-ai/blob/main/agents/jira_agent.py): `agents/jira_agent.py`
- [Slack draft agent](https://github.com/punithcse/opspilot-ai/blob/main/agents/notification_agent.py): `agents/notification_agent.py`
- [Human approval](https://github.com/punithcse/opspilot-ai/blob/main/orchestration/graph.py): `orchestration/graph.py`

### Analysis and knowledge

- [Knowledge agent](https://github.com/punithcse/opspilot-ai/blob/main/agents/knowledge_agent.py): `agents/knowledge_agent.py`
- [Runbook retrieval](https://github.com/punithcse/opspilot-ai/blob/main/rag/retriever.py): `rag/retriever.py`
- [Runbook indexing](https://github.com/punithcse/opspilot-ai/blob/main/rag/ingestion.py): `rag/ingestion.py`
- [Local embeddings](https://github.com/punithcse/opspilot-ai/blob/main/rag/embeddings.py): `rag/embeddings.py`
- [Fallback playbook](https://github.com/punithcse/opspilot-ai/blob/main/agents/playbook.py): `agents/playbook.py`

### Runtime services

- [Configuration](https://github.com/punithcse/opspilot-ai/blob/main/config.py): `config.py`
- [Jira integration](https://github.com/punithcse/opspilot-ai/blob/main/integrations/jira.py): `integrations/jira.py`
- [Slack integration](https://github.com/punithcse/opspilot-ai/blob/main/integrations/slack.py): `integrations/slack.py`
- [LLM client](https://github.com/punithcse/opspilot-ai/blob/main/llm/client.py): `llm/client.py`
- [Agent tracing](https://github.com/punithcse/opspilot-ai/blob/main/agents/base.py): `agents/base.py`
- [SQLite history and cache](https://github.com/punithcse/opspilot-ai/blob/main/storage/history.py): `storage/history.py`

### User experience

- [Streamlit app](https://github.com/punithcse/opspilot-ai/blob/main/app.py): `app.py`
- [UI components](https://github.com/punithcse/opspilot-ai/blob/main/ui/components.py): `ui/components.py`
- [UI theme](https://github.com/punithcse/opspilot-ai/blob/main/ui/theme.py): `ui/theme.py`
- [Report export](https://github.com/punithcse/opspilot-ai/blob/main/ui/report.py): `ui/report.py`

### Other components

- **On-call engineer**
- **Jira service**
- **Slack webhook**

## Connections

- On-call engineer → Streamlit app: uploads logs
- Streamlit app → UI components: renders interface (evidence: `app.py`)
- Streamlit app → UI theme: uses theme (evidence: `app.py`)
- Streamlit app → Workflow graph: starts analysis (evidence: `app.py`)
- Streamlit app → Report export: exports report (evidence: `app.py`)
- Workflow graph → Security redaction: redacts input (evidence: `orchestration/graph.py`)
- Workflow graph → Log intelligence: runs triage (evidence: `orchestration/graph.py`)
- Workflow graph → Root cause: runs diagnosis (evidence: `orchestration/graph.py`)
- Workflow graph → Knowledge agent: runs retrieval (evidence: `orchestration/graph.py`)
- Workflow graph → Remediation agent: runs fixes (evidence: `orchestration/graph.py`)
- Workflow graph → Cookbook agent: runs checklist (evidence: `orchestration/graph.py`)
- Workflow graph → Jira draft agent: drafts ticket (evidence: `orchestration/graph.py`)
- Workflow graph → Slack draft agent: drafts alert (evidence: `orchestration/graph.py`)
- Workflow graph → Human approval: pauses for approval (evidence: `orchestration/graph.py`)
- Human approval → Workflow graph: resumes workflow (evidence: `orchestration/graph.py`)
- Workflow graph → Incident state: shares incident data (evidence: `orchestration/graph.py`)
- Log intelligence → Log parser: parses logs (evidence: `agents/log_agent.py`)
- Log intelligence → Event classification: summarizes events (evidence: `agents/log_agent.py`)
- Event classification → Log parser: uses parsed entries (evidence: `ingestion/classifier.py`)
- Root cause → Event classification: uses event summary (evidence: `agents/root_cause_agent.py`)
- Root cause → Fallback playbook: uses fallback knowledge (evidence: `agents/root_cause_agent.py`)
- Knowledge agent → Runbook retrieval: searches runbooks (evidence: `agents/knowledge_agent.py`)
- Knowledge agent → SQLite history and cache: reads incident memory (evidence: `agents/knowledge_agent.py`)
- Runbook retrieval → Runbook indexing: builds stale index (evidence: `rag/retriever.py`)
- Runbook indexing → Local embeddings: creates embeddings (evidence: `rag/ingestion.py`)
- Remediation agent → Fallback playbook: uses fallback guidance (evidence: `agents/remediation_agent.py`)
- Jira draft agent → Jira integration: creates approved ticket (evidence: `agents/jira_agent.py`)
- Slack draft agent → Slack integration: sends approved alert (evidence: `agents/notification_agent.py`)
- Jira integration → Jira service: calls Jira API
- Slack integration → Slack webhook: posts webhook
- Log intelligence → LLM client: requests analysis (evidence: `agents/log_agent.py`)
- Root cause → LLM client: requests reasoning (evidence: `agents/root_cause_agent.py`)
- Remediation agent → LLM client: requests fixes (evidence: `agents/remediation_agent.py`)
- Cookbook agent → LLM client: requests checklist (evidence: `agents/cookbook_agent.py`)
- LLM client → SQLite history and cache: reads and writes cache (evidence: `llm/client.py`)
- Agent tracing → LLM client: records usage (evidence: `agents/base.py`)
- Workflow graph → SQLite history and cache: saves incident (evidence: `orchestration/graph.py`)
- Streamlit app → Configuration: loads settings (evidence: `app.py`)
