Evaluation harness
The HDX evaluation harness measures how well an AI agent uses observability tools to answer a defined task. It creates repeatable telemetry with known signals and noise, lets the agent use one or more MCP servers, grades the result, and produces a comparison report for each run set.
Evaluation flow
The harness turns a scenario into a controlled experiment. Seeding fixes the data, the run phase fixes the agent and tool choices, and grading compares the observed answer with the scenario facts.
flowchart LR
A[Scenario and ground truth] --> B[Seed telemetry]
B --> C[Select MCPs models and plugins]
C --> D[Run isolated agent]
D --> E[Record trajectory]
E --> F[Programmatic checks and judge]
F --> G[Aggregate batch]
G --> H[Markdown and JSON report]
The package is MCP-agnostic. A batch can compare HyperDX with raw ClickHouse access or compare any configured MCPs, models, or Claude Code plugins against a chosen baseline. The telemetry ingestion and storage page explains the production data path that the seeded data is designed to resemble.
Command surface
Setup and data commands
The CLI prepares the connections that make the same scenario data visible through different tool surfaces. Setup is idempotent, so it can create or validate the evaluation account, ClickHouse connection, and per-scenario sources before a run.
| Command | Purpose |
|---|---|
setup-hyperdx | Register or log in, create the ClickHouse connection and scenario sources, then write eval.config.json. |
setup-hyperdx --check | Check configuration, HyperDX MCP reachability, ClickHouse reachability, and uv availability. |
list | Show the registered scenarios, their prompts, and their data tables. |
seed <scenario> | Rebuild one scenario's ClickHouse data with a selected seed and time anchor. |
drop <scenario> | Remove one scenario's evaluation tables. |
The main setup command is yarn workspace @hyperdx/hdx-eval dev setup-hyperdx. The development and test workflows page covers the dev stack that must be running around this command.
References: packages/…/cli.ts• L163-283 packages/…/cli.ts• L285-379 packages/…/setup.ts• L38-212
Run, grade, and report commands
The run command is the normal entry point for an experiment. It can seed missing data, execute a matrix of agent runs, grade the results, and write a report unless those later steps are disabled.
| Command | Purpose |
|---|---|
run <scenario> | Execute the agent against the selected MCP, model, and plugin variants. |
runs-list | List recorded batches. |
runs-show <path> | Inspect one trajectory, with optional tool queries and final answer. |
runs-instrument <batch> | Add ClickHouse query-log timing evidence to recorded runs. |
grade <batch> | Apply checks and the LLM judge to recorded runs. |
report <batch> | Rebuild the Markdown and JSON batch summaries. |
Important run choices include --mcp, --model, --plugin, --runs, --baseline, --concurrency, --max-turns, --timeout, and --prompt-variant. --no-grade and --no-report split the lifecycle when an engineer wants to inspect or process a batch later. The external interfaces and automation page provides the wider context for automation-facing interfaces.
References: packages/…/cli.ts• L381-475 packages/…/cli.ts• L892-1119 packages/…/README.md• L282-347
Scenario model
Scenario catalog
Each scenario defines an operational question, a planted explanation, a data generator, and a rubric. The data includes distractors on purpose, so success requires useful investigation rather than a keyword match.
| Scenario | Evaluation goal |
|---|---|
error-root-cause | Trace a checkout failure to a payment dependency while rejecting unrelated errors. |
deploy-regression | Find a rollout-linked checkout regression through pod and promo-code segments. |
latency-spike | Find a latency increase limited to a tenant and endpoint segment. |
metric-saturation | Follow a metrics-only heap, garbage-collection, latency, and restart chain. |
noisy-signals | Separate useful log patterns from equally common noise. |
quiet-saturation | Find a slow connection-pool leak and distinguish its delayed user impact from nearby noise. |
segmented-regression | Find an error increase visible only at the intersection of two attributes. |
service-health-check | Report new signals without escalating steady or recurring behavior. |
dashboard-build | Build and verify useful dashboards while filtering internal and misleading traffic. |
quiet-saturation is the middle case for metric use. Metrics provide a much faster path to the full diagnosis, but traces and logs can still provide enough evidence at a higher investigation cost. Its ground truth also separates the leak start from the later pool saturation and visible slowdown.
The scenario registry is the single selection point for the CLI. A scenario can also change the agent prompt, allowed tools, judge instructions, or post-run inspection when its task is not a standard investigation.
References: packages/…/index.ts• L1-34 packages/…/types.ts• L96-155 packages/…/generate.ts• L483-525 packages/…/ground-truth.json• L1-20 packages/…/README.md• L254-269
Telemetry generation
Scenario generators create OpenTelemetry-shaped traces, logs, and, where needed, metrics. They spread normal traffic over a time window, add a known signal, and add realistic noise or confounding signals that test service, time, attribute, and signal selection.
Generators return batches rather than one large data set. This keeps large scenarios usable while preserving the same logical dataset. Background volume can be reduced with --volume-factor; planted diagnostic signals stay present so the scenario's key relationships remain valid at lower volume.
The quiet-saturation generator makes a three-hour order-service history with a steadily filling database connection pool. It keeps request traffic and host resources steady while it adds a feature-flag event, delayed acquire waits, fast database queries, timeout failures, and unrelated service signals. This makes the distinction between a client-side pool limit and a slow database part of the scenario's core question.
The shared generator types cover trace identity and parent links, log severity and bodies, and gauge, sum, histogram, exponential-histogram, and summary metrics. Scenario ground truth describes what the grader expects the agent to find or reject.
References: packages/…/types.ts• L13-45 packages/…/types.ts• L96-110 packages/…/types.ts• L1-113 packages/…/seedScenario.ts• L62-112 packages/…/generate.ts• L231-440 packages/…/generate.ts• L578-797
Deterministic time and data
The harness treats a seed and an anchor time as the identity of a data set. All generator choices use the seeded random source, while the anchor fixes the meaning of relative time in both the records and the agent prompt. The same pair produces byte-identical row content, which makes MCP comparisons fair.
The first run saves an anchor in eval.config.json and later runs reuse it. A new anchor needs a reseed to make the data match it. --live deliberately uses wall-clock time and forces a reseed. An old saved anchor does not refresh by itself, because stable cached data is more useful for repeated comparison than a new seed on every day.
Source descriptions have one special limit: value samples use a recent wall-clock window, not the saved anchor. The agent is told to trust the schema but discover old values with queries against the anchored time window.
References: packages/…/seeded.ts• L1-57 packages/…/config.ts• L147-175 packages/…/cli.ts• L589-705 packages/…/systemPrompt.ts• L7-29
Backend adapters
ClickHouse data plane
The ClickHouse adapter is the data-side control plane for seeding and inspection. It creates an isolated set of tables for each scenario with the standard OpenTelemetry shape, clears old rows before a seed, inserts trace, log, and metric batches, and maintains metadata rollups used by HyperDX discovery.
The direct ClickHouse connection is also used to check whether a scenario is already seeded and to read query-log timing after a batch. Evaluation tables are separate from the normal source tables, so reseeding a scenario does not mix its records with other test data.
References: packages/…/client.ts• L4-35 packages/…/schema.ts• L32-63 packages/…/schema.ts• L99-134 packages/…/insert.ts• L37-53 packages/…/seedScenario.ts• L70-111
HyperDX product plane
The HyperDX adapter makes the same data available through the product's API and MCP. Setup creates one connection and trace, log, and metric sources for every scenario. Each source points to that scenario's evaluation tables and applies the same query limit used by the ClickHouse MCP.
The run config stores both MCP definitions and the source IDs. The HyperDX MCP uses HTTP with account access-key auth. The raw ClickHouse MCP uses a local stdio process. This lets the harness compare a product-aware interface with direct SQL access without changing the scenario data.
Dashboard scenarios use the HyperDX API after the agent finishes. The harness fetches created dashboards, checks their tiles and data, supplies that evidence to the judge, and removes the temporary artifacts.
References: packages/…/setup.ts• L38-212 packages/…/config.ts• L27-61 packages/…/api.ts• L32-39 packages/…/generate.ts• L480-539
Agent harness
Agent isolation
Each run starts Claude Code in a fresh temporary working directory with only the selected MCP tools and a narrowly scoped Read capability. The agent cannot inspect source code, prior runs, the config, or ground truth, so its result must come from the observability interface under test.
The harness writes a per-run MCP connection description and settings. It limits built-in tools, applies scenario-specific tool allowances, and can load one configured plugin. The baseline prompt supports direct investigation; the hypothesis variant asks the agent to list possible causes and use parallel subagents when that helps.
References: packages/…/claudeSpawn.ts• L69-133 packages/…/settingsFile.ts• L4-97 packages/…/mcpConfig.ts• L9-45 packages/…/systemPrompt.ts• L38-61
Trajectory capture
Claude Code emits a stream of events for tool use, tool results, messages, usage, and completion. The harness turns that stream into one run record with the final answer, tool calls, errors, tokens, duration, termination state, and raw messages.
An optional instrumentation pass joins tool-call time windows with ClickHouse query_log entries. This adds evidence about server query time, rows read, and inference time without changing the agent score.
References: packages/…/streamParser.ts• L51-125 packages/…/runRun.ts• L43-99 packages/…/runRun.ts• L119-228 packages/…/instrument.ts• L34-44
Reachability checks
Before costly seeding or agent work, the default run path checks each HTTP MCP with an initialize handshake and a tool listing. A reachable server with no tools is treated as a failure because it would create misleading zero-tool runs. Stdio MCPs are checked only when Claude Code starts them.
References: packages/…/preflight.ts• L68-83 packages/…/preflight.ts• L186-199 packages/…/cli.ts• L629-659
Grading model
Outcome checks
The rubric lives with each scenario's ground truth. Programmatic checks match required facts in the final answer and can also require that a known distractor is not blamed. Optional adoption checks measure whether tool-call arguments mention target metrics; they measure tool use and do not raise the outcome score.
Adoption checks inspect the input arguments of a single tool call. They do not depend on the tool name or its output, so a metric named in a raw SQL request counts in the same way as a metric named in a dedicated metric request. Informational checks are reported for usage visibility but do not contribute to the adoption score.
Rubric loading validates the required answer checks and judge criteria. Adoption checks use metric-name lists rather than answer-match tuples, and can add a second pattern when a metric must appear with related query content.
The grader also counts agent-attributable tool errors. Transport failures and other infrastructure faults are excluded from this count, while repeated invalid or failed agent requests reduce the final score.
References: packages/…/rubric.ts• L5-14 packages/…/rubric.ts• L59-159 packages/…/programmatic.ts• L15-69 packages/…/programmatic.ts• L70-112 packages/…/programmatic.ts• L115-149 packages/…/grade.ts• L29-76
Judge and artifact checks
The LLM judge scores scenario-specific criteria on a 0–5 scale. It sees the question, ground-truth facts, rubric, and candidate answer. MCP names and brand terms are replaced with neutral labels so the judge evaluates the answer rather than the product identity.
When a scenario creates an artifact such as a dashboard, a post-run inspection adds evidence from the real artifact and its query results. The judge can then score what exists instead of trusting the agent's claim that it created a correct artifact. Judge results are cached per run and are refreshed when the judge model changes or when --rerun-judge is used.
References: packages/…/judge.ts• L42-65 packages/…/judge.ts• L99-185 packages/…/blind.ts• L19-63 packages/…/grade.ts• L272-329
Score composition
The combined score balances answer facts with judged quality and then subtracts a bounded tool-error penalty. Adoption is reported beside the outcome score so an engineer can study tool choice without allowing tool usage alone to inflate correctness.
| Component | Role |
|---|---|
| Programmatic score | 40% of the combined score. |
| Judge score | 60% when a valid judge result exists. |
| Tool-error penalty | Up to 20 percentage points for agent-attributable tool failures. |
| Adoption score | Separate usage measure. It is not part of the combined score. |
If the judge is skipped or fails, the programmatic result remains the outcome base. This makes cheap regrades possible while making a judge-backed score and a programmatic-only score visibly different in the records.
References: packages/…/types.ts• L105-148 packages/…/grade.ts• L332-361 packages/…/judgeModel.ts• L25-31
Batch orchestration
Run matrix
The CLI expands the selected MCPs, models, plugins, and repeat count into independent cells. Each cell runs the same scenario data with one agent configuration, which gives reports a stable comparison key and allows limited parallelism without changing the experiment definition.
The default baseline is the first selected combination. --baseline can name another column, and reports express every challenger as challenger minus baseline. This supports A/B comparisons across HyperDX instances, raw ClickHouse, model choices, and plugin variants.
References: packages/…/cli.ts• L528-562 packages/…/cli.ts• L707-812 packages/…/aggregate.ts• L86-113
Run persistence
Each completed cell is stored as a JSON trajectory under a time-stamped batch. Grade data is stored beside it as a grade sidecar, and optional query timing is stored as a timing sidecar. The batch remains useful when some cells fail, because the orchestrator records failures and continues with the other cells.
The run record includes the seed, scenario, MCP, model, plugin, prompt, termination state, tool calls, answer, usage, and cost. These fields let later grading and report generation work without rerunning the agent.
References: packages/…/path.ts• L6-47 packages/…/store.ts• L8-40 packages/…/cli.ts• L747-825 packages/…/types.ts• L88-116
Report model
Batch aggregation
The report builder pairs each run with its grade, groups pairs by scenario and comparison column, and calculates means and pass rates. It also keeps judge criteria, programmatic checks, adoption, tool errors, token use, duration, and termination counts visible beside the main score.
Comparison columns include an MCP name and add model or plugin names only when that dimension varies. A persisted baseline keeps later report regeneration from changing delta signs because of a different discovery order. Adoption summaries include per-check usage rates and identify informational checks that are excluded from the adoption mean.
References: packages/…/store.ts• L17-73 packages/…/aggregate.ts• L110-205 packages/…/aggregate.ts• L208-319
Report outputs
report <batch> writes a Markdown summary for humans and a JSON summary for tooling or the viewer. The Markdown starts with a top-line verdict, then gives per-scenario metrics and optional judge, programmatic, and adoption breakdowns. Deltas always use the selected baseline.
The Markdown view shows adoption as a separate tool-use row when a scenario has adoption data. Its per-check table marks informational checks and keeps them out of the adoption score. The viewer can use the same batch data to move from comparison results to individual trajectories. This makes the report a decision aid, while the run JSON remains the source for detailed investigation.
References: packages/…/markdown.ts• L9-55 packages/…/markdown.ts• L58-174 packages/…/markdown.ts• L237-270 packages/…/store.ts• L56-73 packages/…/README.md• L379-390
Change checklist
When these files or sections are changed, remember to consider these:
- Add a new scenario to the registry and its ground truth before expecting
list,seed,run, grading, or source setup to recognize it. - Keep generator row shapes, ClickHouse insert mappings, and HyperDX source mappings aligned when a signal or field changes.
- Keep the seed anchor and the agent's fixed-time prompt aligned when changing time windows. A prompt-only change can make correct data appear empty.
- Keep MCP tool patterns, denied tools, scenario-specific allowances, and blinding terms aligned when changing the tool surface.
- Keep rubric criterion IDs stable when possible. Reports use those IDs for per-check and per-criterion aggregation.
- Keep adoption metric names and any related patterns aligned with the tool-call arguments that the scenario expects. Informational checks must remain separate from scored adoption checks.
- Preserve the run and grade sidecar relationship when changing batch paths. Report generation only includes runs with a matching grade sidecar.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| eval.config.json is missing or has no valid MCP registry | run cannot select an MCP and stops before agent work | Run setup-hyperdx or repair the config before running. |
| An HTTP MCP is down or advertises no tools | Preflight aborts the whole batch instead of recording misleading zero-tool runs | Start the matching dev slot and use setup-hyperdx --check; bypass only when the failure is intentional. |
| The saved anchor changes without reseeding | The agent queries the new time while ClickHouse still holds the old data | Pair --anchor-time with --reseed, or keep the saved anchor. |
| A seeded anchor is older than the source sample window | Source value samples can be empty even though the schema and rows exist | Use anchored queries to discover values. |
| HyperDX sources point to the wrong scenario tables or IDs | HyperDX and raw ClickHouse arms observe different data | Recreate sources with --reset-sources after table or source mapping changes. |
| A judge provider key is absent | LLM grading stops unless the caller selects programmatic-only grading | Set the provider key or pass --no-judge. |
| An adoption rubric uses an unsupported tuple or lacks valid metric names | Rubric loading fails before the run can be graded | Use an adoption object with a non-empty metrics list and validate any optional pattern. |
| Agent tool calls fail repeatedly or exceed the query limit | The run loses time and receives a tool-error penalty | Inspect runs-show --queries, then improve the query or tool selection. |
| A run has no matching .grade.json sidecar | The run is omitted from the batch summary | Grade the batch before rendering the report. |
Key files
| File | Why to read it |
|---|---|
| packages/…/README.md | Quick start, command reference, scenario list, determinism rules, and report interpretation. |
| packages/…/cli.ts | End-to-end command surface and batch lifecycle. |
| packages/…/index.ts | Scenario registry and selection behavior. |
| packages/…/types.ts | Shared contract for data generation, prompts, rubrics, and post-run inspection. |
| packages/…/seedScenario.ts | Boundary between scenario batches and ClickHouse seeding. |
| packages/…/generate.ts | A complete scenario model for delayed pool saturation, distractors, and metric-versus-trace investigation cost. |
| packages/…/ground-truth.json | Expected diagnosis, distractors, answer checks, adoption checks, and judge criteria for the quiet-saturation scenario. |
| packages/…/schema.ts | Scenario table isolation and metadata support. |
| packages/…/setup.ts | HyperDX connection and source setup for the product-facing arm. |
| packages/…/runRun.ts | One agent cell from prompt construction to run record. |
| packages/…/grade.ts | Full grading sequence and combined-score calculation. |
| packages/…/programmatic.ts | Final-answer checks and separate metric-adoption checks. |
| packages/…/rubric.ts | Ground-truth rubric loading and validation. |
| packages/…/aggregate.ts | Batch grouping, baseline selection, and deltas. |
| packages/…/markdown.ts | Human-readable report shape and score breakdowns. |