# Class AbTestTracker

A/B Test Tracker implementation. Provides experiment management with deterministic variant assignment.

#### Implements

- IAbTestTracker

- Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:33

##### Index

### Constructors

constructor

### Methods

createExperiment
startExperiment
pauseExperiment
completeExperiment
assignVariant
recordOutcome
getSummary
listExperiments
getExperiment
exportData

## Constructors

### constructor

- new AbTestTracker(): AbTestTracker

  #### Returns AbTestTracker

## Methods

### createExperiment

- createExperiment(
  definition: Omit<
  ExperimentDefinition,
  "status"
  | "startedAt"
  | "endedAt",
  >,
  ): ExperimentDefinition

  Create a new experiment.

  #### Parameters

  - definition: Omit<ExperimentDefinition, "status" | "startedAt" | "endedAt">

  #### Returns ExperimentDefinition

  Implementation of IAbTestTracker.createExperiment

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:40

### startExperiment

- startExperiment(experimentId: string): void

  Start an experiment (sets status to running).

  #### Parameters

  - experimentId: string

  #### Returns void

  Implementation of IAbTestTracker.startExperiment

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:65

### pauseExperiment

- pauseExperiment(experimentId: string): void

  Pause a running experiment.

  #### Parameters

  - experimentId: string

  #### Returns void

  Implementation of IAbTestTracker.pauseExperiment

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:84

### completeExperiment

- completeExperiment(experimentId: string): void

  Complete an experiment.

  #### Parameters

  - experimentId: string

  #### Returns void

  Implementation of IAbTestTracker.completeExperiment

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:102

### assignVariant

- assignVariant(experimentId: string, traceId: string): ExperimentVariant | null

  Assign a variant for a given trace ID (deterministic assignment). Uses consistent hashing to ensure same trace ID always gets same variant.

  #### Parameters

  - experimentId: string
  - traceId: string

  #### Returns ExperimentVariant | null

  Implementation of IAbTestTracker.assignVariant

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:122

### recordOutcome

- recordOutcome(outcome: ExperimentOutcome): void

  Record an outcome for an experiment.

  #### Parameters

  - outcome: ExperimentOutcome

  #### Returns void

  Implementation of IAbTestTracker.recordOutcome

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:147

### getSummary

- getSummary(experimentId: string): ExperimentSummary | null

  Get experiment summary with statistics.

  #### Parameters

  - experimentId: string

  #### Returns ExperimentSummary | null

  Implementation of IAbTestTracker.getSummary

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:167

### listExperiments

- listExperiments(
  filter?: { status?: ExperimentStatus; tags?: readonly string[] },
  ): readonly ExperimentDefinition[]

  List all experiments.

  #### Parameters

  - `Optional` filter: { status?: ExperimentStatus; tags?: readonly string[] }

  #### Returns readonly ExperimentDefinition[]

  Implementation of IAbTestTracker.listExperiments

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:192

### getExperiment

- getExperiment(experimentId: string): ExperimentDefinition | null

  Get experiment by ID.

  #### Parameters

  - experimentId: string

  #### Returns ExperimentDefinition | null

  Implementation of IAbTestTracker.getExperiment

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:213

### exportData

- exportData(): ExperimentExport

  Export all experiment data.

  #### Returns ExperimentExport

  Implementation of IAbTestTracker.exportData

  - Defined in packages/nexus-agents/src/learning/ab-test-tracker.ts:220