ab-tests

Create A/B test

Create an A/B test as a draft for a deployed agent variant.

test_name must be a variant from GET /ab-tests/variants. Returns 409 when the agent already has a draft, running or paused test for that variant.

Required permission: ab_tests.create. With judges.view, the response also includes judge names.

post/v1/projects/{project_id}/ab-tests

Request

  • Base URL: https://api.connic.co
  • URL: https://api.connic.co/v1/projects/{project_id}/ab-tests
  • Auth: HTTP bearer

Path parameters

project_idstring uuid required

ID of the project the API key belongs to.

Query parameters

environment_idstring uuid required

Environment to run the test in.

Request body

agent_namestring required

Base (control) agent.

test_namestring required

Variant suffix. The active deployment must contain an agent named {agent_name}-test-{test_name}.

traffic_percentageinteger

Percentage of the agent's traffic routed to the variant. Confidence mode requires 1 to 99.

analysis_mode'exploratory' | 'confidence'

exploratory compares descriptive metrics; confidence follows a locked statistical plan with planned decision looks.

min_sample_sizeinteger

Completed runs needed in each group before the comparison reports enough data.

auto_rollback_enabledboolean

Pause the test automatically when the variant's failure rate exceeds rollback_threshold.

rollback_thresholdnumber

Variant failure rate (0 to 1) above which the failure guardrail pauses the test.

rollback_windowinteger

Number of most recent finished variant runs the failure guardrail evaluates.

quality_guardrail_enabledboolean

Pause the test when the variant's average judge score falls below quality_threshold. Requires quality_judge_id.

quality_judge_idstring uuid nullable

Judge for the quality guardrail. It must belong to the same agent and environment, be enabled and automatic, evaluate every run and have no filter.

quality_thresholdnumber

Lowest acceptable average normalized score (0 to 1) for the variant.

quality_windowinteger

Number of most recent evaluated variant runs the quality guardrail averages.

quality_min_evaluationsinteger

Evaluations needed before the quality guardrail can act. Cannot exceed quality_window.

Response

Successful Response

idstring uuid required
project_idstring uuid required

Project the test belongs to.

environment_idstring uuid required

Environment the test runs in.

agent_namestring required

Base (control) agent.

test_namestring required

Variant suffix.

variant_agent_namestring required

Variant agent name, {agent_name}-test-{test_name}.

traffic_percentageinteger required

Percentage of the agent's traffic routed to the variant.

status'draft' | 'running' | 'paused' | 'concluded' | 'rolled_back' | 'failed' required

A/B test state: draft until started, running while routing traffic, paused, concluded, or failed when the variant is missing from the active deployment. rolled_back is no longer set.

analysis_mode'exploratory' | 'confidence'

exploratory compares descriptive metrics; confidence follows a locked statistical plan with planned decision looks.

min_sample_sizeinteger required

Completed runs needed in each group before the comparison reports enough data.

auto_rollback_enabledboolean required

Whether the failure guardrail is on.

rollback_thresholdnumber required

Variant failure rate (0 to 1) above which the failure guardrail pauses the test.

rollback_windowinteger required

Number of most recent finished variant runs the failure guardrail evaluates.

quality_guardrail_enabledboolean

Whether the quality guardrail is on.

quality_judge_idstring uuid nullable

Judge for the quality guardrail. null when unset or without judges.view.

quality_thresholdnumber

Lowest acceptable average normalized score (0 to 1) for the variant.

quality_windowinteger

Number of most recent evaluated variant runs the quality guardrail averages.

quality_min_evaluationsinteger

Evaluations needed before the quality guardrail can act.

winner'control' | 'variant' nullable

Manually chosen winner of an exploratory test. null when none.

recommendation'collecting' | 'continue' | 'variant_recommended' | 'control_recommended' | 'inconclusive' | 'invalid_srm' | 'safety_stopped'

Test verdict: collecting before the first planned look, continue after a look without a decision, variant_recommended or control_recommended when a boundary was crossed, inconclusive, invalid_srm after a sample-ratio mismatch, or safety_stopped when the test was stopped automatically.

recommendation_reasonstring nullable

Explanation of recommendation.

errorstring nullable

Why the test was stopped automatically. Cleared when the test resumes.

stop_reason'manual' | 'failure_guardrail' | 'quality_guardrail' | 'efficacy' | 'futility' | 'srm' | 'analysis_error' | 'variant_unavailable'

Why a test stopped: manual, a guardrail (failure_guardrail, quality_guardrail), a planned look (efficacy when a boundary was crossed, futility when the final look was inconclusive), srm (sample-ratio mismatch), analysis_error (metric judge evaluations failed), or variant_unavailable.

stop_detailsobject

Details for stop_reason, such as the observed failure rate and window for failure_guardrail.

created_atstring date-time required
updated_atstring date-time required
started_atstring date-time nullable

When the test first started. null for drafts.

stopped_atstring date-time nullable

When the test was last paused or stopped. Cleared when it resumes.

concluded_atstring date-time nullable

When the test was concluded.

control_runsinteger

Completed control runs. Confidence tests exclude forced runs.

variant_runsinteger

Completed variant runs. Confidence tests exclude forced runs.

control_avg_costnumber nullable

Always null. Cost statistics are returned by the comparison endpoint.

variant_avg_costnumber nullable

Always null. Cost statistics are returned by the comparison endpoint.

control_avg_durationnumber nullable

Average duration of completed control runs, in milliseconds.

variant_avg_durationnumber nullable

Average duration of completed variant runs, in milliseconds.

control_avg_scorenumber nullable

Average normalized judge score (0 to 1) of control runs, from the metric or quality judge when set. null without evaluations.

variant_avg_scorenumber nullable

Average normalized judge score (0 to 1) of variant runs, from the metric or quality judge when set. null without evaluations.

Changes

No recorded changes to this operation across all 1 revision of this API.