Experiments
Create and start experiment
Splits new conversations only on the channels in served_on. It does not enable a channel, place calls, change consent or bypass admission caps. Only verified published versions of this agent can be compared. Republishing the baseline suspends assignment; stopping affects new conversations, not conversations already open. Schedules and call quotas are not supported and are rejected. See /docs/tests-and-evals.md#experiments.
POST
/
v2
/
agents
/
{uuid}
/
experiments
Create and start experiment
curl --request POST \
--url https://api.sempera.org/v2/agents/{uuid}/experiments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"traffic_percentage": 50,
"variant_version_id": "<string>",
"variant_percent": 50
}
'import requests
url = "https://api.sempera.org/v2/agents/{uuid}/experiments"
payload = {
"traffic_percentage": 50,
"variant_version_id": "<string>",
"variant_percent": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({traffic_percentage: 50, variant_version_id: '<string>', variant_percent: 50})
};
fetch('https://api.sempera.org/v2/agents/{uuid}/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"experiment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "<string>",
"client": "<string>",
"name": "<string>",
"status": "draft",
"variant_version_id": "<string>",
"variant_percent": 50,
"traffic_percentage": 50,
"control_version_id": "<string>",
"baseline_current_version_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"stopped_at": "2023-11-07T05:31:56Z",
"served_on": [
"<string>"
],
"not_served": [
"<string>"
]
}
},
"errors": null
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}Authorizations
A workspace API key, sent as Authorization: Bearer sempera_sk_... Each operation names the one scope it needs. Scopes, key kinds and roles are in the Authentication guide.
Path Parameters
Body
application/json
⌘I
Create and start experiment
curl --request POST \
--url https://api.sempera.org/v2/agents/{uuid}/experiments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"traffic_percentage": 50,
"variant_version_id": "<string>",
"variant_percent": 50
}
'import requests
url = "https://api.sempera.org/v2/agents/{uuid}/experiments"
payload = {
"traffic_percentage": 50,
"variant_version_id": "<string>",
"variant_percent": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({traffic_percentage: 50, variant_version_id: '<string>', variant_percent: 50})
};
fetch('https://api.sempera.org/v2/agents/{uuid}/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"experiment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "<string>",
"client": "<string>",
"name": "<string>",
"status": "draft",
"variant_version_id": "<string>",
"variant_percent": 50,
"traffic_percentage": 50,
"control_version_id": "<string>",
"baseline_current_version_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"stopped_at": "2023-11-07T05:31:56Z",
"served_on": [
"<string>"
],
"not_served": [
"<string>"
]
}
},
"errors": null
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}