# tanishktewetia/pollpoint-qa-agent architecture

> Architecture diagram of the GitHub repository tanishktewetia/pollpoint-qa-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanishktewetia/pollpoint-qa-agent
- Repository: https://github.com/tanishktewetia/pollpoint-qa-agent

## Overview

PollPoint QA Agent is a scheduled and event-driven survey-testing product. Operators configure synthetic participant accounts in the dashboard; manual runs, schedules, and invitation-email handling feed a durable queue, whose worker runs a browser-backed LangGraph workflow through login, survey discovery, question answering, navigation, and submission. Results and activity are exposed through the API and dashboard. The graph preserves the documented retry and human-review capabilities. Edges follow excerpts, SOURCE INDEX references, or README statements; unsampled wiring is omitted where evidence is insufficient.

Main entry points: [`app/core/graph.py`](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/core/graph.py) (Survey state graph), [`app/browser/adapter.py`](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/browser/adapter.py) (Browser adapter), [`app/nodes/fill_answer.py`](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/fill_answer.py) (Fill answer), [`frontend/src/app/api/backend/[...path]/route.ts`](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/api/backend/%5B...path%5D/route.ts) (Backend proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Operator dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[page.tsx]"]
  node_account_ui["Account management<br/>[page.tsx]"]
  node_runs_ui["Run history<br/>[page.tsx]"]
  node_system_ui["System status<br/>[page.tsx]"]
  node_backend_proxy["Backend proxy<br/>[route.ts]"]
end

subgraph group_api["API and persistence"]
  node_api_process["FastAPI application<br/>[main.py]"]
  node_account_routes["Account routes<br/>[accounts.py]"]
  node_run_routes["Run routes<br/>[runs.py]"]
  node_system_routes["System routes<br/>[system.py]"]
  node_auth["API key auth<br/>[dependencies.py]"]
  node_account_schema["Account validation<br/>[account.py]"]
  node_storage["Supabase persistence<br/>[client.py]"]
end

subgraph group_runtime["Queue and orchestration"]
  node_scheduler["Worker scheduler<br/>[scheduler.py]"]
  node_email_workflow["Invitation email workflow<br/>[email_workflow.py]"]
  node_health["Worker health<br/>[health.py]"]
  node_pipeline["Run pipeline<br/>[survey_pipeline.py]"]
  node_graph{{"Survey state graph<br/>[graph.py]"}}
  node_events["Run activity events<br/>[run_events.py]"]
end

subgraph group_survey["Survey execution"]
  node_browser["Browser adapter<br/>[adapter.py]"]
  node_load_account["Load participant<br/>[load_account.py]"]
  node_open_survey["Open survey<br/>[open_survey.py]"]
  node_extract_question["Extract question"]
  node_check_next["Navigate or finish<br/>[check_next.py]"]
  node_submit_survey["Submit survey<br/>[submit_survey.py]"]
end

subgraph group_answering["Answering services"]
  node_generate_answer["Generate answer<br/>[generate_answer.py]"]
  node_fill_answer["Fill answer<br/>[fill_answer.py]"]
  node_answering_service["Answering service<br/>[answering.py]"]
  node_knowledge_base["Verified answers<br/>[knowledge_base.py]"]
  node_fallback["Random fallback<br/>[random_fallback.py]"]
end

node_operator(("Operator"))
node_postgres[("PostgreSQL queue and data")]
node_target_site["PollPoint test site"]
node_llm["Gemini model"]

node_operator -->|"operates"| node_dashboard_ui
node_dashboard_ui -->|"requests API"| node_backend_proxy
node_account_ui -->|"manages accounts"| node_backend_proxy
node_runs_ui -->|"views runs"| node_backend_proxy
node_system_ui -->|"checks status"| node_backend_proxy
node_backend_proxy -->|"forwards requests"| node_api_process
node_api_process -->|"mounts routes"| node_account_routes
node_api_process -->|"mounts routes"| node_run_routes
node_api_process -->|"mounts routes"| node_system_routes
node_account_routes -->|"authenticates"| node_auth
node_run_routes -->|"authenticates"| node_auth
node_system_routes -->|"authenticates"| node_auth
node_account_routes -->|"validates accounts"| node_account_schema
node_account_routes -->|"reads and writes"| node_storage
node_run_routes -->|"queues and reads runs"| node_storage
node_system_routes -->|"checks database"| node_storage
node_storage -->|"persists queue and records"| node_postgres
node_scheduler -->|"claims and enqueues"| node_storage
node_scheduler -->|"checks invitations"| node_email_workflow
node_scheduler -->|"runs survey workflow"| node_pipeline
node_scheduler -->|"reports health"| node_health
node_pipeline -->|"streams graph"| node_graph
node_graph -->|"dispatches"| node_load_account
node_graph -->|"dispatches"| node_open_survey
node_graph -->|"dispatches"| node_extract_question
node_graph -->|"dispatches"| node_generate_answer
node_graph -->|"dispatches"| node_fill_answer
node_graph -->|"dispatches"| node_check_next
node_graph -->|"dispatches"| node_submit_survey
node_load_account -.->|"prepares session"| node_browser
node_open_survey -->|"controls browser"| node_browser
node_extract_question -.->|"reads page"| node_browser
node_check_next -->|"inspects navigation"| node_browser
node_fill_answer -->|"fills response"| node_browser
node_submit_survey -.->|"submits response"| node_browser
node_browser -->|"drives headless browser"| node_target_site
node_generate_answer -.->|"requests answer"| node_answering_service
node_fill_answer -->|"requests correction"| node_answering_service
node_fill_answer -->|"updates reusable answers"| node_knowledge_base
node_fill_answer -->|"selects fallback"| node_fallback
node_answering_service -->|"generates response"| node_llm
node_pipeline -.->|"records activity"| node_events
node_pipeline -->|"owns browser lifetime"| node_browser

click node_dashboard_ui "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/page.tsx"
click node_account_ui "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/accounts/page.tsx"
click node_runs_ui "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/runs/page.tsx"
click node_system_ui "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/system/page.tsx"
click node_backend_proxy "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/api/backend/%5B...path%5D/route.ts"
click node_api_process "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/main.py"
click node_account_routes "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/api/routes/accounts.py"
click node_run_routes "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/api/routes/runs.py"
click node_system_routes "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/api/routes/system.py"
click node_auth "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/auth/dependencies.py"
click node_account_schema "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/schemas/account.py"
click node_storage "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/supabase/client.py"
click node_scheduler "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/workers/scheduler.py"
click node_email_workflow "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/email_workflow.py"
click node_health "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/workers/health.py"
click node_pipeline "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/pipelines/survey_pipeline.py"
click node_graph "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/core/graph.py"
click node_browser "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/browser/adapter.py"
click node_load_account "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/load_account.py"
click node_open_survey "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/open_survey.py"
click node_extract_question "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/extract_question.py"
click node_check_next "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/check_next.py"
click node_submit_survey "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/submit_survey.py"
click node_generate_answer "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/generate_answer.py"
click node_fill_answer "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/fill_answer.py"
click node_answering_service "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/answering.py"
click node_knowledge_base "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/knowledge_base.py"
click node_fallback "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/random_fallback.py"
click node_events "https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/core/run_events.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_ui,node_account_ui,node_runs_ui,node_system_ui,node_backend_proxy toneBlue
class node_api_process,node_account_routes,node_run_routes,node_system_routes,node_auth,node_account_schema,node_storage,node_postgres toneAmber
class node_scheduler,node_email_workflow,node_health,node_pipeline,node_graph,node_events toneMint
class node_browser,node_load_account,node_open_survey,node_extract_question,node_check_next,node_submit_survey toneRose
class node_generate_answer,node_fill_answer,node_answering_service,node_knowledge_base,node_fallback,node_operator,node_target_site,node_llm toneIndigo
```

## Components

### Operator dashboard

- [Dashboard UI](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Account management](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/accounts/page.tsx): `frontend/src/app/accounts/page.tsx`
- [Run history](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/runs/page.tsx): `frontend/src/app/runs/page.tsx`
- [System status](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/system/page.tsx): `frontend/src/app/system/page.tsx`
- [Backend proxy](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/frontend/src/app/api/backend/%5B...path%5D/route.ts): `frontend/src/app/api/backend/[...path]/route.ts`

### API and persistence

- [FastAPI application](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/main.py): `main.py`
- [Account routes](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/api/routes/accounts.py): `app/api/routes/accounts.py`
- [Run routes](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/api/routes/runs.py): `app/api/routes/runs.py`
- [System routes](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/api/routes/system.py): `app/api/routes/system.py`
- [API key auth](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/auth/dependencies.py): `app/auth/dependencies.py`
- [Account validation](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/schemas/account.py): `app/schemas/account.py`
- [Supabase persistence](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/supabase/client.py): `app/services/supabase/client.py`

### Queue and orchestration

- [Worker scheduler](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/workers/scheduler.py): `app/workers/scheduler.py`
- [Invitation email workflow](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/email_workflow.py): `app/services/email_workflow.py`
- [Worker health](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/workers/health.py): `app/workers/health.py`
- [Run pipeline](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/pipelines/survey_pipeline.py): `app/pipelines/survey_pipeline.py`
- [Survey state graph](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/core/graph.py): `app/core/graph.py`
- [Run activity events](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/core/run_events.py): `app/core/run_events.py`

### Survey execution

- [Browser adapter](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/browser/adapter.py): `app/browser/adapter.py`
- [Load participant](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/load_account.py): `app/nodes/load_account.py`
- [Open survey](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/open_survey.py): `app/nodes/open_survey.py`
- [Extract question](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/extract_question.py): `app/nodes/extract_question.py`
- [Navigate or finish](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/check_next.py): `app/nodes/check_next.py`
- [Submit survey](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/submit_survey.py): `app/nodes/submit_survey.py`

### Answering services

- [Generate answer](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/generate_answer.py): `app/nodes/generate_answer.py`
- [Fill answer](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/nodes/fill_answer.py): `app/nodes/fill_answer.py`
- [Answering service](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/answering.py): `app/services/answering.py`
- [Verified answers](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/knowledge_base.py): `app/services/knowledge_base.py`
- [Random fallback](https://github.com/tanishktewetia/pollpoint-qa-agent/blob/main/app/services/random_fallback.py): `app/services/random_fallback.py`

### Other components

- **Operator**
- **PostgreSQL queue and data**
- **PollPoint test site**
- **Gemini model**

## Connections

- Operator → Dashboard UI: operates
- Dashboard UI → Backend proxy: requests API
- Account management → Backend proxy: manages accounts
- Run history → Backend proxy: views runs
- System status → Backend proxy: checks status
- Backend proxy → FastAPI application: forwards requests
- FastAPI application → Account routes: mounts routes (evidence: `main.py`)
- FastAPI application → Run routes: mounts routes (evidence: `main.py`)
- FastAPI application → System routes: mounts routes (evidence: `main.py`)
- Account routes → API key auth: authenticates (evidence: `app/api/routes/accounts.py`)
- Run routes → API key auth: authenticates (evidence: `app/api/routes/runs.py`)
- System routes → API key auth: authenticates (evidence: `app/auth/dependencies.py`)
- Account routes → Account validation: validates accounts (evidence: `app/api/routes/accounts.py`)
- Account routes → Supabase persistence: reads and writes (evidence: `app/api/routes/accounts.py`)
- Run routes → Supabase persistence: queues and reads runs (evidence: `app/api/routes/runs.py`)
- System routes → Supabase persistence: checks database (evidence: `app/api/routes/system.py`)
- Supabase persistence → PostgreSQL queue and data: persists queue and records
- Worker scheduler → Supabase persistence: claims and enqueues (evidence: `app/workers/scheduler.py`)
- Worker scheduler → Invitation email workflow: checks invitations (evidence: `app/workers/scheduler.py`)
- Worker scheduler → Run pipeline: runs survey workflow (evidence: `app/workers/scheduler.py`)
- Worker scheduler → Worker health: reports health (evidence: `app/workers/scheduler.py`)
- Run pipeline → Survey state graph: streams graph (evidence: `app/pipelines/survey_pipeline.py`)
- Survey state graph → Load participant: dispatches (evidence: `app/core/graph.py`)
- Survey state graph → Open survey: dispatches (evidence: `app/core/graph.py`)
- Survey state graph → Extract question: dispatches (evidence: `app/core/graph.py`)
- Survey state graph → Generate answer: dispatches (evidence: `app/core/graph.py`)
- Survey state graph → Fill answer: dispatches (evidence: `app/core/graph.py`)
- Survey state graph → Navigate or finish: dispatches (evidence: `app/core/graph.py`)
- Survey state graph → Submit survey: dispatches (evidence: `app/core/graph.py`)
- Load participant → Browser adapter: prepares session
- Open survey → Browser adapter: controls browser (evidence: `app/browser/adapter.py`)
- Extract question → Browser adapter: reads page
- Navigate or finish → Browser adapter: inspects navigation (evidence: `app/nodes/check_next.py`)
- Fill answer → Browser adapter: fills response (evidence: `app/nodes/fill_answer.py`)
- Submit survey → Browser adapter: submits response
- Browser adapter → PollPoint test site: drives headless browser
- Generate answer → Answering service: requests answer
- Fill answer → Answering service: requests correction (evidence: `app/nodes/fill_answer.py`)
- Fill answer → Verified answers: updates reusable answers (evidence: `app/nodes/fill_answer.py`)
- Fill answer → Random fallback: selects fallback (evidence: `app/nodes/fill_answer.py`)
- Answering service → Gemini model: generates response (evidence: `app/services/answering.py`)
- Run pipeline → Run activity events: records activity (evidence: `app/pipelines/survey_pipeline.py`)
- Run pipeline → Browser adapter: owns browser lifetime (evidence: `app/pipelines/survey_pipeline.py`)
