API Reference
Protocols
Section titled “Protocols”CheckpointStoreProtocol
Section titled “CheckpointStoreProtocol”Digest-verified persistence of run checkpoints.
Persist a checkpoint for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `slug` | str | Stable name of the checkpoint within the run. |
| `payload` | dict[str, Any] | State to checkpoint. |
| Type | Description |
|---|---|
| Checkpoint | The stored checkpoint with its content digest. |
Load a checkpoint, verifying its content digest.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `slug` | str | Checkpoint name. |
| Type | Description |
|---|---|
| Checkpoint | None | The verified checkpoint, or ``None`` when absent or tampered. |
List all checkpoints for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| list[Checkpoint] | Checkpoints in creation order. |
ExperimentTrackerProtocol
Section titled “ExperimentTrackerProtocol”Persistent, seed-stable tracking of experiment runs.
Implementations must derive a stable run id from the experiment config so rerunning the same seed and knobs resumes (or reproduces) the same run.
Start (or resume) an experiment run for the given config.
| Parameter | Type | Description |
|---|---|---|
| `config` | ExperimentConfig | Seed and knob configuration of the run. |
| Type | Description |
|---|---|
| ExperimentRun | The started or resumed run. |
Record a scalar metric for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `name` | str | Metric name. |
| `value` | float | Metric value. |
| `step` | int | Step index the metric was recorded at. Defaults to 0. |
Record an error for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `kind` | str | Error kind or code. |
| `message` | str | Human-readable error message. |
| `step` | int | Step index the error occurred at. Defaults to 0. |
Return all metric records for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| list[MetricRecord] | Metric records in recording order. |
Return all error records for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| list[ErrorRecord] | Error records in recording order. |
Return a compact summary of a run’s current state.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| dict[str, Any] | Latest value per metric, error counts, and run metadata. |
Return an already-started run, or None when unknown.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| ExperimentRun | None | The existing run, or ``None``. |
Mark a run finished.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `status` | RunStatus | Terminal status. Defaults to ``COMPLETED``. |
Classes
Section titled “Classes”AblationResult
Section titled “AblationResult”Delta comparison between a baseline and an ablated checkpoint.
Attributes: run_id: Run the ablation was performed on. knob: The configuration knob that was ablated. baseline_slug: Checkpoint slug of the baseline run. ablated_slug: Checkpoint slug of the ablated run. deltas: Per-metric differences (ablated minus baseline). digest: SHA-256 digest of the ablation inputs and deltas.
AblationRunner
Section titled “AblationRunner”Compare baseline and ablated checkpoints from a checkpoint store.
| Parameter | Type | Description |
|---|---|---|
| `store` | Checkpoint store holding the baseline and ablated payloads. |
Compute per-metric deltas (after minus before).
| Parameter | Type | Description |
|---|---|---|
| `before` | dict[str, float] | Baseline metrics (name to value). |
| `after` | dict[str, float] | Ablated metrics (name to value). |
| Type | Description |
|---|---|
| dict[str, float] | Metric name to delta mapping, including keys from either side. |
Compare a baseline checkpoint against an ablated one in one run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run the ablation was performed on. |
| `knob` | str | The configuration knob that was ablated. |
| `baseline_slug` | str | Checkpoint slug of the baseline run. |
| `ablated_slug` | str | Checkpoint slug of the ablated run. |
| Type | Description |
|---|---|
| Result[AblationResult, AblationError] | Ok(AblationResult) with per-metric deltas, or Err(AblationError) when either checkpoint is missing. |
Compare checkpoints across two runs (e.g. control vs ablated).
| Parameter | Type | Description |
|---|---|---|
| `knob` | str | The configuration knob that was ablated. |
| `baseline_run_id` | str | Run identifier of the baseline. |
| `baseline_slug` | str | Checkpoint slug of the baseline run. |
| `ablated_run_id` | str | Run identifier of the ablated run. |
| `ablated_slug` | str | Checkpoint slug of the ablated run. |
| Type | Description |
|---|---|
| Result[AblationResult, AblationError] | Ok(AblationResult) with per-metric deltas, or Err(AblationError) when either checkpoint is missing. |
Example
runner = AblationRunner(store)result = await runner.compare( "thinking", "probe-42-a1b2c3d4", "baseline", "probe-42-9f8e7d6c", "ablated-thinking",)AnalysisReport
Section titled “AnalysisReport”Aggregated error and score analysis for a completed run.
Attributes:
total_records: Number of metric records analyzed.
error_count: Number of error records analyzed.
error_kinds: Error kind to occurrence count mapping.
score_mean: Mean of records named score, or None.
score_min: Minimum of records named score, or None.
score_max: Maximum of records named score, or None.
top_errors: Most frequent error records, most frequent first.
BatchEvaluationResult
Section titled “BatchEvaluationResult”Result of running evaluation on multiple samples.
Contains aggregated results and per-sample details.
Checkpoint
Section titled “Checkpoint”Content-addressed checkpoint of run state.
Attributes: run_id: Run the checkpoint belongs to. slug: Stable name of the checkpoint within the run. digest: SHA-256 digest of the canonicalized payload. payload: Checkpointed state. created_at: ISO-8601 creation timestamp.
ErrorAnalysis
Section titled “ErrorAnalysis”Aggregate a run's tracked records into an analysis report.
| Parameter | Type | Description |
|---|---|---|
| `tracker` | Tracker holding the run's metric and error records. |
Produce an analysis report for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| AnalysisReport | Aggregated error kinds, score statistics, and top errors. |
| Exception | Description |
|---|---|
| AnalysisError | If the run is unknown to the tracker. |
ErrorRecord
Section titled “ErrorRecord”One error observed during an experiment run.
Attributes:
kind: Error kind or code (e.g. LLM_RATE_LIMITED).
message: Human-readable error message.
step: Iteration or step index the error occurred at.
EvaluationConfig
Section titled “EvaluationConfig”Configuration for the evaluation subsystem.
Attributes: enabled: Enable the AI evaluation subsystem. default_threshold: Default score threshold for passing evaluations. embedding_model: Model to use for embedding-based evaluations. include_metadata: Whether to include metadata in run reports. max_samples: Maximum number of samples per evaluation run. max_retries: Maximum retries for failed evaluations. timeout_seconds: Timeout for evaluation execution in seconds.
Example
config = EvaluationConfig( default_threshold=0.9, embedding_model="text-embedding-3-large")config = EvaluationConfig( default_threshold=0.9, embedding_model="text-embedding-3-large")EvaluationDataset
Section titled “EvaluationDataset”A collection of evaluation samples.
Attributes: name: Name of the dataset. samples: List of evaluation samples. metadata: Additional dataset metadata.
EvaluationModule
Section titled “EvaluationModule”Evaluation module for Oridecon applications.
Provides evaluator and harness support for AI model evaluation.
Usage
from oridecon.ai.evaluation import EvaluationModulefrom oridecon.ai.evaluation.config import EvaluationConfig
@module( imports=[EvaluationModule.configure(EvaluationConfig(...))])class AppModule(Module): passfrom oridecon.ai.evaluation import EvaluationModulefrom oridecon.ai.evaluation.config import EvaluationConfig
@module( imports=[EvaluationModule.configure(EvaluationConfig(...))])class AppModule(Module): passCreate an EvaluationModule with explicit configuration.
| Parameter | Type | Description |
|---|---|---|
| `config` | EvaluationConfig | None | EvaluationConfig or ``None`` for defaults. |
| Type | Description |
|---|---|
| DynamicModule | A DynamicModule descriptor. |
Create an EvaluationModule suitable for unit and integration testing.
Uses in-memory or no-op evaluator implementations with minimal side effects.
| Parameter | Type | Description |
|---|---|---|
| `config` | EvaluationConfig | None | Optional EvaluationConfig override. Uses safe test defaults when ``None``. |
| Type | Description |
|---|---|
| DynamicModule | A DynamicModule descriptor. |
EvaluationProvider
Section titled “EvaluationProvider”Registers evaluation services with the DI container.
EvaluationResult
Section titled “EvaluationResult”Result of an evaluation run on a single sample.
Attributes: score: The evaluation score (0.0 to 1.0). score_type: The type of scoring method used. feedback: Human-readable feedback about the evaluation. metrics: Additional metrics computed during evaluation.
EvaluationRunContext
Section titled “EvaluationRunContext”Context for a single evaluation run.
Holds the dataset, evaluator, and configuration for an evaluation run.
EvaluationSample
Section titled “EvaluationSample”A single sample in an evaluation dataset.
Attributes: id: Unique identifier for this sample. input: The input prompt or query. reference: The expected reference output. metadata: Additional metadata for this sample.
ExperimentConfig
Section titled “ExperimentConfig”Seed-and-config descriptor driving a reproducible experiment run.
Attributes: name: Experiment name; part of the derived run id. seed: Seed value; part of the derived run id. config: Knob configuration dict (canonical JSON order-insensitive). trials: Number of trials per run. Defaults to 1. metadata: Free-form run metadata.
ExperimentRun
Section titled “ExperimentRun”A started experiment run with its identity and config digest.
Attributes:
run_id: Stable identifier derived from name, seed, and config.
experiment: Experiment name.
seed: Seed value used for this run.
config: Knob configuration dict.
config_hash: SHA-256 digest of the canonicalized config.
status: Lifecycle status of the run.
started_at: ISO-8601 start timestamp.
finished_at: ISO-8601 finish timestamp, or None while running.
FileCheckpointStore
Section titled “FileCheckpointStore”Filesystem checkpoint store with digest verification.
| Parameter | Type | Description |
|---|---|---|
| `root` | Base directory for run artifacts. Defaults to ``runs``. |
Persist a checkpoint for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `slug` | str | Stable name of the checkpoint within the run. |
| `payload` | dict[str, Any] | State to checkpoint. |
| Type | Description |
|---|---|
| Checkpoint | The stored checkpoint with its content digest. |
| Exception | Description |
|---|---|
| CheckpointError | If the checkpoint cannot be written. |
Load a checkpoint, verifying its content digest.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `slug` | str | Checkpoint name. |
| Type | Description |
|---|---|
| Checkpoint | None | The verified checkpoint, or ``None`` when absent or tampered. |
List all checkpoints for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| list[Checkpoint] | Checkpoints in creation order. |
LocalTracker
Section titled “LocalTracker”JSON/JSONL-backed tracker persisting runs under ``
| Parameter | Type | Description |
|---|---|---|
| `root` | Base directory for run artifacts. Defaults to ``runs``. |
Start (or resume) an experiment run for the given config.
| Parameter | Type | Description |
|---|---|---|
| `config` | ExperimentConfig | Seed and knob configuration of the run. |
| Type | Description |
|---|---|
| ExperimentRun | The started or resumed run. |
| Exception | Description |
|---|---|
| TrackingError | If the run manifest cannot be persisted. |
Record a scalar metric for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `name` | str | Metric name. |
| `value` | float | Metric value. |
| `step` | int | Step index the metric was recorded at. Defaults to 0. |
| Exception | Description |
|---|---|
| TrackingError | If the metric line cannot be appended. |
Record an error for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `kind` | str | Error kind or code. |
| `message` | str | Human-readable error message. |
| `step` | int | Step index the error occurred at. Defaults to 0. |
| Exception | Description |
|---|---|
| TrackingError | If the error line cannot be appended. |
Return all metric records for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| list[MetricRecord] | Metric records in recording order. |
Return all error records for a run.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| list[ErrorRecord] | Error records in recording order. |
Return a compact summary of a run’s current state.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| dict[str, Any] | Latest value per metric, error counts, and run metadata. |
| Exception | Description |
|---|---|
| TrackingError | If the run is unknown. |
Return an already-started run, or None when unknown.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| Type | Description |
|---|---|
| ExperimentRun | None | The existing run, or ``None``. |
Mark a run finished.
| Parameter | Type | Description |
|---|---|---|
| `run_id` | str | Run identifier. |
| `status` | RunStatus | Terminal status. Defaults to ``COMPLETED``. |
| Exception | Description |
|---|---|
| TrackingError | If the run is unknown. |
MetricRecord
Section titled “MetricRecord”A single scalar metric recorded during an experiment run.
Attributes:
step: Iteration or step index the metric was recorded at.
name: Metric name (e.g. tokens, latency_ms, score).
value: Numeric metric value.
RunReport
Section titled “RunReport”Report from running an evaluator on a dataset.
Attributes: dataset_name: Name of the evaluated dataset. evaluator_name: Name of the evaluator used. total_samples: Total number of samples evaluated. passed_samples: Number of samples that passed the evaluation. average_score: Average score across all samples. results: Individual sample results. metadata: Additional report metadata.
RunStatus
Section titled “RunStatus”Lifecycle status of an experiment run.
Functions
Section titled “Functions”make_run_id
Section titled “make_run_id”Derive a deterministic run id from name, seed, and canonical config.
| Parameter | Type | Description |
|---|---|---|
| `name` | str | Experiment name. |
| `seed` | int | Seed value. |
| `config` | dict[str, Any] | Knob configuration dict. |
| Type | Description |
|---|---|
| str | Run id of the form `` |
Example
run_id = make_run_id("probe", 42, {"model": "gpt-4o"})assert run_id == make_run_id("probe", 42, {"model": "gpt-4o"})Exceptions
Section titled “Exceptions”AblationError
Section titled “AblationError”Raised when an ablation references unknown checkpoints.
AnalysisError
Section titled “AnalysisError”Raised when a run analysis cannot be produced.
CheckpointError
Section titled “CheckpointError”Raised when a checkpoint is missing or fails digest verification.
DatasetError
Section titled “DatasetError”Raised when there's an error with the evaluation dataset.
EvaluationConfigError
Section titled “EvaluationConfigError”Raised when evaluation configuration is invalid.
EvaluatorNotFoundError
Section titled “EvaluatorNotFoundError”Raised when a requested evaluator cannot be found.
HarnessError
Section titled “HarnessError”Raised when the evaluation harness encounters an error.
TrackingError
Section titled “TrackingError”Raised when experiment tracking cannot persist or read run state.