# sylesh29/voice-agent-eval architecture

> Architecture diagram of the GitHub repository sylesh29/voice-agent-eval, 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/sylesh29/voice-agent-eval
- Repository: https://github.com/sylesh29/voice-agent-eval

## Overview

Voice Agent Eval is a local evaluation platform for simulated healthcare voice-agent workflows. A CLI run loads a scenario and agent configuration, simulates caller interaction and tool-driven changes to a ground-truth world, then evaluates the resulting trace and writes run results. The API exposes stored runs for comparison and inspection; the frontend presents run, scenario, failure-pattern, and evaluator-calibration views. The README documents these capabilities, but several implementation paths are unsampled, so uncertain links are omitted rather than inferred.

Main entry points: [`backend/voiceval/runner.py`](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/runner.py) (Evaluation runner), [`backend/voiceval/agents/rule_agent.py`](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/agents/rule_agent.py) (Rule agent), [`backend/voiceval/evaluators/closure.py`](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/closure.py) (Closure evaluation), [`frontend/app/ui.tsx`](https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/ui.tsx) (Metric components)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Scenario simulation"]
  node_cli["Run CLI<br/>[cli.py]"]
  node_runner["Evaluation runner<br/>[runner.py]"]
  node_scenario["Scenario contracts<br/>[scenario.py]"]
  node_agent["Rule agent<br/>[rule_agent.py]"]
  node_agent_configs["Agent versions<br/>[configs.py]"]
  node_caller["Caller simulator<br/>[caller.py]"]
  node_tool_layer["Fault-injected tools<br/>[tools.py]"]
  node_world[("Simulated world<br/>[world.py]")]
  node_trace["Run trace<br/>[trace.py]"]
end

subgraph group_evaluation["Evaluation engine"]
  node_core_metrics["State metrics<br/>[core.py]"]
  node_closure["Closure evaluation<br/>[closure.py]"]
  node_judge["Language judge<br/>[judge.py]"]
  node_aggregation["Metric aggregation<br/>[aggregate.py]"]
  node_calibration["Evaluator calibration<br/>[calibrate.py]"]
  node_reweight["Mix sensitivity<br/>[reweight.py]"]
end

subgraph group_service["API and persistence"]
  node_api["Read/write API<br/>[main.py]"]
  node_db[("Run database<br/>[db.py]")]
end

subgraph group_frontend["Results interface"]
  node_run_pages["Run views"]
  node_compare_page["Run comparison<br/>[page.tsx]"]
  node_patterns_page["Failure patterns<br/>[page.tsx]"]
  node_calibration_page["Calibration view<br/>[page.tsx]"]
  node_ui_components["Metric components<br/>[ui.tsx]"]
  node_metric_labels["Metric definitions<br/>[metrics.ts]"]
end

node_operator(("Operator"))
node_browser(("Reviewer"))

node_operator -->|"starts run"| node_cli
node_cli -->|"invokes"| node_runner
node_runner -->|"loads"| node_scenario
node_runner -->|"selects version"| node_agent_configs
node_runner -->|"runs"| node_agent
node_runner -->|"simulates"| node_caller
node_runner -->|"constructs"| node_tool_layer
node_runner -->|"builds"| node_world
node_runner -->|"records"| node_trace
node_agent -->|"reads policy"| node_agent_configs
node_agent -->|"exchanges turns"| node_caller
node_agent -->|"calls tools"| node_tool_layer
node_agent -->|"records outcome"| node_trace
node_tool_layer -->|"reads and mutates"| node_world
node_scenario -->|"builds fixture"| node_world
node_runner -.->|"evaluates trace"| node_core_metrics
node_runner -.->|"evaluates closure"| node_closure
node_closure -->|"uses state checks"| node_core_metrics
node_closure -->|"requests judgment"| node_judge
node_runner -.->|"aggregates results"| node_aggregation
node_calibration -.->|"calibrates evaluator"| node_closure
node_reweight -.->|"analyzes mix"| node_aggregation
node_api -->|"reads and writes"| node_db
node_browser -->|"reviews runs"| node_run_pages
node_browser -->|"compares runs"| node_compare_page
node_browser -->|"inspects patterns"| node_patterns_page
node_browser -->|"reviews calibration"| node_calibration_page
node_run_pages -->|"renders"| node_ui_components
node_compare_page -->|"renders"| node_ui_components
node_compare_page -->|"uses labels"| node_metric_labels
node_patterns_page -->|"renders"| node_ui_components
node_patterns_page -->|"uses labels"| node_metric_labels
node_calibration_page -->|"renders"| node_ui_components

click node_cli "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/cli.py"
click node_runner "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/runner.py"
click node_scenario "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/scenario.py"
click node_agent "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/agents/rule_agent.py"
click node_agent_configs "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/agents/configs.py"
click node_caller "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/caller.py"
click node_tool_layer "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/tools.py"
click node_world "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/world.py"
click node_trace "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/trace.py"
click node_core_metrics "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/core.py"
click node_closure "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/closure.py"
click node_judge "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/judge.py"
click node_aggregation "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/aggregate.py"
click node_calibration "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/calibrate.py"
click node_reweight "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/reweight.py"
click node_api "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/app/main.py"
click node_db "https://github.com/sylesh29/voice-agent-eval/blob/main/backend/app/db.py"
click node_run_pages "https://github.com/sylesh29/voice-agent-eval/tree/main/frontend/app/runs"
click node_compare_page "https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/compare/page.tsx"
click node_patterns_page "https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/patterns/page.tsx"
click node_calibration_page "https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/calibration/page.tsx"
click node_ui_components "https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/ui.tsx"
click node_metric_labels "https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/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_cli,node_runner,node_scenario,node_agent,node_agent_configs,node_caller,node_tool_layer,node_world,node_trace,node_browser toneBlue
class node_core_metrics,node_closure,node_judge,node_aggregation,node_calibration,node_reweight toneAmber
class node_api,node_db toneMint
class node_run_pages,node_compare_page,node_patterns_page,node_calibration_page,node_ui_components,node_metric_labels toneRose
class node_operator toneIndigo
```

## Components

### Scenario simulation

- [Run CLI](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/cli.py): `backend/voiceval/cli.py`
- [Evaluation runner](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/runner.py): `backend/voiceval/runner.py`
- [Scenario contracts](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/scenario.py): `backend/voiceval/scenario.py`
- [Rule agent](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/agents/rule_agent.py): `backend/voiceval/agents/rule_agent.py`
- [Agent versions](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/agents/configs.py): `backend/voiceval/agents/configs.py`
- [Caller simulator](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/caller.py): `backend/voiceval/caller.py`
- [Fault-injected tools](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/tools.py): `backend/voiceval/tools.py`
- [Simulated world](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/world.py): `backend/voiceval/world.py`
- [Run trace](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/trace.py): `backend/voiceval/trace.py`

### Evaluation engine

- [State metrics](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/core.py): `backend/voiceval/evaluators/core.py`
- [Closure evaluation](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/closure.py): `backend/voiceval/evaluators/closure.py`
- [Language judge](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/judge.py): `backend/voiceval/evaluators/judge.py`
- [Metric aggregation](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/evaluators/aggregate.py): `backend/voiceval/evaluators/aggregate.py`
- [Evaluator calibration](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/calibrate.py): `backend/voiceval/calibrate.py`
- [Mix sensitivity](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/voiceval/reweight.py): `backend/voiceval/reweight.py`

### API and persistence

- [Read/write API](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/app/main.py): `backend/app/main.py`
- [Run database](https://github.com/sylesh29/voice-agent-eval/blob/main/backend/app/db.py): `backend/app/db.py`

### Results interface

- [Run views](https://github.com/sylesh29/voice-agent-eval/tree/main/frontend/app/runs): `frontend/app/runs`
- [Run comparison](https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/compare/page.tsx): `frontend/app/compare/page.tsx`
- [Failure patterns](https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/patterns/page.tsx): `frontend/app/patterns/page.tsx`
- [Calibration view](https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/calibration/page.tsx): `frontend/app/calibration/page.tsx`
- [Metric components](https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/ui.tsx): `frontend/app/ui.tsx`
- [Metric definitions](https://github.com/sylesh29/voice-agent-eval/blob/main/frontend/app/metrics.ts): `frontend/app/metrics.ts`

### Other components

- **Operator**
- **Reviewer**

## Connections

- Operator → Run CLI: starts run (evidence: `README.md`)
- Run CLI → Evaluation runner: invokes (evidence: `backend/voiceval/cli.py`)
- Evaluation runner → Scenario contracts: loads (evidence: `backend/voiceval/runner.py`)
- Evaluation runner → Agent versions: selects version (evidence: `backend/voiceval/runner.py`)
- Evaluation runner → Rule agent: runs (evidence: `backend/voiceval/runner.py`)
- Evaluation runner → Caller simulator: simulates (evidence: `backend/voiceval/runner.py`)
- Evaluation runner → Fault-injected tools: constructs (evidence: `backend/voiceval/runner.py`)
- Evaluation runner → Simulated world: builds (evidence: `backend/voiceval/runner.py`)
- Evaluation runner → Run trace: records (evidence: `backend/voiceval/runner.py`)
- Rule agent → Agent versions: reads policy (evidence: `backend/voiceval/agents/rule_agent.py`)
- Rule agent → Caller simulator: exchanges turns (evidence: `backend/voiceval/agents/rule_agent.py`)
- Rule agent → Fault-injected tools: calls tools (evidence: `backend/voiceval/agents/rule_agent.py`)
- Rule agent → Run trace: records outcome (evidence: `backend/voiceval/agents/rule_agent.py`)
- Fault-injected tools → Simulated world: reads and mutates (evidence: `backend/voiceval/tools.py`)
- Scenario contracts → Simulated world: builds fixture (evidence: `backend/voiceval/scenario.py`)
- Evaluation runner → State metrics: evaluates trace
- Evaluation runner → Closure evaluation: evaluates closure
- Closure evaluation → State metrics: uses state checks (evidence: `backend/voiceval/evaluators/closure.py`)
- Closure evaluation → Language judge: requests judgment (evidence: `backend/voiceval/evaluators/closure.py`)
- Evaluation runner → Metric aggregation: aggregates results
- Evaluator calibration → Closure evaluation: calibrates evaluator
- Mix sensitivity → Metric aggregation: analyzes mix
- Read/write API → Run database: reads and writes (evidence: `backend/app/main.py`)
- Reviewer → Run views: reviews runs (evidence: `README.md`)
- Reviewer → Run comparison: compares runs (evidence: `README.md`)
- Reviewer → Failure patterns: inspects patterns (evidence: `README.md`)
- Reviewer → Calibration view: reviews calibration (evidence: `README.md`)
- Run views → Metric components: renders (evidence: `frontend/app/runs/[runId]/page.tsx`)
- Run comparison → Metric components: renders (evidence: `frontend/app/compare/page.tsx`)
- Run comparison → Metric definitions: uses labels (evidence: `frontend/app/compare/page.tsx`)
- Failure patterns → Metric components: renders (evidence: `frontend/app/patterns/page.tsx`)
- Failure patterns → Metric definitions: uses labels (evidence: `frontend/app/patterns/page.tsx`)
- Calibration view → Metric components: renders (evidence: `frontend/app/calibration/page.tsx`)
