# sahilshirodkar30/goaguide_ai architecture

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

- Interactive diagram: https://gitdiagram.com/sahilshirodkar30/goaguide_ai
- Repository: https://github.com/sahilshirodkar30/goaguide_ai

## Overview

GoaGuide is a Goa-focused conversational RAG application. A user submits a question to the FastAPI service, which applies guardrails and runs a stateful LangGraph workflow: planning routes conversational requests directly to response generation, document queries through retrieval and reranking, and web queries through Tavily search. Separately, document ingestion parses supported formats, chunks and embeds content, then indexes it in Pinecone for later retrieval. The graph preserves these distinct stages; the Streamlit UI is included as a product surface, though its runtime connections are not established by the excerpts. Unsampled UI and guardrail internals are represented conservatively.

Main entry points: [`app/agents/graph.py`](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/graph.py) (Workflow router), [`app/ingestion/processor.py`](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ingestion/processor.py) (Ingestion processor), [`app/agents/nodes/retriever.py`](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/retriever.py) (Knowledge retriever), [`app/agents/nodes/responder.py`](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/responder.py) (Answer generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and UI"]
  node_api["FastAPI service<br/>[main.py]"]
  node_ui["Streamlit interface<br/>[streamlit_ui.py]"]
end

subgraph group_agent["Agent workflow"]
  node_graph["Workflow router<br/>[graph.py]"]
  node_state["Agent state<br/>[state.py]"]
  node_planner["Query planner<br/>[planner.py]"]
  node_responder["Answer generator<br/>[responder.py]"]
  node_retriever["Knowledge retriever<br/>[retriever.py]"]
  node_websearch["Web search<br/>[web_search.py]"]
  node_gateway["LLM gateway client<br/>[client.py]"]
end

subgraph group_knowledge["Knowledge ingestion"]
  node_loaders["Format loaders"]
  node_processor["Ingestion processor<br/>[processor.py]"]
  node_chunker["Text chunker<br/>[splitter.py]"]
end

subgraph group_retrieval["Retrieval services"]
  node_embedding["Embedding service<br/>[embedding.py]"]
  node_vector[("Pinecone index")]
  node_ranker["Semantic reranker<br/>[ranking_service.py]"]
end

subgraph group_safety["Safety and configuration"]
  node_guard["Request guardrails<br/>[rails.py]"]
  node_rules["Colang rules<br/>[colang_rules.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

node_user(("Questioner"))
node_portkey{{"Portkey gateway"}}
node_tavily{{"Tavily search"}}

node_user -->|"submits query"| node_api
node_api -->|"checks request"| node_guard
node_api -->|"invokes workflow"| node_graph
node_guard -->|"loads rules"| node_rules
node_graph -->|"starts at"| node_planner
node_graph -->|"routes docs"| node_retriever
node_graph -->|"routes web"| node_websearch
node_graph -->|"routes conversation"| node_responder
node_graph -->|"uses state"| node_state
node_retriever -->|"passes context"| node_responder
node_websearch -->|"passes results"| node_responder
node_retriever -->|"searches index"| node_vector
node_retriever -->|"reranks results"| node_ranker
node_vector -->|"embeds query"| node_embedding
node_websearch -->|"searches web"| node_tavily
node_planner -.->|"uses model"| node_gateway
node_responder -.->|"uses model"| node_gateway
node_gateway -->|"routes requests"| node_portkey
node_processor -->|"dispatches parsing"| node_loaders
node_processor -->|"chunks text"| node_chunker
node_processor -->|"embeds chunks"| node_embedding
node_processor -->|"upserts vectors"| node_vector
node_config -->|"configures access"| node_vector

click node_api "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/main.py"
click node_ui "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ui/streamlit_ui.py"
click node_guard "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/guardrails/rails.py"
click node_rules "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/guardrails/colang_rules.py"
click node_config "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/config.py"
click node_graph "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/graph.py"
click node_state "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/state.py"
click node_planner "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/planner.py"
click node_responder "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/responder.py"
click node_retriever "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/retriever.py"
click node_websearch "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/web_search.py"
click node_gateway "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/gateway/client.py"
click node_loaders "https://github.com/sahilshirodkar30/goaguide_ai/tree/main/app/ingestion/loaders"
click node_processor "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ingestion/processor.py"
click node_chunker "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ingestion/chunking/splitter.py"
click node_embedding "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/services/retrieval/embedding.py"
click node_vector "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/services/retrieval/pinecone_service.py"
click node_ranker "https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/services/retrieval/ranking_service.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,node_ui toneBlue
class node_graph,node_state,node_planner,node_responder,node_retriever,node_websearch,node_gateway toneAmber
class node_loaders,node_processor,node_chunker toneMint
class node_embedding,node_vector,node_ranker toneRose
class node_guard,node_rules,node_config,node_user,node_portkey,node_tavily toneIndigo
```

## Components

### API and UI

- [FastAPI service](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/main.py): `app/main.py`
- [Streamlit interface](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ui/streamlit_ui.py): `app/ui/streamlit_ui.py`

### Agent workflow

- [Workflow router](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/graph.py): `app/agents/graph.py`
- [Agent state](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/state.py): `app/agents/state.py`
- [Query planner](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/planner.py): `app/agents/nodes/planner.py`
- [Answer generator](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/responder.py): `app/agents/nodes/responder.py`
- [Knowledge retriever](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/retriever.py): `app/agents/nodes/retriever.py`
- [Web search](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/agents/nodes/web_search.py): `app/agents/nodes/web_search.py`
- [LLM gateway client](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/gateway/client.py): `app/gateway/client.py`

### Knowledge ingestion

- [Format loaders](https://github.com/sahilshirodkar30/goaguide_ai/tree/main/app/ingestion/loaders): `app/ingestion/loaders`
- [Ingestion processor](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ingestion/processor.py): `app/ingestion/processor.py`
- [Text chunker](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/ingestion/chunking/splitter.py): `app/ingestion/chunking/splitter.py`

### Retrieval services

- [Embedding service](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/services/retrieval/embedding.py): `app/services/retrieval/embedding.py`
- [Pinecone index](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/services/retrieval/pinecone_service.py): `app/services/retrieval/pinecone_service.py`
- [Semantic reranker](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/services/retrieval/ranking_service.py): `app/services/retrieval/ranking_service.py`

### Safety and configuration

- [Request guardrails](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/guardrails/rails.py): `app/guardrails/rails.py`
- [Colang rules](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/guardrails/colang_rules.py): `app/guardrails/colang_rules.py`
- [Runtime settings](https://github.com/sahilshirodkar30/goaguide_ai/blob/main/app/config.py): `app/config.py`

### Other components

- **Questioner**
- **Portkey gateway**
- **Tavily search**

## Connections

- Questioner → FastAPI service: submits query (evidence: `app/main.py`)
- FastAPI service → Request guardrails: checks request (evidence: `app/main.py`)
- FastAPI service → Workflow router: invokes workflow (evidence: `app/main.py`)
- Request guardrails → Colang rules: loads rules (evidence: `app/guardrails/rails.py`)
- Workflow router → Query planner: starts at (evidence: `app/agents/graph.py`)
- Workflow router → Knowledge retriever: routes docs (evidence: `app/agents/graph.py`)
- Workflow router → Web search: routes web (evidence: `app/agents/graph.py`)
- Workflow router → Answer generator: routes conversation (evidence: `app/agents/graph.py`)
- Workflow router → Agent state: uses state (evidence: `app/agents/graph.py`)
- Knowledge retriever → Answer generator: passes context (evidence: `app/agents/graph.py`)
- Web search → Answer generator: passes results (evidence: `app/agents/graph.py`)
- Knowledge retriever → Pinecone index: searches index (evidence: `app/agents/nodes/retriever.py`)
- Knowledge retriever → Semantic reranker: reranks results (evidence: `app/agents/nodes/retriever.py`)
- Pinecone index → Embedding service: embeds query (evidence: `app/services/retrieval/pinecone_service.py`)
- Web search → Tavily search: searches web (evidence: `app/agents/nodes/web_search.py`)
- Query planner → LLM gateway client: uses model (evidence: `app/agents/nodes/planner.py`)
- Answer generator → LLM gateway client: uses model (evidence: `app/agents/nodes/responder.py`)
- LLM gateway client → Portkey gateway: routes requests (evidence: `app/gateway/client.py`)
- Ingestion processor → Format loaders: dispatches parsing (evidence: `app/ingestion/processor.py`)
- Ingestion processor → Text chunker: chunks text (evidence: `app/ingestion/processor.py`)
- Ingestion processor → Embedding service: embeds chunks (evidence: `app/ingestion/processor.py`)
- Ingestion processor → Pinecone index: upserts vectors (evidence: `app/ingestion/processor.py`)
- Runtime settings → Pinecone index: configures access (evidence: `app/services/retrieval/pinecone_service.py`)
