# kvkrpm/ai-multi-agent-referral-orchestration-system architecture

> Architecture diagram of the GitHub repository kvkrpm/ai-multi-agent-referral-orchestration-system, 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/kvkrpm/ai-multi-agent-referral-orchestration-system
- Repository: https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system

## Overview

ConfidenceReach is a LinkedIn outreach assistant: users submit job and recruiter context, then receive evidence-backed, confidence-focused message drafts. The documented workflow runs research, profile analysis, personalization, drafting, tone review with possible retries, and delivery. The Streamlit UI uses FastAPI; the LangGraph pipeline owns stage routing and reports progress to persistence. The README also documents provider fallbacks, BYOK, history, feedback, status polling, and streaming. Some subsystem links rely on README statements or indexed references; unsampled implementation details are not assumed.

Main entry points: [`graph/nodes.py`](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/nodes.py) (Stage node adapters), [`backend/llm/llm_router.py`](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/llm/llm_router.py) (LLM provider router), [`frontend/pages/1_home.py`](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/pages/1_home.py) (Generate and review), [`graph/pipeline.py`](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/pipeline.py) (LangGraph runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User interface"]
  node_frontend["Streamlit interface<br/>[app.py]"]
  node_home["Generate and review<br/>[1_home.py]"]
  node_dashboard["Message history<br/>[2_dashboard.py]"]
  node_draft["Message draft UI<br/>[message_draft.py]"]
  node_progress["Agent progress UI<br/>[agent_progress.py]"]
  node_feedback["Feedback UI<br/>[feedback.py]"]
end

subgraph group_service["API and workflow"]
  node_api["FastAPI routes<br/>[routes.py]"]
  node_graph["LangGraph runner<br/>[pipeline.py]"]
  node_graph_nodes["Stage node adapters<br/>[nodes.py]"]
  node_state["Pipeline state<br/>[state.py]"]
end

subgraph group_agents["Outreach agents"]
  node_research["Research<br/>[a1_research.py]"]
  node_analysis["Profile analysis"]
  node_personalize["Confidence coaching<br/>[a3_personalizer.py]"]
  node_craft["Message variants"]
  node_review["Tone review"]
  node_delivery["Final delivery<br/>[a6_delivery.py]"]
end

subgraph group_platform["Models and persistence"]
  node_scraper["Job profile scraping<br/>[scraper.py]"]
  node_llm["LLM provider router<br/>[llm_router.py]"]
  node_store[("Message database<br/>[database.py]")]
  node_queries["Persistence queries<br/>[queries.py]"]
end

node_user(("Outreach user"))
node_providers{{"LLM providers"}}
node_web{{"Job and LinkedIn sites"}}

node_user -->|"submits context"| node_frontend
node_frontend -->|"opens workflow"| node_home
node_home -->|"requests generation"| node_api
node_home -->|"renders drafts"| node_draft
node_home -->|"shows progress"| node_progress
node_home -->|"collects feedback"| node_feedback
node_user -->|"views history"| node_dashboard
node_dashboard -->|"requests history"| node_api
node_api -->|"runs pipeline"| node_graph
node_api -->|"reads and updates"| node_queries
node_graph -->|"dispatches stages"| node_graph_nodes
node_graph -->|"uses state"| node_state
node_graph -->|"updates progress"| node_queries
node_graph_nodes -->|"invokes"| node_research
node_graph_nodes -->|"invokes"| node_analysis
node_graph_nodes -->|"invokes"| node_personalize
node_graph_nodes -->|"invokes"| node_craft
node_graph_nodes -->|"invokes"| node_review
node_graph_nodes -->|"invokes"| node_delivery
node_research -->|"scrapes context"| node_scraper
node_scraper -->|"fetches pages"| node_web
node_research -->|"extracts context"| node_llm
node_analysis -->|"analyzes profile"| node_llm
node_personalize -->|"reframes evidence"| node_llm
node_craft -->|"creates variants"| node_llm
node_review -->|"scores drafts"| node_llm
node_delivery -->|"formats output"| node_llm
node_llm -->|"routes requests"| node_providers
node_queries -->|"reads and writes"| node_store

click node_frontend "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/app.py"
click node_home "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/pages/1_home.py"
click node_dashboard "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/pages/2_dashboard.py"
click node_draft "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/components/message_draft.py"
click node_progress "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/components/agent_progress.py"
click node_feedback "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/components/feedback.py"
click node_api "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/api/routes.py"
click node_graph "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/pipeline.py"
click node_graph_nodes "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/nodes.py"
click node_state "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/state.py"
click node_research "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a1_research.py"
click node_analysis "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a2_profile_analyzer.py"
click node_personalize "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a3_personalizer.py"
click node_craft "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a4_message_crafter.py"
click node_review "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a5_tone_reviewer.py"
click node_delivery "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a6_delivery.py"
click node_scraper "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/core/scraper.py"
click node_llm "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/llm/llm_router.py"
click node_store "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/db/database.py"
click node_queries "https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/db/queries.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_frontend,node_home,node_dashboard,node_draft,node_progress,node_feedback,node_user toneBlue
class node_api,node_graph,node_graph_nodes,node_state toneAmber
class node_research,node_analysis,node_personalize,node_craft,node_review,node_delivery toneMint
class node_scraper,node_llm,node_store,node_queries toneRose
class node_providers,node_web toneIndigo
```

## Components

### User interface

- [Streamlit interface](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/app.py): `frontend/app.py`
- [Generate and review](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/pages/1_home.py): `frontend/pages/1_home.py`
- [Message history](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/pages/2_dashboard.py): `frontend/pages/2_dashboard.py`
- [Message draft UI](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/components/message_draft.py): `frontend/components/message_draft.py`
- [Agent progress UI](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/components/agent_progress.py): `frontend/components/agent_progress.py`
- [Feedback UI](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/frontend/components/feedback.py): `frontend/components/feedback.py`

### API and workflow

- [FastAPI routes](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/api/routes.py): `api/routes.py`
- [LangGraph runner](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/pipeline.py): `graph/pipeline.py`
- [Stage node adapters](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/nodes.py): `graph/nodes.py`
- [Pipeline state](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/graph/state.py): `graph/state.py`

### Outreach agents

- [Research](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a1_research.py): `backend/agents/a1_research.py`
- [Profile analysis](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a2_profile_analyzer.py): `backend/agents/a2_profile_analyzer.py`
- [Confidence coaching](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a3_personalizer.py): `backend/agents/a3_personalizer.py`
- [Message variants](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a4_message_crafter.py): `backend/agents/a4_message_crafter.py`
- [Tone review](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a5_tone_reviewer.py): `backend/agents/a5_tone_reviewer.py`
- [Final delivery](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/agents/a6_delivery.py): `backend/agents/a6_delivery.py`

### Models and persistence

- [Job profile scraping](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/core/scraper.py): `core/scraper.py`
- [LLM provider router](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/backend/llm/llm_router.py): `backend/llm/llm_router.py`
- [Message database](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/db/database.py): `db/database.py`
- [Persistence queries](https://github.com/kvkrpm/ai-multi-agent-referral-orchestration-system/blob/main/db/queries.py): `db/queries.py`

### Other components

- **Outreach user**
- **LLM providers**
- **Job and LinkedIn sites**

## Connections

- Outreach user → Streamlit interface: submits context
- Streamlit interface → Generate and review: opens workflow (evidence: `frontend/app.py`)
- Generate and review → FastAPI routes: requests generation
- Generate and review → Message draft UI: renders drafts (evidence: `frontend/pages/1_home.py`)
- Generate and review → Agent progress UI: shows progress (evidence: `frontend/pages/1_home.py`)
- Generate and review → Feedback UI: collects feedback (evidence: `frontend/pages/1_home.py`)
- Outreach user → Message history: views history
- Message history → FastAPI routes: requests history
- FastAPI routes → LangGraph runner: runs pipeline (evidence: `api/routes.py`)
- FastAPI routes → Persistence queries: reads and updates (evidence: `api/routes.py`)
- LangGraph runner → Stage node adapters: dispatches stages (evidence: `graph/pipeline.py`)
- LangGraph runner → Pipeline state: uses state (evidence: `graph/pipeline.py`)
- LangGraph runner → Persistence queries: updates progress (evidence: `graph/pipeline.py`)
- Stage node adapters → Research: invokes (evidence: `graph/nodes.py`)
- Stage node adapters → Profile analysis: invokes (evidence: `graph/nodes.py`)
- Stage node adapters → Confidence coaching: invokes (evidence: `graph/nodes.py`)
- Stage node adapters → Message variants: invokes (evidence: `graph/nodes.py`)
- Stage node adapters → Tone review: invokes (evidence: `graph/nodes.py`)
- Stage node adapters → Final delivery: invokes (evidence: `graph/nodes.py`)
- Research → Job profile scraping: scrapes context (evidence: `backend/agents/a1_research.py`)
- Job profile scraping → Job and LinkedIn sites: fetches pages
- Research → LLM provider router: extracts context
- Profile analysis → LLM provider router: analyzes profile
- Confidence coaching → LLM provider router: reframes evidence
- Message variants → LLM provider router: creates variants
- Tone review → LLM provider router: scores drafts
- Final delivery → LLM provider router: formats output
- LLM provider router → LLM providers: routes requests (evidence: `backend/llm/llm_router.py`)
- Persistence queries → Message database: reads and writes (evidence: `db/queries.py`)
