VocalDocscontracts 1.65.0

Create an experiment on an Agent

POST /v1/agents/{agent_id}/experiments

PropertyValue
Operationcreate_experiment
GroupPrompt evaluations and experiments
Scopeagents:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited agent.experiment.create (mutation)
Released in1.55.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Creates a traffic-split experiment as a draft with one or two candidate versions and their shares, the control receiving the rest once started (1.55.0; prompt-manager.md section 9.2). A candidate whose Policy versions, Tools or Knowledge bindings differ from the Agent's active version is experiment_policy_mismatch, and one that is the active version experiment_arm_is_control, each a detail of 422 validation_failed; a candidate version that is not published is 409 agent_version_unavailable; a suite_id is refused with 422 capability_not_available and live_call_judging_not_available until the Compliance profile carries live_call_judging.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the agents:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/agents/agt_.../experiments" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<name>",
    "candidates": [
      {
        "agent_version": 1,
        "share_percent": 1
      }
    ]
  }'

Parameters

NameInTypeRequiredDescription
agent_idpathAgentIdyesThe id of an Agent: agt_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: ExperimentCreateRequest.

FieldTypeRequiredDescription
candidatesarray of ExperimentCandidateInputyes
descriptionstringnoFor reviewers.
goalExperimentGoalInputnoThe goal the results report per arm (1.63.0): a slot value at Call end or an Outcome field value. Fixed at create. None when omitted.
namestringyesA display name.
stop_rulesExperimentStopRulesInputno
suite_idPromptEvalSuiteIdnoA suite whose rubric judges a sample of live Calls, only with live_call_judging; refused with capability_not_available and live_call_judging_not_available until the Compliance profile carries it, and from 1.63.0 while the profile has it off.
unitExperimentUnitnocall when omitted.

Responses

StatusContent typeShapeError codes
201application/jsonExperiment
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused, agent_version_unavailable
422application/jsonErrorEnvelopevalidation_failed, capability_not_available
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is Experiment.

FieldTypeRequiredDescription
agent_idAgentIdyes
armsarray of ExperimentArmyesThe control first, then the candidates in the order they were named.
created_atTimestampyes
created_byActorRefyes
descriptionstring or nullyesFor reviewers.
goalExperimentGoal or nullnoThe goal the results report per arm (1.63.0): a slot value at Call end or an Outcome field value. Fixed at create. Null for none; absent from an api before 1.63.0, which a reader treats as null.
idExperimentIdyes
namestringyesA display name.
object"experiment"yes
promoted_armExperimentCandidateArmKey or nullyes
started_atTimestamp or nullyes
started_byActorRef or nullyes
statusExperimentStatusyes
stop_reasonExperimentStopReason or nullyes
stop_ruleExperimentStopRule or nullyesSet with stop_rule only.
stop_rulesExperimentStopRulesyes
stopped_atTimestamp or nullyes
stopped_byActorRef or nullyesWho stopped or promoted it; null when a stop rule or a version change did.
suite_idPromptEvalSuiteId or nullyesA suite whose rubric judges a sample of live Calls, only with live_call_judging; refused with capability_not_available and live_call_judging_not_available until the Compliance profile carries it, and from 1.63.0 while the profile has it off.
unitExperimentUnityes
updated_atTimestampyes