Skip to Content

A/B groups

Split live calls across two or more agents by weight, and find out which one actually performs better.

A group is a set of your agents, each with a traffic weight. Point a phone number, an outbound call, or a campaign at the group instead of a single agent, and each call goes to one of them.

Reach for this when you want to know which version is better on real calls — a new opener against the current one, a different model on the same script. For the walkthrough, see Compare agents with groups.

Beta — groups are enabled per team. Ask us to turn them on for yours.

A group defines its members, their weights, how calls are assigned, and what gets measured on every call.

curl -X POST https://api.kejue.co/v1/groups \
  -H "Authorization: Bearer kejue_<prefix>_<secret>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 018f4d7a-group-collections-opener" \
  --data '{
    "name": "Collections opener test",
    "description": "Current opener against a shorter one.",
    "routing_strategy": "sticky",
    "overall_enabled": true,
    "members": [
      {"agent_id": "CURRENT_AGENT_ID", "weight": 50},
      {"agent_id": "SHORT_OPENER_AGENT_ID", "weight": 50}
    ],
    "metrics": [
      {
        "name": "payment_promised",
        "type": "boolean",
        "description": "Did the customer agree to a payment date?"
      }
    ]
  }'

Over the API: POST /v1/groups.

Members and weights

1 to 10 agents, each with a weight from 0 to 100. An agent's share is its weight over the total, and at least one weight has to be above zero.

Every agent needs to be active with a deployed version.

Each agent gets a label — A, B, C — when you add it, and keeps it for the life of the group, so "B" means the same agent on every chart. Remove an agent and add it back and it gets a new label.

A member always runs its agent's current deployed version. Deploy a new version and the group picks it up on the next call. Each call records which version answered.

Groups are live

Save to apply the members, weights, and routing strategy to new assignments. Calls in progress and outbound jobs that already have an assignment keep their assigned agent.

You can change things at any time:

  • Weight 0 keeps the agent and its history in the group but sends it no new calls.
  • Removing an agent stops new calls and keeps its past calls in the results.
  • Every change is recorded and marked on the result charts, so you can see what the split was when a trend moved.

A PATCH replaces the whole members list — send the full set you want.

How calls are assigned

Choose Call routing when creating a group or editing its Settings.

SettingAPI valueHow Kejue picks an agent
Same agentstickyKeeps each number with the same agent while the eligible members and weights stay the same. This is the default for existing and new groups.
Random agentrandomDraws by weight for each new assignment. A repeat caller may reach the same agent again.
Prefer a new agentprefer_newDraws by weight among agents that have yet to answer a call with this number in the group's retained history. Once each eligible agent has answered, it draws by weight among all eligible agents.

Withheld caller IDs use weighted random in every mode. Outbound jobs and campaign retries keep the agent picked for the job.

To change only the routing strategy through the API, send {"routing_strategy":"prefer_new"} to PATCH /v1/groups/{id}. Include the group's current ETag in the If-Match header to guard against concurrent edits.

Where a group can answer

TargetHow
Inbound phone numberSet group_id instead of agent_id
A single outbound callSend group_id; we pick the agent when the call is created
A campaignSend group_id; we pick an agent per recipient

A number, call, or campaign targets exactly one of an agent, a flow, or a group — sending two is rejected.

Browser calls and dashboard test calls don't go through groups. To try one agent from a group, call it directly.

Which agent answered

A call routed through a group records the group and the agent it was assigned, with that agent's label. GET /v1/calls?group_id=... lists one group's calls. In the dashboard the call shows a group chip with the label.

Limits

Up to 10 agents and 20 metrics per group. A metric name is lowercase letters, digits, and underscores; overall_score and outcome are reserved.

Groups don't work on Twilio Media Streams numbers.

If every agent in a group loses its deployed version, gets archived, or drops to weight 0, the group can't take calls — attaching it fails, and a running campaign using it pauses until you fix it.

To archive a group, first point its numbers and campaigns somewhere else. The error lists what's still using it. Past calls stay readable afterwards.

See also

Compare agents with groups · Agents · Flows · Campaigns

On this page