# kasturimaheshbabu2316-mc/capstone---service architecture

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

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

## Overview

Ola Support Agent serves policy questions and ticket-status requests through REST/WebSocket or a Streamlit portal. The main request workflow applies input safety and caching, resolves session context, routes to policy retrieval or ticket lookup, then reviews and returns a structured answer with audit metadata. Separate branches cover policy-document ingestion, dual-index retrieval, and ticket-risk scoring. The excerpts and SOURCE INDEX support the principal service and agent links; portal-specific internals are less visible, so those links are limited to documented capabilities.

Main entry points: [`app/main.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/main.py) (FastAPI Service), [`crew/crew.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/crew.py) (Agent Coordinator), [`crew/agents.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/agents.py) (Specialist Agents), [`tools/ticket_tool.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/tools/ticket_tool.py) (Ticket Lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_web_console["Web Console<br/>[app.js]"]
  node_streamlit["Streamlit Portal<br/>[streamlit_app.py]"]
end

subgraph group_service["Request Service"]
  node_api_service["FastAPI Service<br/>[main.py]"]
  node_api_contracts["API Schemas<br/>[models.py]"]
  node_input_safety["Input Guardrails<br/>[input_guard.py]"]
  node_response_cache[("Response Cache<br/>[cache.py]")]
  node_audit_log["Audit Logging<br/>[logging_utils.py]"]
end

subgraph group_support["Support Domain"]
  node_response_contract["Response Schema<br/>[schema.py]"]
  node_session_memory["Session Memory<br/>[memory.py]"]
  node_agent_coordinator["Agent Coordinator<br/>[crew.py]"]
  node_agent_definitions["Specialist Agents<br/>[agents.py]"]
  node_mock_llm["Offline Mock LLM<br/>[mock_llm.py]"]
  node_ticket_lookup["Ticket Lookup<br/>[ticket_tool.py]"]
  node_ticket_dataset[("Ticket Dataset<br/>[dataset.py]")]
  node_response_review["Compliance Review<br/>[autogen_review.py]"]
end

subgraph group_knowledge["Policy Knowledge"]
  node_policy_tool["Policy Lookup Tool<br/>[rag_tool.py]"]
  node_grounded_generation["Grounded Generation<br/>[generate.py]"]
  node_vector_index[("Dual Vector Index<br/>[index.py]")]
  node_chunking["Document Chunking<br/>[chunking.py]"]
  node_policy_admin["Policy Ingestion<br/>[main.py]"]
end

node_customer(("Customer"))
node_admin(("Support Admin"))

node_customer -->|"uses chat"| node_web_console
node_web_console -.->|"sends requests"| node_api_service
node_customer -->|"uses portal"| node_streamlit
node_streamlit -.->|"invokes support"| node_api_service
node_admin -->|"submits documents"| node_policy_admin
node_policy_admin -->|"indexes documents"| node_vector_index
node_policy_admin -->|"invalidates entries"| node_response_cache
node_api_service -->|"validates payloads"| node_api_contracts
node_api_service -->|"sanitizes input"| node_input_safety
node_api_service -->|"checks cache"| node_response_cache
node_api_service -->|"runs support crew"| node_agent_coordinator
node_api_service -->|"reviews draft"| node_response_review
node_api_service -->|"records requests"| node_audit_log
node_agent_coordinator -->|"resolves context"| node_session_memory
node_agent_coordinator -->|"creates agents"| node_agent_definitions
node_agent_coordinator -->|"checks tickets"| node_ticket_lookup
node_agent_coordinator -->|"looks up policies"| node_policy_tool
node_agent_coordinator -->|"returns structured answer"| node_response_contract
node_agent_definitions -->|"uses model"| node_mock_llm
node_agent_definitions -->|"binds ticket tool"| node_ticket_lookup
node_agent_definitions -->|"binds policy tool"| node_policy_tool
node_ticket_lookup -->|"reads records"| node_ticket_dataset
node_policy_tool -->|"generates lookup"| node_grounded_generation
node_grounded_generation -->|"retrieves chunks"| node_vector_index
node_vector_index -->|"chunks documents"| node_chunking
node_response_review -->|"checks grounding"| node_grounded_generation

click node_web_console "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/static/app.js"
click node_streamlit "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/streamlit_app.py"
click node_api_service "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/main.py"
click node_api_contracts "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/models.py"
click node_input_safety "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/guardrails/input_guard.py"
click node_response_cache "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/cache.py"
click node_audit_log "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/logging_utils.py"
click node_response_contract "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/schema.py"
click node_session_memory "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/memory.py"
click node_agent_coordinator "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/crew.py"
click node_agent_definitions "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/agents.py"
click node_mock_llm "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/llm/mock_llm.py"
click node_ticket_lookup "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/tools/ticket_tool.py"
click node_ticket_dataset "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/dataset.py"
click node_response_review "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/review/autogen_review.py"
click node_policy_tool "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/tools/rag_tool.py"
click node_grounded_generation "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/rag/generate.py"
click node_vector_index "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/rag/index.py"
click node_chunking "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/rag/chunking.py"
click node_policy_admin "https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/main.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_web_console,node_streamlit toneBlue
class node_api_service,node_api_contracts,node_input_safety,node_response_cache,node_audit_log toneAmber
class node_response_contract,node_session_memory,node_agent_coordinator,node_agent_definitions,node_mock_llm,node_ticket_lookup,node_ticket_dataset,node_response_review toneMint
class node_policy_tool,node_grounded_generation,node_vector_index,node_chunking,node_policy_admin toneRose
class node_customer,node_admin toneIndigo
```

## Components

### User Interfaces

- [Web Console](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/static/app.js): `static/app.js`
- [Streamlit Portal](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/streamlit_app.py): `streamlit_app.py`

### Request Service

- [FastAPI Service](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/main.py): `app/main.py`
- [API Schemas](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/models.py): `app/models.py`
- [Input Guardrails](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/guardrails/input_guard.py): `guardrails/input_guard.py`
- [Response Cache](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/cache.py): `cache.py`
- [Audit Logging](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/logging_utils.py): `app/logging_utils.py`

### Support Domain

- [Response Schema](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/schema.py): `crew/schema.py`
- [Session Memory](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/memory.py): `crew/memory.py`
- [Agent Coordinator](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/crew.py): `crew/crew.py`
- [Specialist Agents](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/crew/agents.py): `crew/agents.py`
- [Offline Mock LLM](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/llm/mock_llm.py): `llm/mock_llm.py`
- [Ticket Lookup](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/tools/ticket_tool.py): `tools/ticket_tool.py`
- [Ticket Dataset](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/dataset.py): `dataset.py`
- [Compliance Review](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/review/autogen_review.py): `review/autogen_review.py`

### Policy Knowledge

- [Policy Lookup Tool](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/tools/rag_tool.py): `tools/rag_tool.py`
- [Grounded Generation](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/rag/generate.py): `rag/generate.py`
- [Dual Vector Index](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/rag/index.py): `rag/index.py`
- [Document Chunking](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/rag/chunking.py): `rag/chunking.py`
- [Policy Ingestion](https://github.com/kasturimaheshbabu2316-mc/capstone---service/blob/main/app/main.py): `app/main.py`

### Other components

- **Customer**
- **Support Admin**

## Connections

- Customer → Web Console: uses chat
- Web Console → FastAPI Service: sends requests
- Customer → Streamlit Portal: uses portal
- Streamlit Portal → FastAPI Service: invokes support
- Support Admin → Policy Ingestion: submits documents
- Policy Ingestion → Dual Vector Index: indexes documents (evidence: `app/main.py`)
- Policy Ingestion → Response Cache: invalidates entries (evidence: `app/main.py`)
- FastAPI Service → API Schemas: validates payloads (evidence: `app/main.py`)
- FastAPI Service → Input Guardrails: sanitizes input (evidence: `app/main.py`)
- FastAPI Service → Response Cache: checks cache (evidence: `app/main.py`)
- FastAPI Service → Agent Coordinator: runs support crew (evidence: `app/main.py`)
- FastAPI Service → Compliance Review: reviews draft (evidence: `app/main.py`)
- FastAPI Service → Audit Logging: records requests (evidence: `app/main.py`)
- Agent Coordinator → Session Memory: resolves context (evidence: `crew/crew.py`)
- Agent Coordinator → Specialist Agents: creates agents (evidence: `crew/crew.py`)
- Agent Coordinator → Ticket Lookup: checks tickets (evidence: `crew/crew.py`)
- Agent Coordinator → Policy Lookup Tool: looks up policies (evidence: `crew/crew.py`)
- Agent Coordinator → Response Schema: returns structured answer (evidence: `crew/crew.py`)
- Specialist Agents → Offline Mock LLM: uses model (evidence: `crew/agents.py`)
- Specialist Agents → Ticket Lookup: binds ticket tool (evidence: `crew/agents.py`)
- Specialist Agents → Policy Lookup Tool: binds policy tool (evidence: `crew/agents.py`)
- Ticket Lookup → Ticket Dataset: reads records (evidence: `tools/ticket_tool.py`)
- Policy Lookup Tool → Grounded Generation: generates lookup (evidence: `tools/rag_tool.py`)
- Grounded Generation → Dual Vector Index: retrieves chunks (evidence: `rag/generate.py`)
- Dual Vector Index → Document Chunking: chunks documents (evidence: `rag/index.py`)
- Compliance Review → Grounded Generation: checks grounding (evidence: `review/autogen_review.py`)
