# aswina1636/apple-support-ai-agent architecture

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

- Interactive diagram: https://gitdiagram.com/aswina1636/apple-support-ai-agent
- Repository: https://github.com/aswina1636/apple-support-ai-agent

## Overview

Apple Support AI Agent turns a customer message into an intent, a historically grounded draft reply, and an auto-handle or escalation decision. The README documents these as branches of the runtime workflow; the pipeline is the CLI and importable entry point. The repository also includes a dataset-preparation path and a substantial evaluation workflow. Pipeline and escalation internals were not sampled, so their detailed implementation and wiring are represented only where the README documents them.

Main entry points: [`eval/evaluate.py`](https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/evaluate.py) (Evaluation Harness), [`src/pipeline.py`](https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/pipeline.py) (Agent Pipeline), [`data/apple_pairs.json`](https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/apple_pairs.json) (Conversation Pairs), [`src/reply_generator.py`](https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/reply_generator.py) (Reply Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Support Runtime"]
  node_pipeline["Agent Pipeline<br/>[pipeline.py]"]
  node_intent["Intent Classifier"]
  node_reply["Reply Generator<br/>[reply_generator.py]"]
  node_escalation["Escalation Engine"]
end

subgraph group_data["Conversation Data"]
  node_source_data["Dataset Processor<br/>[download_data.py]"]
  node_pairs["Conversation Pairs<br/>[apple_pairs.json]"]
  node_conversations["Apple Conversations"]
end

subgraph group_evaluation["Evaluation"]
  node_gold_builder["Golden Set Builder"]
  node_gold_set["Golden Evaluation Set<br/>[golden_set.json]"]
  node_evaluation_harness["Evaluation Harness<br/>[evaluate.py]"]
  node_judge["LLM Reply Judge<br/>[llm_judge.py]"]
  node_results["Evaluation Results"]
end

node_customer(("Customer"))
node_result["Support Outcome"]

node_customer -->|"submits message"| node_pipeline
node_pipeline -->|"classifies message"| node_intent
node_pipeline -->|"drafts reply"| node_reply
node_pipeline -->|"decides handling"| node_escalation
node_pipeline -->|"returns outcome"| node_result
node_source_data -->|"saves pairs"| node_pairs
node_source_data -->|"saves threads"| node_conversations
node_pairs -->|"grounds retrieval"| node_reply
node_pairs -->|"samples examples"| node_gold_builder
node_gold_builder -->|"builds labels"| node_gold_set
node_gold_set -->|"evaluates variants"| node_evaluation_harness
node_evaluation_harness -->|"evaluates intent"| node_intent
node_evaluation_harness -->|"evaluates replies"| node_reply
node_evaluation_harness -->|"evaluates decisions"| node_escalation
node_evaluation_harness -->|"scores main replies"| node_judge
node_evaluation_harness -->|"saves metrics"| node_results

click node_pipeline "https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/pipeline.py"
click node_intent "https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/intent_classifier.py"
click node_reply "https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/reply_generator.py"
click node_escalation "https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/escalation_engine.py"
click node_source_data "https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/download_data.py"
click node_pairs "https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/apple_pairs.json"
click node_conversations "https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/apple_conversations.json"
click node_gold_builder "https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/build_golden_set.py"
click node_gold_set "https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/golden_set.json"
click node_evaluation_harness "https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/evaluate.py"
click node_judge "https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/llm_judge.py"
click node_results "https://github.com/aswina1636/apple-support-ai-agent/blob/main/results/evaluation_results.json"

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_pipeline,node_intent,node_reply,node_escalation toneBlue
class node_source_data,node_pairs,node_conversations toneAmber
class node_gold_builder,node_gold_set,node_evaluation_harness,node_judge,node_results toneMint
class node_customer,node_result toneIndigo
```

## Components

### Support Runtime

- [Agent Pipeline](https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/pipeline.py): `src/pipeline.py`
- [Intent Classifier](https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/intent_classifier.py): `src/intent_classifier.py`
- [Reply Generator](https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/reply_generator.py): `src/reply_generator.py`
- [Escalation Engine](https://github.com/aswina1636/apple-support-ai-agent/blob/main/src/escalation_engine.py): `src/escalation_engine.py`

### Conversation Data

- [Dataset Processor](https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/download_data.py): `data/download_data.py`
- [Conversation Pairs](https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/apple_pairs.json): `data/apple_pairs.json`
- [Apple Conversations](https://github.com/aswina1636/apple-support-ai-agent/blob/main/data/apple_conversations.json): `data/apple_conversations.json`

### Evaluation

- [Golden Set Builder](https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/build_golden_set.py): `eval/build_golden_set.py`
- [Golden Evaluation Set](https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/golden_set.json): `eval/golden_set.json`
- [Evaluation Harness](https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/evaluate.py): `eval/evaluate.py`
- [LLM Reply Judge](https://github.com/aswina1636/apple-support-ai-agent/blob/main/eval/llm_judge.py): `eval/llm_judge.py`
- [Evaluation Results](https://github.com/aswina1636/apple-support-ai-agent/blob/main/results/evaluation_results.json): `results/evaluation_results.json`

### Other components

- **Customer**
- **Support Outcome**

## Connections

- Customer → Agent Pipeline: submits message (evidence: `README.md`)
- Agent Pipeline → Intent Classifier: classifies message (evidence: `README.md`)
- Agent Pipeline → Reply Generator: drafts reply (evidence: `README.md`)
- Agent Pipeline → Escalation Engine: decides handling (evidence: `README.md`)
- Agent Pipeline → Support Outcome: returns outcome (evidence: `README.md`)
- Dataset Processor → Conversation Pairs: saves pairs (evidence: `README.md`)
- Dataset Processor → Apple Conversations: saves threads (evidence: `README.md`)
- Conversation Pairs → Reply Generator: grounds retrieval (evidence: `README.md`)
- Conversation Pairs → Golden Set Builder: samples examples (evidence: `eval/build_golden_set.py`)
- Golden Set Builder → Golden Evaluation Set: builds labels (evidence: `README.md`)
- Golden Evaluation Set → Evaluation Harness: evaluates variants (evidence: `eval/evaluate.py`)
- Evaluation Harness → Intent Classifier: evaluates intent (evidence: `eval/evaluate.py`)
- Evaluation Harness → Reply Generator: evaluates replies (evidence: `eval/evaluate.py`)
- Evaluation Harness → Escalation Engine: evaluates decisions (evidence: `eval/evaluate.py`)
- Evaluation Harness → LLM Reply Judge: scores main replies (evidence: `eval/evaluate.py`)
- Evaluation Harness → Evaluation Results: saves metrics (evidence: `README.md`)
