# thenithin342/agentflow architecture

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

- Interactive diagram: https://gitdiagram.com/thenithin342/agentflow
- Repository: https://github.com/thenithin342/agentflow

## Overview

AgentFlow is a full-stack, stateful knowledge assistant. Users authenticate, submit a thread-scoped question, and receive streamed agent activity and a final answer; optional review pauses the response for approval or editing. The backend routes work among research, analysis, chat, and blog generation, with synthesis, PDF retrieval, durable graph state, and long-term memory capabilities. The React client also supports uploads, thread management, and administration. Several subsystem details are documented in the README but their implementation excerpts were not sampled, so those paths and links are limited to evidence available here.

Main entry points: [`backend/graph/build_graph.py`](https://github.com/thenithin342/agentflow/blob/main/backend/graph/build_graph.py) (Workflow graph), [`frontend/src/App.jsx`](https://github.com/thenithin342/agentflow/blob/main/frontend/src/App.jsx) (Chat interface), [`backend/main.py`](https://github.com/thenithin342/agentflow/blob/main/backend/main.py) (FastAPI application), [`backend/rag/ingest.py`](https://github.com/thenithin342/agentflow/blob/main/backend/rag/ingest.py) (PDF ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User experience"]
  node_app["Chat interface<br/>[App.jsx]"]
  node_stream_hook["SSE handling<br/>[useSSE.js]"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_api["API and access"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_chat_route["Chat endpoint<br/>[chat.py]"]
  node_upload_route["Upload endpoint<br/>[upload.py]"]
  node_threads_route["Thread endpoints<br/>[threads.py]"]
  node_admin_route["Administration<br/>[admin.py]"]
  node_settings["Runtime settings<br/>[settings.py]"]
end

subgraph group_agent["Agent workflow"]
  node_router["Intent router<br/>[router.py]"]
  node_graph["Workflow graph<br/>[build_graph.py]"]
  node_agents["Specialist agents<br/>[agents.py]"]
  node_blog["Blog writer<br/>[blog_agent.py]"]
  node_synth["Response synthesis<br/>[synthesizer.py]"]
  node_review["Human review<br/>[human_review.py]"]
  node_llm["LLM providers<br/>[llm.py]"]
  node_tools["Agent tools<br/>[tools.py]"]
end

subgraph group_knowledge["Knowledge and state"]
  node_ingest["PDF ingestion<br/>[ingest.py]"]
  node_vector[("Vector store<br/>[qdrant_store.py]")]
  node_ltm["Long-term memory<br/>[ltm.py]"]
  node_stm["Short-term memory<br/>[stm.py]"]
  node_checkpoints[("Graph checkpoints<br/>[main.py]")]
end

subgraph group_quality["Evaluation"]
  node_eval_harness["Offline evaluation<br/>[run_offline.py]"]
  node_judge["LLM judge<br/>[llm_judge.py]"]
end

node_person(("User"))

node_person -->|"uses"| node_app
node_app -->|"requests"| node_api_client
node_api_client -->|"calls API"| node_backend
node_backend -->|"registers routes"| node_chat_route
node_backend -->|"opens checkpoint store"| node_checkpoints
node_backend -->|"bootstraps access"| node_auth
node_chat_route -->|"streams graph"| node_graph
node_chat_route -->|"resumes review"| node_review
node_graph -->|"dispatches"| node_router
node_graph -->|"routes specialist work"| node_agents
node_graph -->|"routes blog work"| node_blog
node_graph -->|"synthesizes output"| node_synth
node_graph -->|"gates response"| node_review
node_router -->|"classifies with"| node_llm
node_agents -.->|"uses tools"| node_tools
node_agents -->|"retrieves documents"| node_ingest
node_tools -->|"retrieves documents"| node_ingest
node_upload_route -->|"ingests PDFs"| node_ingest
node_ingest -->|"stores chunks"| node_vector
node_graph -->|"memory nodes"| node_ltm
node_ltm -->|"uses store"| node_vector
node_graph -.->|"uses conversation memory"| node_stm
node_threads_route -->|"manages thread data"| node_ingest
node_app -->|"streams chat"| node_stream_hook
node_stream_hook -->|"sends chat request"| node_api_client
node_app -->|"uploads PDFs"| node_upload_route
node_app -->|"manages threads"| node_threads_route
node_app -->|"opens admin"| node_admin_route
node_eval_harness -->|"scores answers"| node_judge
node_backend -->|"loads configuration"| node_settings
node_llm -->|"loads provider config"| node_settings

click node_app "https://github.com/thenithin342/agentflow/blob/main/frontend/src/App.jsx"
click node_stream_hook "https://github.com/thenithin342/agentflow/blob/main/frontend/src/hooks/useSSE.js"
click node_api_client "https://github.com/thenithin342/agentflow/blob/main/frontend/src/api/client.js"
click node_backend "https://github.com/thenithin342/agentflow/blob/main/backend/main.py"
click node_auth "https://github.com/thenithin342/agentflow/blob/main/backend/auth.py"
click node_chat_route "https://github.com/thenithin342/agentflow/blob/main/backend/routers/chat.py"
click node_upload_route "https://github.com/thenithin342/agentflow/blob/main/backend/routers/upload.py"
click node_threads_route "https://github.com/thenithin342/agentflow/blob/main/backend/routers/threads.py"
click node_admin_route "https://github.com/thenithin342/agentflow/blob/main/backend/routers/admin.py"
click node_router "https://github.com/thenithin342/agentflow/blob/main/backend/graph/router.py"
click node_graph "https://github.com/thenithin342/agentflow/blob/main/backend/graph/build_graph.py"
click node_agents "https://github.com/thenithin342/agentflow/blob/main/backend/graph/agents.py"
click node_blog "https://github.com/thenithin342/agentflow/blob/main/backend/graph/blog_agent.py"
click node_synth "https://github.com/thenithin342/agentflow/blob/main/backend/graph/synthesizer.py"
click node_review "https://github.com/thenithin342/agentflow/blob/main/backend/graph/human_review.py"
click node_llm "https://github.com/thenithin342/agentflow/blob/main/backend/llm.py"
click node_tools "https://github.com/thenithin342/agentflow/blob/main/backend/graph/tools.py"
click node_ingest "https://github.com/thenithin342/agentflow/blob/main/backend/rag/ingest.py"
click node_vector "https://github.com/thenithin342/agentflow/blob/main/backend/vectorstore/qdrant_store.py"
click node_ltm "https://github.com/thenithin342/agentflow/blob/main/backend/memory/ltm.py"
click node_stm "https://github.com/thenithin342/agentflow/blob/main/backend/memory/stm.py"
click node_checkpoints "https://github.com/thenithin342/agentflow/blob/main/backend/main.py"
click node_eval_harness "https://github.com/thenithin342/agentflow/blob/main/evals/harness/run_offline.py"
click node_judge "https://github.com/thenithin342/agentflow/blob/main/evals/harness/llm_judge.py"
click node_settings "https://github.com/thenithin342/agentflow/blob/main/backend/settings.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_app,node_stream_hook,node_api_client,node_person toneBlue
class node_backend,node_auth,node_chat_route,node_upload_route,node_threads_route,node_admin_route,node_settings toneAmber
class node_router,node_graph,node_agents,node_blog,node_synth,node_review,node_llm,node_tools toneMint
class node_ingest,node_vector,node_ltm,node_stm,node_checkpoints toneRose
class node_eval_harness,node_judge toneIndigo
```

## Components

### User experience

- [Chat interface](https://github.com/thenithin342/agentflow/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [SSE handling](https://github.com/thenithin342/agentflow/blob/main/frontend/src/hooks/useSSE.js): `frontend/src/hooks/useSSE.js`
- [API client](https://github.com/thenithin342/agentflow/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### API and access

- [FastAPI application](https://github.com/thenithin342/agentflow/blob/main/backend/main.py): `backend/main.py`
- [Authentication](https://github.com/thenithin342/agentflow/blob/main/backend/auth.py): `backend/auth.py`
- [Chat endpoint](https://github.com/thenithin342/agentflow/blob/main/backend/routers/chat.py): `backend/routers/chat.py`
- [Upload endpoint](https://github.com/thenithin342/agentflow/blob/main/backend/routers/upload.py): `backend/routers/upload.py`
- [Thread endpoints](https://github.com/thenithin342/agentflow/blob/main/backend/routers/threads.py): `backend/routers/threads.py`
- [Administration](https://github.com/thenithin342/agentflow/blob/main/backend/routers/admin.py): `backend/routers/admin.py`
- [Runtime settings](https://github.com/thenithin342/agentflow/blob/main/backend/settings.py): `backend/settings.py`

### Agent workflow

- [Intent router](https://github.com/thenithin342/agentflow/blob/main/backend/graph/router.py): `backend/graph/router.py`
- [Workflow graph](https://github.com/thenithin342/agentflow/blob/main/backend/graph/build_graph.py): `backend/graph/build_graph.py`
- [Specialist agents](https://github.com/thenithin342/agentflow/blob/main/backend/graph/agents.py): `backend/graph/agents.py`
- [Blog writer](https://github.com/thenithin342/agentflow/blob/main/backend/graph/blog_agent.py): `backend/graph/blog_agent.py`
- [Response synthesis](https://github.com/thenithin342/agentflow/blob/main/backend/graph/synthesizer.py): `backend/graph/synthesizer.py`
- [Human review](https://github.com/thenithin342/agentflow/blob/main/backend/graph/human_review.py): `backend/graph/human_review.py`
- [LLM providers](https://github.com/thenithin342/agentflow/blob/main/backend/llm.py): `backend/llm.py`
- [Agent tools](https://github.com/thenithin342/agentflow/blob/main/backend/graph/tools.py): `backend/graph/tools.py`

### Knowledge and state

- [PDF ingestion](https://github.com/thenithin342/agentflow/blob/main/backend/rag/ingest.py): `backend/rag/ingest.py`
- [Vector store](https://github.com/thenithin342/agentflow/blob/main/backend/vectorstore/qdrant_store.py): `backend/vectorstore/qdrant_store.py`
- [Long-term memory](https://github.com/thenithin342/agentflow/blob/main/backend/memory/ltm.py): `backend/memory/ltm.py`
- [Short-term memory](https://github.com/thenithin342/agentflow/blob/main/backend/memory/stm.py): `backend/memory/stm.py`
- [Graph checkpoints](https://github.com/thenithin342/agentflow/blob/main/backend/main.py): `backend/main.py`

### Evaluation

- [Offline evaluation](https://github.com/thenithin342/agentflow/blob/main/evals/harness/run_offline.py): `evals/harness/run_offline.py`
- [LLM judge](https://github.com/thenithin342/agentflow/blob/main/evals/harness/llm_judge.py): `evals/harness/llm_judge.py`

### Other components

- **User**

## Connections

- User → Chat interface: uses
- Chat interface → API client: requests (evidence: `frontend/src/App.jsx`)
- API client → FastAPI application: calls API (evidence: `frontend/src/api/client.js`)
- FastAPI application → Chat endpoint: registers routes (evidence: `backend/main.py`)
- FastAPI application → Graph checkpoints: opens checkpoint store (evidence: `backend/main.py`)
- FastAPI application → Authentication: bootstraps access (evidence: `backend/main.py`)
- Chat endpoint → Workflow graph: streams graph
- Chat endpoint → Human review: resumes review (evidence: `backend/routers/chat.py`)
- Workflow graph → Intent router: dispatches (evidence: `backend/graph/build_graph.py`)
- Workflow graph → Specialist agents: routes specialist work (evidence: `backend/graph/build_graph.py`)
- Workflow graph → Blog writer: routes blog work (evidence: `backend/graph/build_graph.py`)
- Workflow graph → Response synthesis: synthesizes output (evidence: `backend/graph/build_graph.py`)
- Workflow graph → Human review: gates response (evidence: `backend/graph/build_graph.py`)
- Intent router → LLM providers: classifies with (evidence: `backend/graph/router.py`)
- Specialist agents → Agent tools: uses tools
- Specialist agents → PDF ingestion: retrieves documents
- Agent tools → PDF ingestion: retrieves documents (evidence: `backend/graph/tools.py`)
- Upload endpoint → PDF ingestion: ingests PDFs
- PDF ingestion → Vector store: stores chunks (evidence: `backend/rag/ingest.py`)
- Workflow graph → Long-term memory: memory nodes (evidence: `backend/graph/build_graph.py`)
- Long-term memory → Vector store: uses store (evidence: `backend/memory/ltm.py`)
- Workflow graph → Short-term memory: uses conversation memory
- Thread endpoints → PDF ingestion: manages thread data (evidence: `backend/routers/threads.py`)
- Chat interface → SSE handling: streams chat (evidence: `frontend/src/App.jsx`)
- SSE handling → API client: sends chat request (evidence: `frontend/src/hooks/useSSE.js`)
- Chat interface → Upload endpoint: uploads PDFs
- Chat interface → Thread endpoints: manages threads (evidence: `frontend/src/App.jsx`)
- Chat interface → Administration: opens admin (evidence: `frontend/src/App.jsx`)
- Offline evaluation → LLM judge: scores answers (evidence: `evals/harness/run_offline.py`)
- FastAPI application → Runtime settings: loads configuration (evidence: `backend/main.py`)
- LLM providers → Runtime settings: loads provider config (evidence: `backend/llm.py`)
