# vedhakoushik/placement-prep-agent architecture

> Architecture diagram of the GitHub repository vedhakoushik/placement-prep-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vedhakoushik/placement-prep-agent
- Repository: https://github.com/vedhakoushik/placement-prep-agent

## Overview

1. **What this repository is**
   - A capstone “placement prep” agent that helps a user research a company, synthesize interview prep context, and generate tailored questions.
   - The repo is organized as a progression from learning exercises to a production-like app, with the final path centered on a LangGraph workflow plus a web UI and CLI entrypoints.

2. **Primary runtime surfaces**
   - `main.py` is the main command-line entrypoint for setup checks, research runs, tests, and launching the app.
   - `webapp/app.py` plus `webapp/templates/` and `webapp/static/` form a browser UI layer with pages for research, chat, company history, progress, and settings.
   - The README references Streamlit, but the file tree strongly suggests the shipped UI boundary is a template/static web app (Flask-style) rather than only Streamlit.

3. **Core orchestration layer**
   - The final application logic appears to live in `week5/day34_35_app.py`, which the README identifies as the LangGraph-based app.
   - The central abstraction is a typed state object (`ResearchState`) that flows through a node pipeline. Each node reads the full state and returns only changed fields.
   - The graph is a linear research pipeline with error accumulation rather than hard failure.

4. **Main data flow**
   - User input starts with company, role, and focus.
   - A metadata step extracts company facts.
   - A research step gathers web snippets.
   - A synthesis step turns the findings into a short briefing.
   - A question-generation step produces interview questions.
   - That output then feeds the chat experience, which answers with the research context as grounding.

5. **External AI/search dependencies**
   - Gemini is the main LLM used for synthesis, question generation, and chat responses.
   - Tavily is the external search service used to gather fresh web evidence.
   - LangSmith is optional and only affects observability/tracing, not the core product behavior.

6. **State, persistence, and session boundaries**
   - LangGraph checkpointing via `SqliteSaver` is a major architectural boundary: it makes multi-step runs resumable and allows thread/session isolation.
   - The app also persists user preferences locally in `.pp_settings.json`.
   - The README notes limited long-term memory; the current design is primarily session-local rather than account-based.

7. **UI structure**
   - The web UI is split by user task:
     - Research: run the company prep pipeline
     - Chat: ask questions grounded in prior research
     - My Companies: browse saved research
     - Progress: readiness metrics and charts
     - Settings: API key and preference state
   - Templates are centralized under `webapp/templates/` with shared layout in `base.html`, and client-side behavior lives in `webapp/static/js/app.js`.

8. **Supporting modules and learning progression**
   - `week1/` through `week4/` contain earlier-stage experiments: raw chat, chain composition, memory, embeddings, ChromaDB, RAG, and agent patterns.
   - `week5/` is where the app becomes a cohesive product with structured outputs, error handling, and the main app.
   - These folders are mostly educational/prototyping layers that inform the final architecture, rather than separate runtime subsystems.

9. **Local knowledge and retrieval pieces**
   - `week3/` includes ChromaDB, DB inspection, import, and RAG-related modules, indicating a local vector-store/retrieval capability exists in the codebase.
   - Even if not the main path in the README’s 4-node research flow, this layer is an architectural option for grounding responses in stored company notes or prior research.

10. **Quality gates and resilience**
    - `week6/` contains unit tests, integration tests, logging, and audit code.
    - The tests emphasize graph shape, node order, mocked external APIs, checkpoint persistence, thread isolation, interrupt/resume behavior, and error recovery.
    - This means the architecture explicitly separates deterministic orchestration from nondeterministic API calls.

11. **Deployment and packaging**
    - `Dockerfile` and `docker-compose.yml` define containerized local execution.
    - GitHub Actions workflows cover CI, tests, and deployment automation.
    - This implies the app is designed to run as a single-process service with external API dependencies, rather than a multi-service backend.

12. **Operational boundary summary**
    - The main production boundary is: browser or CLI input → LangGraph orchestration → Gemini/Tavily external calls → checkpointed state → web UI / chat output.
    - Everything else in the repo supports that path: earlier week folders demonstrate evolution, tests validate it, and Docker/CI make it runnable and shippable.

Main entry points: [`week5/day34_35_app.py`](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py) (LangGraph app), [`webapp/app.py`](https://github.com/vedhakoushik/placement-prep-agent/blob/main/webapp/app.py) (Web app), [`src/utils.py`](https://github.com/vedhakoushik/placement-prep-agent/blob/main/src/utils.py) (Shared utils), [`week6/day37_unit_tests.py`](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week6/day37_unit_tests.py) (Tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime surfaces"]
  node_main_py["CLI<br/>entrypoint<br/>[main.py]"]
  node_webapp_app["Web app<br/>ui server<br/>[app.py]"]
  node_web_templates["Templates<br/>ui views"]
  node_web_static_js["Client JS<br/>frontend script<br/>[app.js]"]
end

subgraph group_core["Core app"]
  node_research_app["LangGraph app<br/>workflow<br/>[day34_35_app.py]"]
  node_research_state{{"Research state<br/>typed state<br/>[day34_35_app.py]"}}
  node_meta_node["Metadata<br/>pipeline step<br/>[day34_35_app.py]"]
  node_search_node["Web search<br/>pipeline step<br/>[day34_35_app.py]"]
  node_synthesis_node["Briefing<br/>pipeline step<br/>[day34_35_app.py]"]
  node_questions_node["Questions<br/>pipeline step<br/>[day34_35_app.py]"]
  node_chat_flow(("Chat grounding<br/>conversation flow<br/>[day34_35_app.py]"))
end

subgraph group_support["Support systems"]
  node_sqlite_saver[("Checkpointing<br/>persistence")]
  node_settings_store["Local settings<br/>preferences store"]
  node_chroma_layer[("Vector store<br/>retrieval<br/>[day16_chromadb.py]")]
  node_utils_mod["Shared utils<br/>helpers<br/>[utils.py]"]
end

subgraph group_ops["Quality and ops"]
  node_tests_suite["Tests<br/>quality"]
  node_logging_audit["Observability<br/>logging and audit<br/>[day36_audit.py]"]
  node_ci_cd["CI/CD<br/>automation<br/>[ci.yml]"]
  node_docker_stack["Containers<br/>deployment"]
end

subgraph group_learning["Learning progression"]
  node_week1_week4["Earlier labs<br/>learning modules"]
  node_week5_ext["App design<br/>workflow design<br/>[day29_design.py]"]
end

node_main_py -->|"launches"| node_research_app
node_webapp_app -->|"invokes"| node_research_app
node_webapp_app -->|"renders"| node_web_templates
node_webapp_app -->|"serves"| node_web_static_js
node_research_app -->|"reads/writes"| node_research_state
node_research_app -->|"starts with"| node_meta_node
node_meta_node -->|"feeds"| node_search_node
node_search_node -->|"feeds"| node_synthesis_node
node_synthesis_node -->|"feeds"| node_questions_node
node_questions_node -->|"grounds"| node_chat_flow
node_research_app -->|"persists"| node_sqlite_saver
node_webapp_app -->|"resumes"| node_sqlite_saver
node_webapp_app -->|"loads/saves"| node_settings_store
node_research_app -.->|"optionally uses"| node_chroma_layer
node_week1_week4 -.->|"evolves into"| node_week5_ext
node_week5_ext -.->|"shapes"| node_research_app
node_tests_suite -->|"validates"| node_research_app
node_logging_audit -->|"observes"| node_research_app
node_ci_cd -->|"runs"| node_tests_suite
node_docker_stack -->|"packages"| node_webapp_app
node_utils_mod -.->|"supports"| node_webapp_app
node_utils_mod -.->|"supports"| node_research_app

click node_main_py "https://github.com/vedhakoushik/placement-prep-agent/blob/main/main.py"
click node_webapp_app "https://github.com/vedhakoushik/placement-prep-agent/blob/main/webapp/app.py"
click node_web_templates "https://github.com/vedhakoushik/placement-prep-agent/tree/main/webapp/templates"
click node_web_static_js "https://github.com/vedhakoushik/placement-prep-agent/blob/main/webapp/static/js/app.js"
click node_research_app "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_research_state "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_meta_node "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_search_node "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_synthesis_node "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_questions_node "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_chat_flow "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py"
click node_sqlite_saver "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week4/day27_28_persistence.py"
click node_chroma_layer "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week3/day16_chromadb.py"
click node_utils_mod "https://github.com/vedhakoushik/placement-prep-agent/blob/main/src/utils.py"
click node_tests_suite "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week6/day37_unit_tests.py"
click node_logging_audit "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week6/day36_audit.py"
click node_ci_cd "https://github.com/vedhakoushik/placement-prep-agent/blob/main/.github/workflows/ci.yml"
click node_docker_stack "https://github.com/vedhakoushik/placement-prep-agent/tree/main/Dockerfile"
click node_week1_week4 "https://github.com/vedhakoushik/placement-prep-agent/tree/main/week1"
click node_week5_ext "https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day29_design.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_main_py,node_webapp_app,node_web_templates,node_web_static_js toneBlue
class node_research_app,node_research_state,node_meta_node,node_search_node,node_synthesis_node,node_questions_node,node_chat_flow toneAmber
class node_sqlite_saver,node_settings_store,node_chroma_layer,node_utils_mod toneMint
class node_tests_suite,node_logging_audit,node_ci_cd,node_docker_stack toneRose
class node_week1_week4,node_week5_ext toneIndigo
```

## Components

### Runtime surfaces

Primary entrypoints and user-facing interfaces

- [CLI](https://github.com/vedhakoushik/placement-prep-agent/blob/main/main.py): entrypoint · Command-line entrypoint for setup checks, research runs, tests, and launching the app · `main.py`
- [Web app](https://github.com/vedhakoushik/placement-prep-agent/blob/main/webapp/app.py): ui server · Browser-facing application layer coordinating research, chat, history, progress, and settings · `webapp/app.py`
- [Templates](https://github.com/vedhakoushik/placement-prep-agent/tree/main/webapp/templates): ui views · Shared HTML views for the browser interface · `webapp/templates`
- [Client JS](https://github.com/vedhakoushik/placement-prep-agent/blob/main/webapp/static/js/app.js): frontend script · Browser behavior and UI interactions · `webapp/static/js/app.js`

### Core app

LangGraph orchestration and checkpointed state

- [LangGraph app](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): workflow · Main research pipeline built around typed state and checkpointed execution · `week5/day34_35_app.py`
- [Research state](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): typed state · Central state object flowing through the pipeline with partial updates · `week5/day34_35_app.py`
- [Metadata](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): pipeline step · Extracts company facts and basic context from the user request · `week5/day34_35_app.py`
- [Web search](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): pipeline step · Fetches fresh evidence from Tavily · `week5/day34_35_app.py`
- [Briefing](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): pipeline step · Condenses research findings into a short prep summary · `week5/day34_35_app.py`
- [Questions](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): pipeline step · Generates tailored interview questions from the synthesized context · `week5/day34_35_app.py`
- [Chat grounding](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day34_35_app.py): conversation flow · Answers user questions using the accumulated research context · `week5/day34_35_app.py`

### Support systems

Retrieval, persistence, and shared helpers

- [Checkpointing](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week4/day27_28_persistence.py): persistence · Resumable thread-local state storage via LangGraph checkpointing · `week4/day27_28_persistence.py`
- **Local settings**: preferences store · Persists user preferences and API-related local configuration
- [Vector store](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week3/day16_chromadb.py): retrieval · Local ChromaDB and RAG support for stored notes and prior research · `week3/day16_chromadb.py`
- [Shared utils](https://github.com/vedhakoushik/placement-prep-agent/blob/main/src/utils.py): helpers · Common utility functions used across the repo · `src/utils.py`

### Quality and ops

Testing, logging, deployment, and CI

- [Tests](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week6/day37_unit_tests.py): quality · Unit, integration, persistence, interrupt/resume, and graph-shape validation · `week6/day37_unit_tests.py`
- [Observability](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week6/day36_audit.py): logging and audit · Logging, audit trails, and run inspection support · `week6/day36_audit.py`
- [CI/CD](https://github.com/vedhakoushik/placement-prep-agent/blob/main/.github/workflows/ci.yml): automation · GitHub Actions workflows for tests, CI, and deployment · `.github/workflows/ci.yml`
- [Containers](https://github.com/vedhakoushik/placement-prep-agent/tree/main/Dockerfile): deployment · Docker and compose definitions for local and packaged execution · `Dockerfile`

### Learning progression

Earlier week exercises that feed the final app

- [Earlier labs](https://github.com/vedhakoushik/placement-prep-agent/tree/main/week1): learning modules · Progression of chat, tools, memory, RAG, agent, and graph experiments · `week1`
- [App design](https://github.com/vedhakoushik/placement-prep-agent/blob/main/week5/day29_design.py): workflow design · Design, supervisor, structured outputs, error handling, and LangSmith instrumentation · `week5/day29_design.py`

## Connections

- CLI → LangGraph app: launches · CLI starts or exercises the main LangGraph app
- Web app → LangGraph app: invokes · Web requests trigger the core research workflow
- Web app → Templates: renders · Server uses templates for browser pages
- Web app → Client JS: serves · Client-side interaction assets support the UI
- LangGraph app → Research state: reads/writes · Workflow nodes consume and return partial state updates
- LangGraph app → Metadata: starts with · Pipeline begins with company metadata extraction
- Metadata → Web search: feeds · Metadata informs search queries and evidence gathering
- Web search → Briefing: feeds · Collected snippets are summarized into a briefing
- Briefing → Questions: feeds · Briefing context drives tailored question generation
- Questions → Chat grounding: grounds · Generated prep context supports follow-up chat answers
- LangGraph app → Checkpointing: persists · Checkpointing makes multi-step runs resumable and isolated
- Web app → Checkpointing: resumes · UI sessions can continue stored runs
- Web app → Local settings: loads/saves · Preferences and API key state are stored locally
- LangGraph app → Vector store: optionally uses · Local retrieval can augment grounding from stored research
- Earlier labs → App design: evolves into · Earlier exercises inform the final app design and orchestration
- App design → LangGraph app: shapes · Design, structure, and error handling feed the production path
- Tests → LangGraph app: validates · Tests assert graph shape, node order, persistence, and recovery
- Observability → LangGraph app: observes · Logging and audit code track workflow behavior
- CI/CD → Tests: runs · CI executes the test and verification pipeline
- Containers → Web app: packages · Container setup packages the app for local or deployed execution
- Shared utils → Web app: supports · Shared utilities are reused by runtime components
- Shared utils → LangGraph app: supports · Shared utilities also support orchestration code
