# rahul-bijarniya-1/embedded-agent architecture

> Architecture diagram of the GitHub repository rahul-bijarniya-1/embedded-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahul-bijarniya-1/embedded-agent
- Repository: https://github.com/rahul-bijarniya-1/embedded-agent

## Overview

GoodScore E-Agent grounds chat answers, summaries, and spoken explanations in data already displayed in the browser. The main flow is page data and user input → HTTP validation and rate limiting → computed context and a grounded prompt → Gemini text generation → cleaned response; speech uses a separate synthesis path with browser-voice fallback. The README documents the main lifecycle and capabilities. Several backend modules were not sampled, so their internal call relationships are shown only where the README explicitly describes them.

Main entry points: [`embedded-agent-be/agent/router.py`](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/router.py) (HTTP routes), [`embedded-agent-fe/agent.js`](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/agent.js) (Chat and explain UI), [`embedded-agent-be/agent/assistant.py`](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/assistant.py) (Assistant orchestration), [`embedded-agent-fe/index.html`](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/index.html) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_dashboard["Dashboard<br/>[index.html]"]
  node_credit["Credit details<br/>[credit.html]"]
  node_transactions["Transactions<br/>[transactions.html]"]
  node_loan_details["Loan details<br/>[loan-details.html]"]
  node_web_agent["Chat and explain UI<br/>[agent.js]"]
end

subgraph group_http["HTTP and mock data"]
  node_api["HTTP routes<br/>[router.py]"]
  node_mock_api["Mock data API<br/>[server.py]"]
  node_limiter["Rate limiter<br/>[limiter.py]"]
end

subgraph group_answer["Grounded answers"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_assistant["Assistant orchestration<br/>[assistant.py]"]
  node_context["Page context<br/>[context.py]"]
  node_money["Money calculations<br/>[money.py]"]
  node_prompts["Grounded prompts<br/>[prompts.py]"]
  node_cache["Response cache<br/>[cache.py]"]
  node_llm["Gemini text client<br/>[llm.py]"]
end

subgraph group_speech["Speech and operations"]
  node_observability["Request observability<br/>[observability.py]"]
  node_config["Agent settings<br/>[config.py]"]
  node_tts["Speech synthesis<br/>[tts.py]"]
end

node_user(("User"))
node_vertex{{"Vertex AI Gemini"}}
node_browser_voice{{"Browser voice"}}

node_user -->|"uses"| node_dashboard
node_user -->|"uses"| node_credit
node_user -->|"uses"| node_transactions
node_user -->|"uses"| node_loan_details
node_dashboard -->|"mounts explain"| node_web_agent
node_credit -->|"mounts explain"| node_web_agent
node_transactions -->|"mounts chat"| node_web_agent
node_loan_details -->|"mounts chat"| node_web_agent
node_web_agent -->|"posts actions"| node_api
node_api -->|"rate limits"| node_limiter
node_api -->|"validates requests"| node_schemas
node_api -->|"dispatches actions"| node_assistant
node_assistant -->|"builds context"| node_context
node_context -->|"computes facts"| node_money
node_assistant -->|"builds prompt"| node_prompts
node_assistant -->|"checks cache"| node_cache
node_assistant -->|"calls model"| node_llm
node_llm -->|"generates text"| node_vertex
node_assistant -->|"synthesizes speech"| node_tts
node_tts -->|"generates audio"| node_vertex
node_web_agent -.->|"fallback speech"| node_browser_voice
node_web_agent -->|"requests audio"| node_api
node_observability -->|"adds request IDs"| node_api
node_mock_api -.->|"serves alongside"| node_api
node_config -->|"configures service"| node_api

click node_dashboard "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/index.html"
click node_credit "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/credit.html"
click node_transactions "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/transactions.html"
click node_loan_details "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/loan-details.html"
click node_web_agent "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/agent.js"
click node_api "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/router.py"
click node_mock_api "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/server.py"
click node_schemas "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/schemas.py"
click node_assistant "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/assistant.py"
click node_context "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/context.py"
click node_money "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/money.py"
click node_prompts "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/prompts.py"
click node_cache "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/cache.py"
click node_llm "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/llm.py"
click node_limiter "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/limiter.py"
click node_observability "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/observability.py"
click node_config "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/config.py"
click node_tts "https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/tts.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_credit,node_transactions,node_loan_details,node_web_agent,node_user,node_browser_voice toneBlue
class node_api,node_mock_api,node_limiter toneAmber
class node_schemas,node_assistant,node_context,node_money,node_prompts,node_cache,node_llm toneMint
class node_observability,node_config,node_tts toneRose
class node_vertex toneIndigo
```

## Components

### Browser experience

- [Dashboard](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/index.html): `embedded-agent-fe/index.html`
- [Credit details](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/credit.html): `embedded-agent-fe/credit.html`
- [Transactions](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/transactions.html): `embedded-agent-fe/transactions.html`
- [Loan details](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/loan-details.html): `embedded-agent-fe/loan-details.html`
- [Chat and explain UI](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-fe/agent.js): `embedded-agent-fe/agent.js`

### HTTP and mock data

- [HTTP routes](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/router.py): `embedded-agent-be/agent/router.py`
- [Mock data API](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/server.py): `embedded-agent-be/server.py`
- [Rate limiter](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/limiter.py): `embedded-agent-be/agent/limiter.py`

### Grounded answers

- [Request schemas](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/schemas.py): `embedded-agent-be/agent/schemas.py`
- [Assistant orchestration](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/assistant.py): `embedded-agent-be/agent/assistant.py`
- [Page context](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/context.py): `embedded-agent-be/agent/context.py`
- [Money calculations](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/money.py): `embedded-agent-be/agent/money.py`
- [Grounded prompts](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/prompts.py): `embedded-agent-be/agent/prompts.py`
- [Response cache](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/cache.py): `embedded-agent-be/agent/cache.py`
- [Gemini text client](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/llm.py): `embedded-agent-be/agent/llm.py`

### Speech and operations

- [Request observability](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/observability.py): `embedded-agent-be/agent/observability.py`
- [Agent settings](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/config.py): `embedded-agent-be/agent/config.py`
- [Speech synthesis](https://github.com/rahul-bijarniya-1/embedded-agent/blob/assignment/rahul/embedded-agent-be/agent/tts.py): `embedded-agent-be/agent/tts.py`

### Other components

- **User**
- **Vertex AI Gemini**
- **Browser voice**

## Connections

- User → Dashboard: uses (evidence: `README.md`)
- User → Credit details: uses (evidence: `README.md`)
- User → Transactions: uses (evidence: `README.md`)
- User → Loan details: uses (evidence: `README.md`)
- Dashboard → Chat and explain UI: mounts explain (evidence: `README.md`)
- Credit details → Chat and explain UI: mounts explain (evidence: `README.md`)
- Transactions → Chat and explain UI: mounts chat (evidence: `README.md`)
- Loan details → Chat and explain UI: mounts chat (evidence: `README.md`)
- Chat and explain UI → HTTP routes: posts actions (evidence: `README.md`)
- HTTP routes → Rate limiter: rate limits (evidence: `embedded-agent-be/agent/router.py`)
- HTTP routes → Request schemas: validates requests (evidence: `README.md`)
- HTTP routes → Assistant orchestration: dispatches actions (evidence: `README.md`)
- Assistant orchestration → Page context: builds context (evidence: `README.md`)
- Page context → Money calculations: computes facts (evidence: `README.md`)
- Assistant orchestration → Grounded prompts: builds prompt (evidence: `README.md`)
- Assistant orchestration → Response cache: checks cache (evidence: `README.md`)
- Assistant orchestration → Gemini text client: calls model (evidence: `README.md`)
- Gemini text client → Vertex AI Gemini: generates text (evidence: `README.md`)
- Assistant orchestration → Speech synthesis: synthesizes speech (evidence: `README.md`)
- Speech synthesis → Vertex AI Gemini: generates audio (evidence: `embedded-agent-be/agent/tts.py`)
- Chat and explain UI → Browser voice: fallback speech (evidence: `README.md`)
- Chat and explain UI → HTTP routes: requests audio (evidence: `embedded-agent-fe/agent.js`)
- Request observability → HTTP routes: adds request IDs (evidence: `embedded-agent-be/server.py`)
- Mock data API → HTTP routes: serves alongside (evidence: `README.md`)
- Agent settings → HTTP routes: configures service (evidence: `embedded-agent-be/server.py`)
