# seraphimserapis/tool-eval-bench architecture

> Architecture diagram of the GitHub repository seraphimserapis/tool-eval-bench, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seraphimserapis/tool-eval-bench
- Repository: https://github.com/seraphimserapis/tool-eval-bench

## Overview

tool-eval-bench benchmarks LLM tool-calling quality against mock-tool scenarios, with throughput, long-context retrieval, and accuracy benchmarks also documented. The main workflow selects scenarios, configures and identifies a backend, runs multi-turn conversations, scores results, and persists reports and SQLite records. The graph also includes history/comparison and extensible evaluation plugins. Some feature internals are unsampled; those branches use documented capabilities and directory paths, while unverified links are dashed.

Main entry points: [`src/tool_eval_bench/application/service.py`](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/service.py) (Run service), [`src/tool_eval_bench/runner/orchestrator.py`](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/runner/orchestrator.py) (Scenario runner), [`src/tool_eval_bench/storage/db.py`](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/storage/db.py) (SQLite records), [`src/tool_eval_bench/adapters/openai_compat.py`](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/adapters/openai_compat.py) (Provider adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI commands<br/>[commands.py]"]
  node_public_api["Python API<br/>[api.py]"]
end

subgraph group_execution["Run execution"]
  node_config["Run configuration<br/>[run_config.py]"]
  node_context["Backend context<br/>[run_context.py]"]
  node_metadata["Engine metadata<br/>[metadata.py]"]
  node_engine_profiles["Engine profiles<br/>[engines.py]"]
  node_service["Run service<br/>[service.py]"]
  node_orchestrator["Scenario runner<br/>[orchestrator.py]"]
  node_adapter_contract["Backend contract<br/>[adapters.py]"]
  node_adapters["Provider adapters<br/>[openai_compat.py]"]
  node_wire_format["Wire formats<br/>[wire_format.py]"]
end

subgraph group_evaluation["Evaluation content"]
  node_scenario_types["Scenario model<br/>[scenarios.py]"]
  node_scenario_catalog["Scenario catalog"]
  node_tools["Mock tools<br/>[tools.py]"]
  node_decision_audit["Decision audit<br/>[decision_audit.py]"]
  node_plugins["Benchmark plugins"]
  node_hf_utils["Dataset utilities<br/>[hf_utils.py]"]
end

subgraph group_benchmarks["Other benchmarks"]
  node_other_runners["Perf and retrieval"]
end

subgraph group_results["Results and analysis"]
  node_db[("SQLite records<br/>[db.py]")]
  node_reports["Markdown reports"]
  node_compare["Run comparisons"]
  node_history["History and rankings<br/>[history.py]"]
end

node_cli_user(("CLI user"))
node_api_user(("API consumer"))
node_endpoint{{"Model endpoint"}}

node_cli_user -.->|"invokes"| node_cli
node_api_user -->|"calls"| node_public_api
node_cli -.->|"starts runs"| node_service
node_public_api -->|"detects backend"| node_context
node_public_api -->|"runs benchmark"| node_service
node_config -->|"resolves scenarios"| node_scenario_types
node_context -->|"probes engine"| node_metadata
node_metadata -->|"uses profiles"| node_engine_profiles
node_service -->|"builds run"| node_config
node_service -->|"runs scenarios"| node_orchestrator
node_service -->|"persists runs"| node_db
node_service -->|"writes reports"| node_reports
node_service -->|"loads scenarios"| node_scenario_catalog
node_orchestrator -->|"requests completions"| node_adapter_contract
node_adapters -.->|"sends requests"| node_endpoint
node_adapters -->|"implements"| node_adapter_contract
node_adapters -->|"translates formats"| node_wire_format
node_orchestrator -->|"evaluates turns"| node_scenario_types
node_orchestrator -->|"executes calls"| node_tools
node_scenario_catalog -->|"registers scenarios"| node_scenario_types
node_service -->|"audits decisions"| node_decision_audit
node_plugins -->|"uses dataset helpers"| node_hf_utils
node_service -->|"runs additional benches"| node_other_runners
node_cli -.->|"queries past runs"| node_history
node_history -.->|"reads records"| node_db
node_compare -.->|"compares persisted runs"| node_db
node_reports -->|"records results"| node_db

click node_cli "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/cli/commands.py"
click node_public_api "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/api.py"
click node_config "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/run_config.py"
click node_context "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/run_context.py"
click node_metadata "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/utils/metadata.py"
click node_engine_profiles "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/engines.py"
click node_service "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/service.py"
click node_orchestrator "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/runner/orchestrator.py"
click node_adapter_contract "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/adapters.py"
click node_adapters "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/adapters/openai_compat.py"
click node_wire_format "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/adapters/wire_format.py"
click node_scenario_types "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/scenarios.py"
click node_scenario_catalog "https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/evals/scenarios"
click node_tools "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/tools.py"
click node_decision_audit "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/decision_audit.py"
click node_plugins "https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/plugins"
click node_hf_utils "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/plugins/hf_utils.py"
click node_other_runners "https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/runner"
click node_db "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/storage/db.py"
click node_reports "https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/storage/reports"
click node_compare "https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/compare_reports"
click node_history "https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/cli/history.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_cli,node_public_api,node_cli_user toneBlue
class node_config,node_context,node_metadata,node_engine_profiles,node_service,node_orchestrator,node_adapter_contract,node_adapters,node_wire_format toneAmber
class node_scenario_types,node_scenario_catalog,node_tools,node_decision_audit,node_plugins,node_hf_utils,node_api_user toneMint
class node_other_runners toneRose
class node_db,node_reports,node_compare,node_history,node_endpoint toneIndigo
```

## Components

### Entry points

- [CLI commands](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/cli/commands.py): `src/tool_eval_bench/cli/commands.py`
- [Python API](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/api.py): `src/tool_eval_bench/api.py`

### Run execution

- [Run configuration](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/run_config.py): `src/tool_eval_bench/application/run_config.py`
- [Backend context](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/run_context.py): `src/tool_eval_bench/application/run_context.py`
- [Engine metadata](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/utils/metadata.py): `src/tool_eval_bench/utils/metadata.py`
- [Engine profiles](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/engines.py): `src/tool_eval_bench/domain/engines.py`
- [Run service](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/service.py): `src/tool_eval_bench/application/service.py`
- [Scenario runner](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/runner/orchestrator.py): `src/tool_eval_bench/runner/orchestrator.py`
- [Backend contract](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/adapters.py): `src/tool_eval_bench/domain/adapters.py`
- [Provider adapters](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/adapters/openai_compat.py): `src/tool_eval_bench/adapters/openai_compat.py`
- [Wire formats](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/adapters/wire_format.py): `src/tool_eval_bench/adapters/wire_format.py`

### Evaluation content

- [Scenario model](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/scenarios.py): `src/tool_eval_bench/domain/scenarios.py`
- [Scenario catalog](https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/evals/scenarios): `src/tool_eval_bench/evals/scenarios`
- [Mock tools](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/domain/tools.py): `src/tool_eval_bench/domain/tools.py`
- [Decision audit](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/application/decision_audit.py): `src/tool_eval_bench/application/decision_audit.py`
- [Benchmark plugins](https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/plugins): `src/tool_eval_bench/plugins`
- [Dataset utilities](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/plugins/hf_utils.py): `src/tool_eval_bench/plugins/hf_utils.py`

### Other benchmarks

- [Perf and retrieval](https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/runner): `src/tool_eval_bench/runner`

### Results and analysis

- [SQLite records](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/storage/db.py): `src/tool_eval_bench/storage/db.py`
- [Markdown reports](https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/storage/reports): `src/tool_eval_bench/storage/reports`
- [Run comparisons](https://github.com/seraphimserapis/tool-eval-bench/tree/main/src/tool_eval_bench/compare_reports): `src/tool_eval_bench/compare_reports`
- [History and rankings](https://github.com/seraphimserapis/tool-eval-bench/blob/main/src/tool_eval_bench/cli/history.py): `src/tool_eval_bench/cli/history.py`

### Other components

- **CLI user**
- **API consumer**
- **Model endpoint**

## Connections

- CLI user → CLI commands: invokes
- API consumer → Python API: calls (evidence: `src/tool_eval_bench/api.py`)
- CLI commands → Run service: starts runs
- Python API → Backend context: detects backend (evidence: `src/tool_eval_bench/api.py`)
- Python API → Run service: runs benchmark (evidence: `src/tool_eval_bench/api.py`)
- Run configuration → Scenario model: resolves scenarios (evidence: `src/tool_eval_bench/application/run_config.py`)
- Backend context → Engine metadata: probes engine (evidence: `src/tool_eval_bench/application/run_context.py`)
- Engine metadata → Engine profiles: uses profiles (evidence: `src/tool_eval_bench/utils/metadata.py`)
- Run service → Run configuration: builds run (evidence: `src/tool_eval_bench/application/service.py`)
- Run service → Scenario runner: runs scenarios (evidence: `src/tool_eval_bench/application/service.py`)
- Run service → SQLite records: persists runs (evidence: `src/tool_eval_bench/application/service.py`)
- Run service → Markdown reports: writes reports (evidence: `src/tool_eval_bench/application/service.py`)
- Run service → Scenario catalog: loads scenarios (evidence: `src/tool_eval_bench/application/service.py`)
- Scenario runner → Backend contract: requests completions (evidence: `src/tool_eval_bench/runner/orchestrator.py`)
- Provider adapters → Model endpoint: sends requests
- Provider adapters → Backend contract: implements (evidence: `src/tool_eval_bench/adapters/factory.py`)
- Provider adapters → Wire formats: translates formats (evidence: `src/tool_eval_bench/adapters/factory.py`)
- Scenario runner → Scenario model: evaluates turns (evidence: `src/tool_eval_bench/runner/orchestrator.py`)
- Scenario runner → Mock tools: executes calls (evidence: `src/tool_eval_bench/runner/orchestrator.py`)
- Scenario catalog → Scenario model: registers scenarios (evidence: `src/tool_eval_bench/evals/scenarios/__init__.py`)
- Run service → Decision audit: audits decisions (evidence: `src/tool_eval_bench/application/service.py`)
- Benchmark plugins → Dataset utilities: uses dataset helpers (evidence: `src/tool_eval_bench/plugins/gsm8k/plugin.py`)
- Run service → Perf and retrieval: runs additional benches (evidence: `src/tool_eval_bench/application/service.py`)
- CLI commands → History and rankings: queries past runs
- History and rankings → SQLite records: reads records
- Run comparisons → SQLite records: compares persisted runs
- Markdown reports → SQLite records: records results (evidence: `src/tool_eval_bench/api.py`)
