# kasturimaheshbabu2316-mc/capstone---hr architecture

> Architecture diagram of the GitHub repository kasturimaheshbabu2316-mc/capstone---hr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kasturimaheshbabu2316-mc/capstone---hr
- Repository: https://github.com/kasturimaheshbabu2316-mc/capstone---hr

## Overview

This repository implements a recruitment and HR support agent for Naukri.com, exposed through HTTP and WebSocket endpoints. A query is budget-checked, masked and screened, then answered through policy retrieval or application-status lookup; the draft is reviewed before returning to the user, with caching and audit logging around the request. Other substantial capabilities include document ingestion, multi-agent tools and memory, deterministic application data, governance controls, and RAG evaluation. Some links to unsampled subsystems are omitted or marked unverified because only source-index references were available.

Main entry points: [`app/main.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/app/main.py) (Request service), [`rag/indexing.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/indexing.py) (Dual-strategy indexing), [`crew/agents.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/agents.py) (Agent team), [`crew/tools.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/tools.py) (Status and RAG tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and orchestration"]
  node_api_adapter["API adapter<br/>[main.py]"]
  node_service["Request service<br/>[main.py]"]
  node_logging["Audit logging<br/>[logging_utils.py]"]
end

subgraph group_safety["Safety and governance"]
  node_budget["Token budget<br/>[budget.py]"]
  node_access["Tool access control<br/>[least_autonomy.py]"]
  node_guards["Input/output guards<br/>[guardrails.py]"]
end

subgraph group_answers["Answer capabilities"]
  node_agents["Agent team<br/>[agents.py]"]
  node_tools["Status and RAG tools<br/>[tools.py]"]
  node_records[("Application records<br/>[dataset.py]")]
  node_mock_llm["Deterministic language model<br/>[mock_llm.py]"]
  node_schemas["Response contracts<br/>[schemas.py]"]
  node_memory[("Conversation memory<br/>[memory.py]")]
  node_review["Independent peer review<br/>[autogen_review.py]"]
end

subgraph group_knowledge["Knowledge retrieval"]
  node_generator["Grounded answer generation<br/>[generate.py]"]
  node_indexing["Dual-strategy indexing<br/>[indexing.py]"]
  node_chunking["Document chunking<br/>[chunking.py]"]
  node_policy_docs["HR policy documents"]
  node_vector_store[("Vector collections<br/>[indexing.py]")]
end

subgraph group_operations["State and evaluation"]
  node_cache[("Query cache<br/>[cache.py]")]
  node_evaluator["Answer evaluation<br/>[judge.py]"]
end

node_user(("Support user"))

node_user -->|"submits query"| node_api_adapter
node_api_adapter -->|"routes requests"| node_service
node_service -->|"checks budget"| node_budget
node_service -->|"screens query"| node_guards
node_service -->|"checks cache"| node_cache
node_service -->|"retrieves policy answer"| node_generator
node_service -->|"ingests documents"| node_tools
node_service -->|"submits draft"| node_review
node_service -->|"records request"| node_logging
node_service -.->|"uses agent team"| node_agents
node_agents -.->|"dispatches tools"| node_tools
node_agents -->|"uses model"| node_mock_llm
node_agents -->|"uses contracts"| node_schemas
node_tools -->|"reads applications"| node_records
node_tools -->|"queries index"| node_indexing
node_service -.->|"applies tool policy"| node_access
node_service -.->|"uses session memory"| node_memory
node_generator -->|"queries passages"| node_indexing
node_indexing -->|"chunks documents"| node_chunking
node_indexing -->|"loads policies"| node_policy_docs
node_indexing -->|"writes and queries"| node_vector_store
node_review -->|"emits verdict"| node_schemas
node_evaluator -->|"evaluates answers"| node_generator
node_evaluator -->|"checks grounding"| node_guards
node_evaluator -->|"evaluates review"| node_review

click node_api_adapter "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/api/main.py"
click node_service "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/app/main.py"
click node_logging "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/app/logging_utils.py"
click node_budget "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/governance/budget.py"
click node_access "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/governance/least_autonomy.py"
click node_guards "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/guardrails.py"
click node_agents "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/agents.py"
click node_tools "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/tools.py"
click node_records "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/dataset.py"
click node_mock_llm "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/llm/mock_llm.py"
click node_schemas "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/schemas.py"
click node_memory "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/memory.py"
click node_generator "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/generate.py"
click node_indexing "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/indexing.py"
click node_chunking "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/chunking.py"
click node_policy_docs "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/tree/main/kb"
click node_vector_store "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/indexing.py"
click node_review "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/review/autogen_review.py"
click node_cache "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/cache.py"
click node_evaluator "https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/eval/judge.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_adapter,node_service,node_logging,node_user toneBlue
class node_budget,node_access,node_guards toneAmber
class node_agents,node_tools,node_records,node_mock_llm,node_schemas,node_memory,node_review toneMint
class node_generator,node_indexing,node_chunking,node_policy_docs,node_vector_store toneRose
class node_cache,node_evaluator toneIndigo
```

## Components

### API and orchestration

- [API adapter](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/api/main.py): `api/main.py`
- [Request service](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/app/main.py): `app/main.py`
- [Audit logging](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/app/logging_utils.py): `app/logging_utils.py`

### Safety and governance

- [Token budget](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/governance/budget.py): `governance/budget.py`
- [Tool access control](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/governance/least_autonomy.py): `governance/least_autonomy.py`
- [Input/output guards](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/guardrails.py): `crew/guardrails.py`

### Answer capabilities

- [Agent team](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/agents.py): `crew/agents.py`
- [Status and RAG tools](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/tools.py): `crew/tools.py`
- [Application records](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/dataset.py): `dataset.py`
- [Deterministic language model](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/llm/mock_llm.py): `llm/mock_llm.py`
- [Response contracts](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/schemas.py): `crew/schemas.py`
- [Conversation memory](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/crew/memory.py): `crew/memory.py`
- [Independent peer review](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/review/autogen_review.py): `review/autogen_review.py`

### Knowledge retrieval

- [Grounded answer generation](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/generate.py): `rag/generate.py`
- [Dual-strategy indexing](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/indexing.py): `rag/indexing.py`
- [Document chunking](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/chunking.py): `rag/chunking.py`
- [HR policy documents](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/tree/main/kb): `kb`
- [Vector collections](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/rag/indexing.py): `rag/indexing.py`

### State and evaluation

- [Query cache](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/cache.py): `cache.py`
- [Answer evaluation](https://github.com/kasturimaheshbabu2316-mc/capstone---hr/blob/main/eval/judge.py): `eval/judge.py`

### Other components

- **Support user**

## Connections

- Support user → API adapter: submits query (evidence: `api/main.py`)
- API adapter → Request service: routes requests (evidence: `api/main.py`)
- Request service → Token budget: checks budget (evidence: `app/main.py`)
- Request service → Input/output guards: screens query (evidence: `app/main.py`)
- Request service → Query cache: checks cache (evidence: `app/main.py`)
- Request service → Grounded answer generation: retrieves policy answer (evidence: `app/main.py`)
- Request service → Status and RAG tools: ingests documents (evidence: `app/main.py`)
- Request service → Independent peer review: submits draft (evidence: `app/main.py`)
- Request service → Audit logging: records request (evidence: `app/main.py`)
- Request service → Agent team: uses agent team
- Agent team → Status and RAG tools: dispatches tools (evidence: `crew/agents.py`)
- Agent team → Deterministic language model: uses model (evidence: `crew/agents.py`)
- Agent team → Response contracts: uses contracts (evidence: `crew/agents.py`)
- Status and RAG tools → Application records: reads applications (evidence: `crew/tools.py`)
- Status and RAG tools → Dual-strategy indexing: queries index (evidence: `crew/tools.py`)
- Request service → Tool access control: applies tool policy (evidence: `app/main.py`)
- Request service → Conversation memory: uses session memory (evidence: `app/main.py`)
- Grounded answer generation → Dual-strategy indexing: queries passages (evidence: `rag/generate.py`)
- Dual-strategy indexing → Document chunking: chunks documents (evidence: `rag/indexing.py`)
- Dual-strategy indexing → HR policy documents: loads policies (evidence: `rag/indexing.py`)
- Dual-strategy indexing → Vector collections: writes and queries (evidence: `rag/indexing.py`)
- Independent peer review → Response contracts: emits verdict (evidence: `review/autogen_review.py`)
- Answer evaluation → Grounded answer generation: evaluates answers (evidence: `eval/judge.py`)
- Answer evaluation → Input/output guards: checks grounding (evidence: `eval/judge.py`)
- Answer evaluation → Independent peer review: evaluates review (evidence: `eval/judge.py`)
