# garymapley/support-agent-workbench architecture

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

- Interactive diagram: https://gitdiagram.com/garymapley/support-agent-workbench
- Repository: https://github.com/garymapley/support-agent-workbench

## Overview

Support Agent Workbench is a support-case workbench backed by a FastAPI service and a LangGraph agent. The primary workflow authenticates an operator, runs the agent against order and policy tools, creates auditable tickets, pauses refund requests for human approval, then resumes the same conversation with the decision. Policy ingestion and run telemetry are meaningful supporting capabilities. Relationships use the README and SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`app/api.py`](https://github.com/garymapley/support-agent-workbench/blob/main/app/api.py) (FastAPI routes), [`app/graph.py`](https://github.com/garymapley/support-agent-workbench/blob/main/app/graph.py) (Agent graph), [`web/app/page.tsx`](https://github.com/garymapley/support-agent-workbench/blob/main/web/app/page.tsx) (Support workbench), [`app/workflow_repository.py`](https://github.com/garymapley/support-agent-workbench/blob/main/app/workflow_repository.py) (Ticket and approval records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Workbench"]
  node_workbench["Support workbench<br/>[page.tsx]"]
  node_web_auth["Web sessions<br/>[session.ts]"]
  node_web_proxy["Backend proxy<br/>[route.ts]"]
end

subgraph group_service["Agent service"]
  node_api["FastAPI routes<br/>[api.py]"]
  node_security["Authorization<br/>[security.py]"]
  node_agent["Agent graph<br/>[graph.py]"]
  node_chat_model["Chat model<br/>[model.py]"]
  node_order_tools["Order tools<br/>[order_tools.py]"]
  node_workflow_tools["Workflow tools<br/>[workflow_tools.py]"]
  node_approval["Approval flow"]
  node_telemetry["Execution telemetry<br/>[telemetry.py]"]
end

subgraph group_knowledge["Policy knowledge"]
  node_policy_tools["Policy tools<br/>[policy_tools.py]"]
  node_ingestion["Policy ingestion"]
  node_loader["Document loader"]
  node_embeddings["Text embeddings<br/>[embeddings.py]"]
  node_vectors[("Policy vector store<br/>[qdrant_store.py]")]
end

subgraph group_persistence["Persistence and audit"]
  node_order_repo["Order repository"]
  node_workflow_repo["Ticket and approval records"]
  node_database[("Business database<br/>[database.py]")]
  node_models["Database models<br/>[db_models.py]"]
  node_checkpoint[("Conversation checkpoints<br/>[checkpointing.py]")]
  node_run_repo["Run records<br/>[run_repository.py]"]
end

node_customer(("Customer"))
node_operator(("Operator"))
node_admin(("Approval admin"))
node_model_provider["Model Studio"]
node_qdrant[("Qdrant service")]

node_customer -->|"submits request"| node_workbench
node_operator -->|"handles cases"| node_workbench
node_admin -->|"reviews refunds"| node_workbench
node_workbench -->|"uses session"| node_web_auth
node_workbench -->|"sends requests"| node_web_proxy
node_web_proxy -->|"proxies requests"| node_api
node_api -->|"authorizes"| node_security
node_api -->|"invokes and resumes"| node_agent
node_api -->|"serves order data"| node_order_repo
node_api -->|"manages cases"| node_workflow_repo
node_api -->|"reads run records"| node_run_repo
node_api -->|"records execution"| node_telemetry
node_agent -->|"calls"| node_chat_model
node_agent -->|"dispatches"| node_order_tools
node_agent -->|"dispatches"| node_policy_tools
node_agent -->|"dispatches"| node_workflow_tools
node_agent -->|"pauses and resumes"| node_approval
node_agent -->|"persists state"| node_checkpoint
node_order_tools -->|"queries orders"| node_order_repo
node_workflow_tools -->|"manages tickets"| node_workflow_repo
node_policy_tools -->|"embeds queries"| node_embeddings
node_policy_tools -->|"searches policies"| node_vectors
node_workflow_repo -->|"looks up orders"| node_order_repo
node_order_repo -->|"reads orders"| node_database
node_workflow_repo -->|"reads and writes"| node_database
node_database -->|"maps records"| node_models
node_ingestion -->|"loads chunks"| node_loader
node_ingestion -->|"embeds chunks"| node_embeddings
node_ingestion -->|"indexes policies"| node_vectors
node_vectors -->|"stores vectors"| node_qdrant
node_chat_model -->|"requests completions"| node_model_provider
node_embeddings -->|"requests embeddings"| node_model_provider
node_api -->|"configures persistence"| node_checkpoint
node_api -->|"uses policy store"| node_vectors
node_api -->|"initializes data"| node_database
node_api -->|"records runs"| node_run_repo

click node_workbench "https://github.com/garymapley/support-agent-workbench/blob/main/web/app/page.tsx"
click node_web_auth "https://github.com/garymapley/support-agent-workbench/blob/main/web/lib/session.ts"
click node_web_proxy "https://github.com/garymapley/support-agent-workbench/blob/main/web/app/api/backend/%5B...path%5D/route.ts"
click node_api "https://github.com/garymapley/support-agent-workbench/blob/main/app/api.py"
click node_security "https://github.com/garymapley/support-agent-workbench/blob/main/app/security.py"
click node_agent "https://github.com/garymapley/support-agent-workbench/blob/main/app/graph.py"
click node_chat_model "https://github.com/garymapley/support-agent-workbench/blob/main/app/model.py"
click node_order_tools "https://github.com/garymapley/support-agent-workbench/blob/main/app/tools/order_tools.py"
click node_policy_tools "https://github.com/garymapley/support-agent-workbench/blob/main/app/tools/policy_tools.py"
click node_workflow_tools "https://github.com/garymapley/support-agent-workbench/blob/main/app/tools/workflow_tools.py"
click node_approval "https://github.com/garymapley/support-agent-workbench/blob/main/app/approval_workflow.py"
click node_order_repo "https://github.com/garymapley/support-agent-workbench/blob/main/app/order_repository.py"
click node_workflow_repo "https://github.com/garymapley/support-agent-workbench/blob/main/app/workflow_repository.py"
click node_database "https://github.com/garymapley/support-agent-workbench/blob/main/app/database.py"
click node_models "https://github.com/garymapley/support-agent-workbench/blob/main/app/db_models.py"
click node_checkpoint "https://github.com/garymapley/support-agent-workbench/blob/main/app/checkpointing.py"
click node_run_repo "https://github.com/garymapley/support-agent-workbench/blob/main/app/run_repository.py"
click node_telemetry "https://github.com/garymapley/support-agent-workbench/blob/main/app/telemetry.py"
click node_ingestion "https://github.com/garymapley/support-agent-workbench/blob/main/app/knowledge_ingestion.py"
click node_loader "https://github.com/garymapley/support-agent-workbench/blob/main/app/knowledge_loader.py"
click node_embeddings "https://github.com/garymapley/support-agent-workbench/blob/main/app/embeddings.py"
click node_vectors "https://github.com/garymapley/support-agent-workbench/blob/main/app/qdrant_store.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_workbench,node_web_auth,node_web_proxy toneBlue
class node_api,node_security,node_agent,node_chat_model,node_order_tools,node_workflow_tools,node_approval,node_telemetry,node_qdrant toneAmber
class node_policy_tools,node_ingestion,node_loader,node_embeddings,node_vectors toneMint
class node_order_repo,node_workflow_repo,node_database,node_models,node_checkpoint,node_run_repo toneRose
class node_customer,node_operator,node_admin,node_model_provider toneIndigo
```

## Components

### Workbench

- [Support workbench](https://github.com/garymapley/support-agent-workbench/blob/main/web/app/page.tsx): `web/app/page.tsx`
- [Web sessions](https://github.com/garymapley/support-agent-workbench/blob/main/web/lib/session.ts): `web/lib/session.ts`
- [Backend proxy](https://github.com/garymapley/support-agent-workbench/blob/main/web/app/api/backend/%5B...path%5D/route.ts): `web/app/api/backend/[...path]/route.ts`

### Agent service

- [FastAPI routes](https://github.com/garymapley/support-agent-workbench/blob/main/app/api.py): `app/api.py`
- [Authorization](https://github.com/garymapley/support-agent-workbench/blob/main/app/security.py): `app/security.py`
- [Agent graph](https://github.com/garymapley/support-agent-workbench/blob/main/app/graph.py): `app/graph.py`
- [Chat model](https://github.com/garymapley/support-agent-workbench/blob/main/app/model.py): `app/model.py`
- [Order tools](https://github.com/garymapley/support-agent-workbench/blob/main/app/tools/order_tools.py): `app/tools/order_tools.py`
- [Workflow tools](https://github.com/garymapley/support-agent-workbench/blob/main/app/tools/workflow_tools.py): `app/tools/workflow_tools.py`
- [Approval flow](https://github.com/garymapley/support-agent-workbench/blob/main/app/approval_workflow.py): `app/approval_workflow.py`
- [Execution telemetry](https://github.com/garymapley/support-agent-workbench/blob/main/app/telemetry.py): `app/telemetry.py`

### Policy knowledge

- [Policy tools](https://github.com/garymapley/support-agent-workbench/blob/main/app/tools/policy_tools.py): `app/tools/policy_tools.py`
- [Policy ingestion](https://github.com/garymapley/support-agent-workbench/blob/main/app/knowledge_ingestion.py): `app/knowledge_ingestion.py`
- [Document loader](https://github.com/garymapley/support-agent-workbench/blob/main/app/knowledge_loader.py): `app/knowledge_loader.py`
- [Text embeddings](https://github.com/garymapley/support-agent-workbench/blob/main/app/embeddings.py): `app/embeddings.py`
- [Policy vector store](https://github.com/garymapley/support-agent-workbench/blob/main/app/qdrant_store.py): `app/qdrant_store.py`

### Persistence and audit

- [Order repository](https://github.com/garymapley/support-agent-workbench/blob/main/app/order_repository.py): `app/order_repository.py`
- [Ticket and approval records](https://github.com/garymapley/support-agent-workbench/blob/main/app/workflow_repository.py): `app/workflow_repository.py`
- [Business database](https://github.com/garymapley/support-agent-workbench/blob/main/app/database.py): `app/database.py`
- [Database models](https://github.com/garymapley/support-agent-workbench/blob/main/app/db_models.py): `app/db_models.py`
- [Conversation checkpoints](https://github.com/garymapley/support-agent-workbench/blob/main/app/checkpointing.py): `app/checkpointing.py`
- [Run records](https://github.com/garymapley/support-agent-workbench/blob/main/app/run_repository.py): `app/run_repository.py`

### Other components

- **Customer**
- **Operator**
- **Approval admin**
- **Model Studio**
- **Qdrant service**

## Connections

- Customer → Support workbench: submits request
- Operator → Support workbench: handles cases
- Approval admin → Support workbench: reviews refunds
- Support workbench → Web sessions: uses session
- Support workbench → Backend proxy: sends requests
- Backend proxy → FastAPI routes: proxies requests
- FastAPI routes → Authorization: authorizes (evidence: `app/api.py`)
- FastAPI routes → Agent graph: invokes and resumes (evidence: `app/api.py`)
- FastAPI routes → Order repository: serves order data (evidence: `app/api.py`)
- FastAPI routes → Ticket and approval records: manages cases (evidence: `app/api.py`)
- FastAPI routes → Run records: reads run records (evidence: `app/api.py`)
- FastAPI routes → Execution telemetry: records execution (evidence: `app/api.py`)
- Agent graph → Chat model: calls (evidence: `app/graph.py`)
- Agent graph → Order tools: dispatches (evidence: `app/graph.py`)
- Agent graph → Policy tools: dispatches (evidence: `app/graph.py`)
- Agent graph → Workflow tools: dispatches (evidence: `app/graph.py`)
- Agent graph → Approval flow: pauses and resumes (evidence: `app/graph.py`)
- Agent graph → Conversation checkpoints: persists state (evidence: `app/graph.py`)
- Order tools → Order repository: queries orders (evidence: `app/tools/order_tools.py`)
- Workflow tools → Ticket and approval records: manages tickets (evidence: `app/tools/workflow_tools.py`)
- Policy tools → Text embeddings: embeds queries (evidence: `app/tools/policy_tools.py`)
- Policy tools → Policy vector store: searches policies (evidence: `app/tools/policy_tools.py`)
- Ticket and approval records → Order repository: looks up orders (evidence: `app/workflow_repository.py`)
- Order repository → Business database: reads orders (evidence: `app/order_repository.py`)
- Ticket and approval records → Business database: reads and writes (evidence: `app/workflow_repository.py`)
- Business database → Database models: maps records (evidence: `app/database.py`)
- Policy ingestion → Document loader: loads chunks (evidence: `app/knowledge_ingestion.py`)
- Policy ingestion → Text embeddings: embeds chunks (evidence: `app/knowledge_ingestion.py`)
- Policy ingestion → Policy vector store: indexes policies (evidence: `app/knowledge_ingestion.py`)
- Policy vector store → Qdrant service: stores vectors
- Chat model → Model Studio: requests completions
- Text embeddings → Model Studio: requests embeddings
- FastAPI routes → Conversation checkpoints: configures persistence (evidence: `app/api.py`)
- FastAPI routes → Policy vector store: uses policy store (evidence: `app/api.py`)
- FastAPI routes → Business database: initializes data (evidence: `app/api.py`)
- FastAPI routes → Run records: records runs (evidence: `app/api.py`)
