Skip to main content

API Reference

Accessing the Experiments API

The ExperimentsClient is accessible as a property on the main Basalt client:

Methods

create_sync

Creates a new experiment synchronously.
Parameters:
  • feature_slug (str, required): A slug to identify the feature this experiment belongs to (e.g., “qa-model”, “recommendation-algo”).
  • name (str, required): A human-readable name for the experiment (e.g., “GPT-4 vs Claude Comparison”).
Returns: An Experiment object with:
  • id (str): Unique experiment identifier
  • name (str): Experiment name
  • feature_slug (str): Feature identifier
  • created_at (str): ISO 8601 timestamp of creation
Raises:
  • UnauthorizedError: Invalid or missing API key
  • BadRequestError: Invalid parameters
  • NetworkError: Network connectivity issues
  • BasaltAPIError: Other API errors
Example:

create (async)

Creates a new experiment asynchronously.
Async variant of create_sync. Same parameters and return type. Example:

Models

Experiment

Represents a registered experiment.

TraceExperiment

Represents experiment metadata attached to a trace. Used when attaching an experiment to a span.
All fields except id are optional. Example: