# raghavaalajangi/pricepilot-ai architecture

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

- Interactive diagram: https://gitdiagram.com/raghavaalajangi/pricepilot-ai
- Repository: https://github.com/raghavaalajangi/pricepilot-ai

## Overview

PricePilot AI is a pricing decision-support application: users select a product and market, inspect sales KPIs and price-demand/profit estimates, then request a grounded AI recommendation with reviewer checks. The graph follows the documented frontend-to-REST workflow through pricing services, data/model layers, and the sequential agent pipeline. The README describes CSV/Postgres data sources, caching, guardrails, and streaming; their precise internal wiring is not fully present in the sampled source, so uncertain edges are omitted.

Main entry points: [`backend/app/api/routes.py`](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/api/routes.py) (REST routes), [`backend/app/services/agent_analysis.py`](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/services/agent_analysis.py) (Agent analysis service), [`backend/app/services/pricing.py`](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/services/pricing.py) (Pricing services), [`frontend/components/Dashboard.tsx`](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/Dashboard.tsx) (Product dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard UI"]
  node_dashboard["Product dashboard<br/>[Dashboard.tsx]"]
  node_agent_panel["Agent panel<br/>[AgentPanel.tsx]"]
  node_api_client["Typed API client<br/>[api.ts]"]
  node_charts["Pricing visualizations"]
end

subgraph group_api["Backend API"]
  node_routes["REST routes<br/>[routes.py]"]
  node_app["FastAPI application<br/>[main.py]"]
  node_schemas["Validated API schemas<br/>[schemas.py]"]
end

subgraph group_pricing["Pricing Analysis"]
  node_pricing_service["Pricing services<br/>[pricing.py]"]
end

subgraph group_agents["Agent Analysis"]
  node_agent_service["Agent analysis service<br/>[agent_analysis.py]"]
  node_agent_graph["Analyst strategist reviewer<br/>[graph.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_llm_client["Structured LLM client<br/>[llm_client.py]"]
  node_guardrails["Output guardrails<br/>[guardrails.py]"]
end

subgraph group_platform["Data And Models"]
  node_data_source["Sales data source<br/>[data_source.py]"]
  node_sales_data[("Sales dataset")]
  node_elasticity["Elasticity estimator<br/>[elasticity.py]"]
  node_model_weights[("Trained model weights<br/>[elasticity.py]")]
  node_cache[("TTL result cache<br/>[cache.py]")]
end

node_user(("Pricing team"))
node_llm_provider{{"OpenAI chat model"}}

node_user -->|"selects product"| node_dashboard
node_dashboard -->|"requests data"| node_api_client
node_agent_panel -->|"streams analysis"| node_api_client
node_api_client -->|"REST requests"| node_routes
node_routes -->|"calls pricing"| node_pricing_service
node_pricing_service -->|"reads sales"| node_data_source
node_data_source -->|"loads rows"| node_sales_data
node_pricing_service -->|"fits or loads"| node_elasticity
node_elasticity -->|"loads bundles"| node_model_weights
node_pricing_service -->|"returns results"| node_routes
node_routes -->|"starts analysis"| node_agent_service
node_agent_service -->|"builds analysis payload"| node_pricing_service
node_agent_service -->|"reads and writes"| node_cache
node_agent_service -->|"runs workflow"| node_agent_graph
node_agent_graph -->|"uses prompts"| node_prompts
node_agent_graph -->|"requests structured output"| node_llm_client
node_llm_client -->|"invokes model"| node_llm_provider
node_agent_service -->|"checks output"| node_guardrails
node_agent_service -->|"returns or streams"| node_routes
node_routes -->|"validates payloads"| node_schemas
node_routes -->|"registered by"| node_app
node_dashboard -->|"renders results"| node_charts
node_agent_panel -->|"shows recommendation"| node_user

click node_dashboard "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/Dashboard.tsx"
click node_agent_panel "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/AgentPanel.tsx"
click node_api_client "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/lib/api.ts"
click node_charts "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/ElasticitySection.tsx"
click node_routes "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/api/routes.py"
click node_app "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/main.py"
click node_pricing_service "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/services/pricing.py"
click node_agent_service "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/services/agent_analysis.py"
click node_agent_graph "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/agents/graph.py"
click node_prompts "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/agents/prompts.py"
click node_llm_client "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/agents/llm_client.py"
click node_guardrails "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/guardrails.py"
click node_data_source "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/data_source.py"
click node_elasticity "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/ml/elasticity.py"
click node_model_weights "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/ml/elasticity.py"
click node_cache "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/cache.py"
click node_schemas "https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/schemas.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_dashboard,node_agent_panel,node_api_client,node_charts toneBlue
class node_routes,node_app,node_schemas toneAmber
class node_pricing_service toneMint
class node_agent_service,node_agent_graph,node_prompts,node_llm_client,node_guardrails toneRose
class node_data_source,node_sales_data,node_elasticity,node_model_weights,node_cache,node_user,node_llm_provider toneIndigo
```

## Components

### Dashboard UI

- [Product dashboard](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/Dashboard.tsx): `frontend/components/Dashboard.tsx`
- [Agent panel](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/AgentPanel.tsx): `frontend/components/AgentPanel.tsx`
- [Typed API client](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Pricing visualizations](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/frontend/components/ElasticitySection.tsx): `frontend/components/ElasticitySection.tsx`

### Backend API

- [REST routes](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [FastAPI application](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Validated API schemas](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Pricing Analysis

- [Pricing services](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/services/pricing.py): `backend/app/services/pricing.py`

### Agent Analysis

- [Agent analysis service](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/services/agent_analysis.py): `backend/app/services/agent_analysis.py`
- [Analyst strategist reviewer](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/agents/graph.py): `backend/app/agents/graph.py`
- [Agent prompts](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/agents/prompts.py): `backend/app/agents/prompts.py`
- [Structured LLM client](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/agents/llm_client.py): `backend/app/agents/llm_client.py`
- [Output guardrails](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/guardrails.py): `backend/app/guardrails.py`

### Data And Models

- [Sales data source](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/data_source.py): `backend/app/data_source.py`
- **Sales dataset**
- [Elasticity estimator](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/ml/elasticity.py): `backend/app/ml/elasticity.py`
- [Trained model weights](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/ml/elasticity.py): `backend/app/ml/elasticity.py`
- [TTL result cache](https://github.com/raghavaalajangi/pricepilot-ai/blob/main/backend/app/cache.py): `backend/app/cache.py`

### Other components

- **Pricing team**
- **OpenAI chat model**

## Connections

- Pricing team → Product dashboard: selects product
- Product dashboard → Typed API client: requests data
- Agent panel → Typed API client: streams analysis
- Typed API client → REST routes: REST requests
- REST routes → Pricing services: calls pricing
- Pricing services → Sales data source: reads sales
- Sales data source → Sales dataset: loads rows
- Pricing services → Elasticity estimator: fits or loads
- Elasticity estimator → Trained model weights: loads bundles
- Pricing services → REST routes: returns results
- REST routes → Agent analysis service: starts analysis
- Agent analysis service → Pricing services: builds analysis payload
- Agent analysis service → TTL result cache: reads and writes
- Agent analysis service → Analyst strategist reviewer: runs workflow
- Analyst strategist reviewer → Agent prompts: uses prompts
- Analyst strategist reviewer → Structured LLM client: requests structured output
- Structured LLM client → OpenAI chat model: invokes model
- Agent analysis service → Output guardrails: checks output
- Agent analysis service → REST routes: returns or streams
- REST routes → Validated API schemas: validates payloads
- REST routes → FastAPI application: registered by
- Product dashboard → Pricing visualizations: renders results
- Agent panel → Pricing team: shows recommendation
