# meet-159/uber-support-ai-agent architecture

> Architecture diagram of the GitHub repository meet-159/uber-support-ai-agent, 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/meet-159/uber-support-ai-agent
- Repository: https://github.com/meet-159/uber-support-ai-agent

## Overview

Uber_Support AI Support Agent classifies a customer message, retrieves similar resolved cases, drafts a precedent-grounded reply, and decides whether to auto-handle or escalate. The demo exposes this workflow; a separate evaluation harness sends examples through the running API and scores results against baselines and an LLM judge. The README also describes the data-preparation path that produces grounding artifacts. Edges are limited to relationships shown in excerpts, the source index, or README; some UI/API wiring is not shown and is therefore left unconnected.

Main entry points: [`eval/src/runEval.ts`](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/runEval.ts) (Evaluation runner), [`app/src/lib/pipeline.ts`](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/pipeline.ts) (Pipeline orchestrator), [`app/src/lib/llmClient.ts`](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/llmClient.ts) (Gemini client), [`app/src/lib/classify.ts`](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/classify.ts) (Intent classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Demo experience"]
  node_demo["Compose and results UI<br/>[page.tsx]"]
  node_endpoint["Pipeline API<br/>[route.ts]"]
end

subgraph group_agent["Support agent"]
  node_pipeline["Pipeline orchestrator<br/>[pipeline.ts]"]
  node_classifier["Intent classifier<br/>[classify.ts]"]
  node_taxonomy["Intent taxonomy<br/>[taxonomy.ts]"]
  node_retriever["Precedent retrieval<br/>[retrieve.ts]"]
  node_embeddings["Text embeddings<br/>[embeddings.ts]"]
  node_drafter["Reply drafter<br/>[draftReply.ts]"]
  node_escalation["Escalation rules<br/>[escalate.ts]"]
  node_llm["Gemini client<br/>[llmClient.ts]"]
  node_retry["Quota-aware retry<br/>[withRetry.ts]"]
  node_contracts["Pipeline data types<br/>[types.ts]"]
end

subgraph group_grounding["Grounding data"]
  node_grounding_data[("Embedded resolved cases")]
  node_grounding_prep["Grounding data preparation"]
end

subgraph group_evaluation["Evaluation"]
  node_eval_runner["Evaluation runner<br/>[runEval.ts]"]
  node_golden_loader["Golden-set loader<br/>[loadGoldenSet.ts]"]
  node_api_runner["Pipeline API client"]
  node_judge["Reply quality judge<br/>[judge.ts]"]
  node_baselines["Baseline systems<br/>[baselines.ts]"]
  node_metrics["Evaluation metrics<br/>[metrics.ts]"]
end

node_customer(("Support operator"))

node_customer -->|"enters message"| node_demo
node_demo -.->|"submits run"| node_endpoint
node_endpoint -.->|"runs workflow"| node_pipeline
node_pipeline -->|"classifies"| node_classifier
node_pipeline -->|"retrieves precedents"| node_retriever
node_pipeline -->|"drafts reply"| node_drafter
node_pipeline -->|"decides routing"| node_escalation
node_classifier -->|"requests completion"| node_llm
node_classifier -->|"uses categories"| node_taxonomy
node_drafter -->|"requests completion"| node_llm
node_drafter -->|"uses categories"| node_taxonomy
node_retriever -->|"embeds query"| node_embeddings
node_retriever -->|"reads cases"| node_grounding_data
node_embeddings -->|"calls embedding API"| node_llm
node_llm -->|"retries requests"| node_retry
node_embeddings -->|"retries requests"| node_retry
node_grounding_prep -->|"produces artifacts"| node_grounding_data
node_eval_runner -->|"loads examples"| node_golden_loader
node_eval_runner -->|"requests predictions"| node_api_runner
node_api_runner -->|"posts messages"| node_endpoint
node_eval_runner -->|"scores replies"| node_judge
node_judge -->|"requests grading"| node_llm
node_eval_runner -->|"compares predictions"| node_baselines
node_eval_runner -->|"computes scores"| node_metrics

click node_demo "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/app/page.tsx"
click node_endpoint "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/app/api/pipeline/route.ts"
click node_pipeline "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/pipeline.ts"
click node_classifier "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/classify.ts"
click node_taxonomy "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/taxonomy.ts"
click node_retriever "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/retrieve.ts"
click node_embeddings "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/embeddings.ts"
click node_drafter "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/draftReply.ts"
click node_escalation "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/escalate.ts"
click node_llm "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/llmClient.ts"
click node_retry "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/withRetry.ts"
click node_contracts "https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/types.ts"
click node_grounding_data "https://github.com/meet-159/uber-support-ai-agent/tree/main/app/src/data"
click node_grounding_prep "https://github.com/meet-159/uber-support-ai-agent/tree/main/data-prep"
click node_eval_runner "https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/runEval.ts"
click node_golden_loader "https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/loadGoldenSet.ts"
click node_api_runner "https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/runPipelineOnGoldenSet.ts"
click node_judge "https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/judge.ts"
click node_baselines "https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/baselines.ts"
click node_metrics "https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/metrics.ts"

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_demo,node_endpoint toneBlue
class node_pipeline,node_classifier,node_taxonomy,node_retriever,node_embeddings,node_drafter,node_escalation,node_llm,node_retry,node_contracts toneAmber
class node_grounding_data,node_grounding_prep toneMint
class node_eval_runner,node_golden_loader,node_api_runner,node_judge,node_baselines,node_metrics toneRose
class node_customer toneIndigo
```

## Components

### Demo experience

- [Compose and results UI](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/app/page.tsx): `app/src/app/page.tsx`
- [Pipeline API](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/app/api/pipeline/route.ts): `app/src/app/api/pipeline/route.ts`

### Support agent

- [Pipeline orchestrator](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/pipeline.ts): `app/src/lib/pipeline.ts`
- [Intent classifier](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/classify.ts): `app/src/lib/classify.ts`
- [Intent taxonomy](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/taxonomy.ts): `app/src/lib/taxonomy.ts`
- [Precedent retrieval](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/retrieve.ts): `app/src/lib/retrieve.ts`
- [Text embeddings](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/embeddings.ts): `app/src/lib/embeddings.ts`
- [Reply drafter](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/draftReply.ts): `app/src/lib/draftReply.ts`
- [Escalation rules](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/escalate.ts): `app/src/lib/escalate.ts`
- [Gemini client](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/llmClient.ts): `app/src/lib/llmClient.ts`
- [Quota-aware retry](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/withRetry.ts): `app/src/lib/withRetry.ts`
- [Pipeline data types](https://github.com/meet-159/uber-support-ai-agent/blob/main/app/src/lib/types.ts): `app/src/lib/types.ts`

### Grounding data

- [Embedded resolved cases](https://github.com/meet-159/uber-support-ai-agent/tree/main/app/src/data): `app/src/data`
- [Grounding data preparation](https://github.com/meet-159/uber-support-ai-agent/tree/main/data-prep): `data-prep`

### Evaluation

- [Evaluation runner](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/runEval.ts): `eval/src/runEval.ts`
- [Golden-set loader](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/loadGoldenSet.ts): `eval/src/loadGoldenSet.ts`
- [Pipeline API client](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/runPipelineOnGoldenSet.ts): `eval/src/runPipelineOnGoldenSet.ts`
- [Reply quality judge](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/judge.ts): `eval/src/judge.ts`
- [Baseline systems](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/baselines.ts): `eval/src/baselines.ts`
- [Evaluation metrics](https://github.com/meet-159/uber-support-ai-agent/blob/main/eval/src/metrics.ts): `eval/src/metrics.ts`

### Other components

- **Support operator**

## Connections

- Support operator → Compose and results UI: enters message (evidence: `Readme.md`)
- Compose and results UI → Pipeline API: submits run
- Pipeline API → Pipeline orchestrator: runs workflow
- Pipeline orchestrator → Intent classifier: classifies (evidence: `app/src/lib/pipeline.ts`)
- Pipeline orchestrator → Precedent retrieval: retrieves precedents (evidence: `app/src/lib/pipeline.ts`)
- Pipeline orchestrator → Reply drafter: drafts reply (evidence: `app/src/lib/pipeline.ts`)
- Pipeline orchestrator → Escalation rules: decides routing (evidence: `app/src/lib/pipeline.ts`)
- Intent classifier → Gemini client: requests completion (evidence: `app/src/lib/classify.ts`)
- Intent classifier → Intent taxonomy: uses categories (evidence: `app/src/lib/classify.ts`)
- Reply drafter → Gemini client: requests completion (evidence: `app/src/lib/draftReply.ts`)
- Reply drafter → Intent taxonomy: uses categories (evidence: `app/src/lib/draftReply.ts`)
- Precedent retrieval → Text embeddings: embeds query (evidence: `app/src/lib/retrieve.ts`)
- Precedent retrieval → Embedded resolved cases: reads cases (evidence: `app/src/lib/retrieve.ts`)
- Text embeddings → Gemini client: calls embedding API (evidence: `app/src/lib/embeddings.ts`)
- Gemini client → Quota-aware retry: retries requests (evidence: `app/src/lib/llmClient.ts`)
- Text embeddings → Quota-aware retry: retries requests (evidence: `app/src/lib/embeddings.ts`)
- Grounding data preparation → Embedded resolved cases: produces artifacts (evidence: `Readme.md`)
- Evaluation runner → Golden-set loader: loads examples (evidence: `eval/src/runEval.ts`)
- Evaluation runner → Pipeline API client: requests predictions (evidence: `eval/src/runEval.ts`)
- Pipeline API client → Pipeline API: posts messages (evidence: `eval/src/runPipelineOnGoldenSet.ts`)
- Evaluation runner → Reply quality judge: scores replies (evidence: `eval/src/runEval.ts`)
- Reply quality judge → Gemini client: requests grading (evidence: `eval/src/judge.ts`)
- Evaluation runner → Baseline systems: compares predictions (evidence: `eval/src/runEval.ts`)
- Evaluation runner → Evaluation metrics: computes scores (evidence: `eval/src/runEval.ts`)
