Building Block View
User-facing API: the Experiment CRD
Users do not author Testkube workflows directly. They submit an Experiment custom resource (testbench.agentic-layer.ai/v1alpha1) that declares the agent under test, the LLM judge, the dataset (inline, URL, or S3/MinIO), and optional triggers and schedules.
The Testbench operator (deployed in testbench-operator-system) watches Experiment resources and reconciles each one into:
-
A Testkube
TestWorkflowthat composes the fiveTestWorkflowTemplateresources installed in thetestkubenamespace -
A
ConfigMapholding the rendered Experiment JSON, mounted into the pipeline pods -
Optionally a
TestTrigger(whenspec.trigger.enabledis true) that re-runs the workflow whenever the referenced agent is redeployed
Field-level details live in Reference.
Pipeline Overview
The reconciled TestWorkflow runs a sequential 5-phase pipeline. Each phase reads input from the previous phase’s output via a shared data volume.
Phase 1: Setup
Purpose: Materialises a test dataset on the shared data volume.
Processing:
-
Resolves the dataset source from the Experiment: inline (mounted ConfigMap), HTTP URL, or S3/MinIO object
-
Parses CSV, JSON, or Parquet input into the canonical
ExperimentJSON model -
Writes
data/datasets/experiment.jsonto the shared data volume
Phase 2: Run
Purpose: Executes test queries against an agent via the A2A protocol and records responses.
Processing:
-
Initializes OpenTelemetry tracing
-
Loads the test dataset
-
For each dataset entry:
-
Creates an OpenTelemetry span
-
Sends the query to the agent via A2A
-
Records the response and trace ID
-
Phase 3: Evaluate
Purpose: Calculates evaluation metrics using the LLM-as-a-judge approach.
Processing:
-
Loads the experiment file
-
Connects to the AI Gateway for LLM access
-
Evaluates each row asynchronously
Phase 4: Publish
Purpose: Publishes per-sample evaluation metrics to an OTLP-compatible backend.
Processing:
-
Loads the evaluation results
-
Creates an OTLP metric exporter for HTTP transport
-
For each sample and metric, creates a gauge observation with attributes:
-
name— metric type (e.g.,"faithfulness") -
workflow_name— test workflow identifier -
execution_id— Testkube execution ID -
execution_number— numeric execution counter -
trace_id— links to the trace from the Run phase -
sample_hash— unique sample identifier -
user_input_truncated— first 50 characters of user input
-
-
Flushes all metrics to ensure immediate export
Phase 5: Visualize
Purpose: Generates a self-contained HTML dashboard from evaluation results and stores it as a Testkube workflow artifact.
Features:
-
Summary cards — total samples, metrics count, token usage, cost
-
Workflow metadata header — workflow name, execution ID, execution number
-
Overall scores bar chart — horizontal bars showing mean score per metric
-
Metric distribution histograms — per-metric score distributions with min/max/mean/median statistics
-
Detailed results table — all samples with per-metric scores, searchable and color-coded
-
Multi-turn conversation visualization — chat-bubble layout with color-coded message types
-
Self-contained HTML — works offline as a single file