# mhdd4nish/prep_rag_agent architecture

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

- Interactive diagram: https://gitdiagram.com/mhdd4nish/prep_rag_agent
- Repository: https://github.com/mhdd4nish/prep_rag_agent

## Overview

Placement Prep Agent is an interactive interview-practice coach. The main workflow selects topics, retrieves reference material, collects and screens an answer, optionally verifies code or technical claims, then scores the answer and routes retry or topic advancement. Separate product branches provide the LLM gateway, tool-access governance, and session/evaluation reporting. Some implementation details are unsampled; edges below are limited to source-index references or explicit README and excerpt evidence.

Main entry points: [`agents/nodes.py`](https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/nodes.py) (Interview Nodes), [`evaluation/dashboard.py`](https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/dashboard.py) (Evaluation Dashboard), [`agents/graph.py`](https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/graph.py) (Session Graph), [`utils/retriever.py`](https://github.com/mhdd4nish/prep_rag_agent/blob/main/utils/retriever.py) (Hybrid Retriever)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Interview Session"]
  node_cli["Session CLI<br/>[main.py]"]
  node_workflow["Session Graph<br/>[graph.py]"]
  node_state["Session State<br/>[state.py]"]
  node_session_nodes["Interview Nodes<br/>[nodes.py]"]
  node_guardrails["Input Guardrails<br/>[checker.py]"]
end

subgraph group_knowledge["Knowledge Retrieval"]
  node_raw_docs["Interview Material<br/>[interview_qa.txt]"]
  node_ingest["Knowledge Ingestion<br/>[ingest.py]"]
  node_retriever["Hybrid Retriever<br/>[retriever.py]"]
end

subgraph group_tools["Tools and Governance"]
  node_code_client["Code MCP Client<br/>[client.py]"]
  node_code_server["Code Executor<br/>[code_executor.py]"]
  node_search_client["Search MCP Client"]
  node_search_server["Web Search<br/>[web_search.py]"]
  node_policy[("Tool Access Policy<br/>[policy.py]")]
end

subgraph group_llm["LLM Gateway"]
  node_gateway["LLM Gateway<br/>[server.py]"]
end

subgraph group_evaluation["Evaluation and Reporting"]
  node_judge["Answer Judge<br/>[judge.py]"]
  node_logger[("Session Logger<br/>[logger.py]")]
  node_calibration["Judge Calibration<br/>[calibration.py]"]
  node_training_data["Judge Data Generation"]
  node_dashboard["Evaluation Dashboard<br/>[dashboard.py]"]
end

node_candidate(("Candidate"))

node_candidate -->|"selects topics"| node_cli
node_cli -->|"invokes"| node_workflow
node_workflow -->|"uses state"| node_state
node_workflow -->|"registers and routes"| node_session_nodes
node_session_nodes -->|"retrieves context"| node_retriever
node_raw_docs -->|"provides documents"| node_ingest
node_ingest -->|"builds indexes for"| node_retriever
node_session_nodes -->|"checks answers"| node_guardrails
node_session_nodes -->|"requests execution"| node_code_client
node_code_client -->|"calls over stdio"| node_code_server
node_session_nodes -->|"requests verification"| node_search_client
node_search_client -->|"calls over stdio"| node_search_server
node_session_nodes -->|"checks tool access"| node_policy
node_session_nodes -->|"scores answers"| node_judge
node_session_nodes -->|"records turns"| node_logger
node_session_nodes -->|"routes LLM traffic"| node_gateway
node_guardrails -.->|"uses classifier LLM"| node_gateway
node_dashboard -->|"reads session results"| node_logger
node_dashboard -->|"reads access report"| node_policy
node_dashboard -->|"reads usage logs"| node_gateway
node_dashboard -->|"displays report"| node_calibration
node_training_data -->|"generates questions with"| node_retriever
node_training_data -->|"labels generated answers"| node_judge

click node_cli "https://github.com/mhdd4nish/prep_rag_agent/blob/main/main.py"
click node_workflow "https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/graph.py"
click node_state "https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/state.py"
click node_session_nodes "https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/nodes.py"
click node_guardrails "https://github.com/mhdd4nish/prep_rag_agent/blob/main/guardrails/checker.py"
click node_raw_docs "https://github.com/mhdd4nish/prep_rag_agent/blob/main/data/raw/interview_qa.txt"
click node_ingest "https://github.com/mhdd4nish/prep_rag_agent/blob/main/utils/ingest.py"
click node_retriever "https://github.com/mhdd4nish/prep_rag_agent/blob/main/utils/retriever.py"
click node_code_client "https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_client/client.py"
click node_code_server "https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_server/code_executor.py"
click node_search_client "https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_client/web_search_client.py"
click node_search_server "https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_server/web_search.py"
click node_policy "https://github.com/mhdd4nish/prep_rag_agent/blob/main/governance/policy.py"
click node_gateway "https://github.com/mhdd4nish/prep_rag_agent/blob/main/gateway/server.py"
click node_judge "https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/judge.py"
click node_logger "https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/logger.py"
click node_calibration "https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/calibration.py"
click node_training_data "https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/generate_training_data.py"
click node_dashboard "https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/dashboard.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_cli,node_workflow,node_state,node_session_nodes,node_guardrails toneBlue
class node_raw_docs,node_ingest,node_retriever toneAmber
class node_code_client,node_code_server,node_search_client,node_search_server,node_policy toneMint
class node_gateway toneRose
class node_judge,node_logger,node_calibration,node_training_data,node_dashboard,node_candidate toneIndigo
```

## Components

### Interview Session

- [Session CLI](https://github.com/mhdd4nish/prep_rag_agent/blob/main/main.py): `main.py`
- [Session Graph](https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/graph.py): `agents/graph.py`
- [Session State](https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/state.py): `agents/state.py`
- [Interview Nodes](https://github.com/mhdd4nish/prep_rag_agent/blob/main/agents/nodes.py): `agents/nodes.py`
- [Input Guardrails](https://github.com/mhdd4nish/prep_rag_agent/blob/main/guardrails/checker.py): `guardrails/checker.py`

### Knowledge Retrieval

- [Interview Material](https://github.com/mhdd4nish/prep_rag_agent/blob/main/data/raw/interview_qa.txt): `data/raw/interview_qa.txt`
- [Knowledge Ingestion](https://github.com/mhdd4nish/prep_rag_agent/blob/main/utils/ingest.py): `utils/ingest.py`
- [Hybrid Retriever](https://github.com/mhdd4nish/prep_rag_agent/blob/main/utils/retriever.py): `utils/retriever.py`

### Tools and Governance

- [Code MCP Client](https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_client/client.py): `mcp_client/client.py`
- [Code Executor](https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_server/code_executor.py): `mcp_server/code_executor.py`
- [Search MCP Client](https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_client/web_search_client.py): `mcp_client/web_search_client.py`
- [Web Search](https://github.com/mhdd4nish/prep_rag_agent/blob/main/mcp_server/web_search.py): `mcp_server/web_search.py`
- [Tool Access Policy](https://github.com/mhdd4nish/prep_rag_agent/blob/main/governance/policy.py): `governance/policy.py`

### LLM Gateway

- [LLM Gateway](https://github.com/mhdd4nish/prep_rag_agent/blob/main/gateway/server.py): `gateway/server.py`

### Evaluation and Reporting

- [Answer Judge](https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/judge.py): `evaluation/judge.py`
- [Session Logger](https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/logger.py): `evaluation/logger.py`
- [Judge Calibration](https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/calibration.py): `evaluation/calibration.py`
- [Judge Data Generation](https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/generate_training_data.py): `evaluation/generate_training_data.py`
- [Evaluation Dashboard](https://github.com/mhdd4nish/prep_rag_agent/blob/main/evaluation/dashboard.py): `evaluation/dashboard.py`

### Other components

- **Candidate**

## Connections

- Candidate → Session CLI: selects topics (evidence: `main.py`)
- Session CLI → Session Graph: invokes (evidence: `main.py`)
- Session Graph → Session State: uses state (evidence: `agents/graph.py`)
- Session Graph → Interview Nodes: registers and routes (evidence: `agents/graph.py`)
- Interview Nodes → Hybrid Retriever: retrieves context (evidence: `agents/nodes.py`)
- Interview Material → Knowledge Ingestion: provides documents (evidence: `README.md`)
- Knowledge Ingestion → Hybrid Retriever: builds indexes for (evidence: `README.md`)
- Interview Nodes → Input Guardrails: checks answers (evidence: `agents/nodes.py`)
- Interview Nodes → Code MCP Client: requests execution (evidence: `agents/nodes.py`)
- Code MCP Client → Code Executor: calls over stdio (evidence: `mcp_client/client.py`)
- Interview Nodes → Search MCP Client: requests verification (evidence: `agents/nodes.py`)
- Search MCP Client → Web Search: calls over stdio (evidence: `mcp_client/web_search_client.py`)
- Interview Nodes → Tool Access Policy: checks tool access (evidence: `agents/nodes.py`)
- Interview Nodes → Answer Judge: scores answers (evidence: `agents/nodes.py`)
- Interview Nodes → Session Logger: records turns (evidence: `agents/nodes.py`)
- Interview Nodes → LLM Gateway: routes LLM traffic (evidence: `README.md`)
- Input Guardrails → LLM Gateway: uses classifier LLM
- Evaluation Dashboard → Session Logger: reads session results (evidence: `evaluation/dashboard.py`)
- Evaluation Dashboard → Tool Access Policy: reads access report (evidence: `evaluation/dashboard.py`)
- Evaluation Dashboard → LLM Gateway: reads usage logs (evidence: `evaluation/dashboard.py`)
- Evaluation Dashboard → Judge Calibration: displays report (evidence: `evaluation/dashboard.py`)
- Judge Data Generation → Hybrid Retriever: generates questions with (evidence: `evaluation/generate_training_data.py`)
- Judge Data Generation → Answer Judge: labels generated answers (evidence: `evaluation/generate_training_data.py`)
