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
  • Auth
    HTTP bearer

Path parameters

project_id, string uuid required

ID of the project the API key belongs to.

Query parameters

environment_id, string uuid required

Environment to run the test in.

Request body

ABTestCreate required

Creates a draft A/B test for a variant in the environment's active deployment.

agent_name, string required

Base (control) agent.

test_name, string required

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

traffic_percentage, integer

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

analysis_mode, 'exploratory' | 'confidence'

How results are analyzed. confidence requires analysis_plan.

analysis_plan, ABTestAnalysisPlanInput nullable

Assumptions for a confidence-mode A/B test plan. Metric values use a 0 to 1 scale.

min_sample_size, integer

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

auto_rollback_enabled, boolean

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

rollback_threshold, number

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

rollback_window, integer

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

quality_guardrail_enabled, boolean

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

quality_judge_id, string 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_threshold, number

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

quality_window, integer

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

quality_min_evaluations, integer

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

Response

Successful Response

ABTestResponse required

An A/B test that routes part of an agent's traffic to a variant, with run totals per arm.

id, string uuid required
project_id, string uuid required

Project the test belongs to.

environment_id, string uuid required

Environment the test runs in.

agent_name, string required

Base (control) agent.

test_name, string required

Variant suffix.

variant_agent_name, string required

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

traffic_percentage, integer required

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

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

Lifecycle state. Unless the test is running, all traffic goes to the base agent.

analysis_mode, 'exploratory' | 'confidence'

How results are analyzed. Fixed once the test leaves draft.

analysis_plan, ABTestAnalysisPlanResponse nullable

Statistical plan of a confidence-mode A/B test, locked when the test first starts.

min_sample_size, integer required

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

auto_rollback_enabled, boolean required

Whether the failure guardrail is on.

rollback_threshold, number required

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

rollback_window, integer required

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

quality_guardrail_enabled, boolean

Whether the quality guardrail is on.

quality_judge_id, string uuid nullable

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

quality_threshold, number

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

quality_window, integer

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

quality_min_evaluations, integer

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' nullable

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_reason, string nullable

Explanation of recommendation.

error, string 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' nullable

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_details, object

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

created_at, string date-time required
updated_at, string date-time required
started_at, string date-time nullable

When the test first started. null for drafts.

stopped_at, string date-time nullable

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

concluded_at, string date-time nullable

When the test was concluded.

control_runs, integer

Completed control runs. Confidence tests exclude forced runs.

variant_runs, integer

Completed variant runs. Confidence tests exclude forced runs.

control_avg_cost, number nullable

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

variant_avg_cost, number nullable

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

control_avg_duration, number nullable

Average duration of completed control runs, in milliseconds.

variant_avg_duration, number nullable

Average duration of completed variant runs, in milliseconds.

control_avg_score, number nullable

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

variant_avg_score, number 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 17 revisions of this API.