# tongchen2010/llm-agent-visualizer architecture

> Architecture diagram of the GitHub repository tongchen2010/llm-agent-visualizer, 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/tongchen2010/llm-agent-visualizer
- Repository: https://github.com/tongchen2010/llm-agent-visualizer

## Overview

LLM Agent Visualizer is a static browser app for replaying recorded ReAct traces. A user selects a task, then runs the replay or advances it one step at a time; the app renders thoughts, tool actions, observations, and a final answer while updating the phase tracker. The four scenarios cover search, calculator, code, and Wikipedia. Tool calls are displayed as recorded steps, not executed live. Relationships are grounded in app.js and README; the HTML structure was not sampled.

Main entry points: [`app.js`](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js) (Replay Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_replay["Trace Replay"]
  node_traces["Recorded Traces<br/>[app.js]"]
  node_replay_engine["Replay Engine<br/>[app.js]"]
  node_tool_catalog["Tool Labels<br/>[app.js]"]
end

subgraph group_presentation["Replay Presentation"]
  node_timeline["Step Timeline<br/>[app.js]"]
  node_phase_tracker["Phase Tracker<br/>[app.js]"]
end

subgraph group_interaction["User Controls"]
  node_controls["Replay Controls<br/>[app.js]"]
  node_task_select["Task Selector<br/>[app.js]"]
end

node_user(("User"))

node_user -->|"chooses task"| node_task_select
node_user -->|"starts replay"| node_controls
node_task_select -->|"selects scenario"| node_traces
node_controls -->|"dispatches controls"| node_replay_engine
node_replay_engine -->|"reads steps"| node_traces
node_replay_engine -->|"renders steps"| node_timeline
node_replay_engine -->|"updates phase"| node_phase_tracker
node_replay_engine -->|"looks up labels"| node_tool_catalog
node_tool_catalog -->|"labels actions"| node_timeline

click node_controls "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"
click node_task_select "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"
click node_traces "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"
click node_replay_engine "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"
click node_tool_catalog "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"
click node_timeline "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"
click node_phase_tracker "https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js"

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_traces,node_replay_engine,node_tool_catalog,node_user toneBlue
class node_timeline,node_phase_tracker toneAmber
class node_controls,node_task_select toneMint
```

## Components

### Trace Replay

- [Recorded Traces](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`
- [Replay Engine](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`
- [Tool Labels](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`

### Replay Presentation

- [Step Timeline](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`
- [Phase Tracker](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`

### User Controls

- [Replay Controls](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`
- [Task Selector](https://github.com/tongchen2010/llm-agent-visualizer/blob/main/app.js): `app.js`

### Other components

- **User**

## Connections

- User → Task Selector: chooses task (evidence: `README.md`)
- User → Replay Controls: starts replay (evidence: `README.md`)
- Task Selector → Recorded Traces: selects scenario (evidence: `app.js`)
- Replay Controls → Replay Engine: dispatches controls (evidence: `app.js`)
- Replay Engine → Recorded Traces: reads steps (evidence: `app.js`)
- Replay Engine → Step Timeline: renders steps (evidence: `app.js`)
- Replay Engine → Phase Tracker: updates phase (evidence: `app.js`)
- Replay Engine → Tool Labels: looks up labels (evidence: `app.js`)
- Tool Labels → Step Timeline: labels actions (evidence: `app.js`)
