# aishwaryamy/ai-incident-response-agent architecture

> Architecture diagram of the GitHub repository aishwaryamy/ai-incident-response-agent, 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/aishwaryamy/ai-incident-response-agent
- Repository: https://github.com/aishwaryamy/ai-incident-response-agent

## Overview

This is an incident-response copilot API: an engineer submits incident details or logs, and the chat endpoint invokes a LangGraph agent to produce troubleshooting guidance. The agent uses an LLM, tools, and session-linked memory; authentication and session management support ongoing conversations. The README also describes RAG ingestion and retrieval, monitoring, and evaluation. The tree does not show an ingestion implementation, so that capability is represented only where the sampled agent supports retrieval and memory. Some subsystem links rely on README statements or SOURCE INDEX references rather than full source excerpts.

Main entry points: [`app/core/langgraph/graph.py`](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/langgraph/graph.py) (LangGraph workflow), [`app/main.py`](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/main.py) (FastAPI application), [`app/services/database.py`](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/services/database.py) (Database service), [`app/api/v1/api.py`](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/api.py) (API routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_api_routes["API routing<br/>[api.py]"]
  node_auth["Authentication and sessions<br/>[auth.py]"]
  node_chat["Chat endpoints<br/>[chatbot.py]"]
  node_auth_schemas["Auth schemas<br/>[auth.py]"]
  node_chat_schemas["Chat schemas<br/>[chat.py]"]
end

subgraph group_agent["Agent and reasoning"]
  node_agent_graph["LangGraph workflow<br/>[graph.py]"]
  node_prompts["Agent prompts"]
  node_search_tool["Web search tool"]
  node_llm_service["LLM service<br/>[llm.py]"]
end

subgraph group_persistence["Persistence and memory"]
  node_db_service["Database service<br/>[database.py]"]
  node_models["User and session models<br/>[user.py]"]
  node_pgvector[("PostgreSQL and pgvector")]
end

subgraph group_operations["Operations and evaluation"]
  node_config["Application settings<br/>[config.py]"]
  node_logging["Structured logging<br/>[logging.py]"]
  node_metrics["Prometheus metrics<br/>[metrics.py]"]
  node_grafana["Grafana dashboards"]
  node_evaluator["Agent evaluation<br/>[evaluator.py]"]
  node_eval_schemas["Evaluation schemas<br/>[schemas.py]"]
end

node_engineer(("Engineer"))
node_openai{{"OpenAI models"}}

node_engineer -->|"sends request"| node_api_app
node_api_app -->|"routes requests"| node_api_routes
node_api_routes -->|"registers routes"| node_auth
node_api_routes -->|"registers routes"| node_chat
node_auth -->|"reads and writes"| node_db_service
node_auth -->|"validates data"| node_auth_schemas
node_chat -->|"invokes agent"| node_agent_graph
node_chat -->|"validates data"| node_chat_schemas
node_agent_graph -->|"requests inference"| node_llm_service
node_agent_graph -->|"dispatches tools"| node_search_tool
node_agent_graph -->|"loads prompts"| node_prompts
node_llm_service -->|"calls models"| node_openai
node_agent_graph -->|"stores memory"| node_pgvector
node_db_service -->|"persists records"| node_models
node_db_service -.->|"uses database"| node_pgvector
node_api_app -->|"checks health"| node_db_service
node_api_app -->|"sets up metrics"| node_metrics
node_api_app -->|"configures middleware"| node_logging
node_grafana -.->|"visualizes metrics"| node_metrics
node_evaluator -->|"uses schemas"| node_eval_schemas
node_evaluator -.->|"evaluates responses"| node_agent_graph

click node_api_app "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/main.py"
click node_api_routes "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/api.py"
click node_auth "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/auth.py"
click node_chat "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/chatbot.py"
click node_auth_schemas "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/schemas/auth.py"
click node_chat_schemas "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/schemas/chat.py"
click node_agent_graph "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/langgraph/graph.py"
click node_prompts "https://github.com/aishwaryamy/ai-incident-response-agent/tree/main/app/core/prompts"
click node_search_tool "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/langgraph/tools/duckduckgo_search.py"
click node_llm_service "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/services/llm.py"
click node_db_service "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/services/database.py"
click node_models "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/models/user.py"
click node_config "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/config.py"
click node_logging "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/logging.py"
click node_metrics "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/metrics.py"
click node_grafana "https://github.com/aishwaryamy/ai-incident-response-agent/tree/main/grafana/dashboards/json"
click node_evaluator "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/evals/evaluator.py"
click node_eval_schemas "https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/evals/schemas.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_api_app,node_api_routes,node_auth,node_chat,node_auth_schemas,node_chat_schemas toneBlue
class node_agent_graph,node_prompts,node_search_tool,node_llm_service toneAmber
class node_db_service,node_models,node_pgvector toneMint
class node_config,node_logging,node_metrics,node_grafana,node_evaluator,node_eval_schemas toneRose
class node_engineer,node_openai toneIndigo
```

## Components

### API and identity

- [FastAPI application](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/main.py): `app/main.py`
- [API routing](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/api.py): `app/api/v1/api.py`
- [Authentication and sessions](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/auth.py): `app/api/v1/auth.py`
- [Chat endpoints](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/api/v1/chatbot.py): `app/api/v1/chatbot.py`
- [Auth schemas](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/schemas/auth.py): `app/schemas/auth.py`
- [Chat schemas](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/schemas/chat.py): `app/schemas/chat.py`

### Agent and reasoning

- [LangGraph workflow](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/langgraph/graph.py): `app/core/langgraph/graph.py`
- [Agent prompts](https://github.com/aishwaryamy/ai-incident-response-agent/tree/main/app/core/prompts): `app/core/prompts`
- [Web search tool](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/langgraph/tools/duckduckgo_search.py): `app/core/langgraph/tools/duckduckgo_search.py`
- [LLM service](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/services/llm.py): `app/services/llm.py`

### Persistence and memory

- [Database service](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/services/database.py): `app/services/database.py`
- [User and session models](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/models/user.py): `app/models/user.py`
- **PostgreSQL and pgvector**

### Operations and evaluation

- [Application settings](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/config.py): `app/core/config.py`
- [Structured logging](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/logging.py): `app/core/logging.py`
- [Prometheus metrics](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/app/core/metrics.py): `app/core/metrics.py`
- [Grafana dashboards](https://github.com/aishwaryamy/ai-incident-response-agent/tree/main/grafana/dashboards/json): `grafana/dashboards/json`
- [Agent evaluation](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/evals/evaluator.py): `evals/evaluator.py`
- [Evaluation schemas](https://github.com/aishwaryamy/ai-incident-response-agent/blob/main/evals/schemas.py): `evals/schemas.py`

### Other components

- **Engineer**
- **OpenAI models**

## Connections

- Engineer → FastAPI application: sends request (evidence: `README.md`)
- FastAPI application → API routing: routes requests (evidence: `app/main.py`)
- API routing → Authentication and sessions: registers routes (evidence: `app/api/v1/api.py`)
- API routing → Chat endpoints: registers routes (evidence: `app/api/v1/api.py`)
- Authentication and sessions → Database service: reads and writes (evidence: `app/api/v1/auth.py`)
- Authentication and sessions → Auth schemas: validates data (evidence: `app/api/v1/auth.py`)
- Chat endpoints → LangGraph workflow: invokes agent (evidence: `app/api/v1/chatbot.py`)
- Chat endpoints → Chat schemas: validates data (evidence: `app/api/v1/chatbot.py`)
- LangGraph workflow → LLM service: requests inference (evidence: `app/core/langgraph/graph.py`)
- LangGraph workflow → Web search tool: dispatches tools (evidence: `app/core/langgraph/graph.py`)
- LangGraph workflow → Agent prompts: loads prompts (evidence: `app/core/langgraph/graph.py`)
- LLM service → OpenAI models: calls models (evidence: `README.md`)
- LangGraph workflow → PostgreSQL and pgvector: stores memory (evidence: `app/core/langgraph/graph.py`)
- Database service → User and session models: persists records (evidence: `app/services/database.py`)
- Database service → PostgreSQL and pgvector: uses database (evidence: `README.md`)
- FastAPI application → Database service: checks health (evidence: `app/main.py`)
- FastAPI application → Prometheus metrics: sets up metrics (evidence: `app/main.py`)
- FastAPI application → Structured logging: configures middleware (evidence: `app/main.py`)
- Grafana dashboards → Prometheus metrics: visualizes metrics (evidence: `README.md`)
- Agent evaluation → Evaluation schemas: uses schemas (evidence: `evals/evaluator.py`)
- Agent evaluation → LangGraph workflow: evaluates responses
