← All examples

Call agents & RL

Teach a call agent with human feedback

Reinforcement learning from human feedback, played as a game. Seven missions in order: real calls come in and are scored, the weak spots surface as hot spots, you duel two replies and pick the better one for 10 XP, the agent levels up from your picks, it fights the old version on the same customers, only a winner is crowned, and the champion answers real customers through the Connect API.

Mock customer, agent and judge until a model key is set; then hosted models or a vLLM endpoint on the cluster. Weight training is DPO with LoRA on a GPU.

How it works

  1. 1Bring calls in: webhook, dataset or demo data. RL: episodes and a reward signal from the real environment.
  2. 2Find the hot spots: moments are clustered into situations, ranked by size and weakness on a map. RL: prioritising states where the policy is weak.
  3. 3Duel: one moment, two hidden and shuffled replies; pick the better, tick why, +10 XP. RL: pairwise human preferences, the signal RLHF trains on.
  4. 4Level up: picks become a new version. RL: a policy update, prompt-level now, DPO with LoRA for weights.
  5. 5Boss fight: new vs old on the same customers and seeds, with win rate, radar and regressions. RL: held-out evaluation with fixed seeds.
  6. 6Crown the champion: only a winner goes live. Connect: the call platform asks the champion for its next reply, and every reply comes back as a live call. RL: the deployed policy and online data collection.

The code

connect
# the inference layer: your call platform asks the champion for its next reply
curl -X POST https://levers9-api.uselevers.com/api/rl/agent/<tenant>/reply \
  -H "X-Levers-Webhook-Key: <secret>" -H "Content-Type: application/json" \
  -d '{"call_id": "CALL-0142", "turns": [{"role": "customer", "text": "..."}]}'
# -> {"reply": "...", "policy": {"name": "v2 · trained"}, "judge": {"total": 76}, "violations": []}
run it
# weights, once a preference version is frozen
cd lab/rl && python train_dpo.py --pack saudi_real_estate --version 3 --base google/gemma-4-E4B-it --gpu A10G

Where to go next

Related