How it’s built
What happens after you press Call Juniper
The pages are static files. A small Cloudflare Worker hands out rooms and never calls LiveKit’s API: the agent dispatch rides inside the join token. Everything you hear comes from one Python worker on LiveKit Cloud. It plays Juniper, Priya and the coach, and asks a separate model to score your practice call.
The path of a call
The page drives the agent
Settings switch on a live call
The lab never reconnects to change a setting. The page calls the agent over LiveKit RPC and the agent changes the running session. Turn detection, noise isolation and the model change in place. Interruption settings are fixed when an agent is created, so that switch hands off to a fresh Juniper that keeps the conversation.
Before each test-caller run, lab.reset does the same handoff with an empty history, so both runs start alike.
| Name | Kind | What it does |
|---|---|---|
| lab.set_settings | RPC · page → agent | Switches one of the four settings on the running call |
| lab.reset | RPC · page → agent | Hands off to a fresh Juniper before a test-caller run |
| lab.customize | RPC · page → agent | Fills a fixed template with a name and a house rule |
| lab.get_state | RPC · page → agent | Returns the settings, the exact instructions the LLM reads, and the agent’s clock |
| practice.finish | RPC · page → agent | Ends Priya’s call, scores it, hands off to the coach |
| lab.events | Text stream · agent → page | Each turn’s words, whether it was cut off, when it was spoken, and LiveKit’s timing |
| practice.scorecard | Text stream · agent → page | The scored card, as JSON |
| lk.chat | Text stream · page → agent | Typed turns, which LiveKit Agents reads as speech |
if turn_detection in MODES and turn_detection != settings.turn_detection:
settings.turn_detection = turn_detection
# Turn detection can change on the running agent.
session.update_options(turn_detection=turn_detection_for(turn_detection))
noise = request.get("noise")
if noise in MODES and noise != settings.noise:
settings.noise = noise
isolation.enabled = noise == "enhanced"
model = request.get("model")
if model in MODELS and model != settings.model:
settings.model = model
# The LLM can change on the running agent.
session.current_agent.update_options(llm=llm_for(model))
if interruptions in MODES and interruptions != settings.interruptions:
settings.interruptions = interruptions
history = session.current_agent.chat_ctx.copy(
exclude_instructions=True, exclude_handoff=True
)
session.update_agent(Juniper(settings, persona, chat_ctx=history))
await wait_for_handoff()The test caller
Both settings hear the same audio
The page publishes one microphone track, fed by a Web Audio mixer. Test-caller clips play straight into it, so the agent hears exactly the same sound on both settings. Your own microphone joins the mix only for “try it yourself.”
Getting a clip that shows the difference took tuning. The numbers came from live runs.
- 1.8 s pausesWhen the clip was tuned, Juniper started answering about 1.2 seconds after the caller stopped (about 0.6 now, on faster speech models). A wrong decision is only audible when the pause is longer than that.
- Pauses mid-thought“I’d like a table.” is a finished sentence, and the turn detector rightly said so (0.61 and 0.96). Pausing after “for” and “on” is the real case.
- A 0.55 s “uh-huh”Just over the baseline’s half-second threshold, short enough to sound like listening. A clear “yeah, okay” stopped both settings.
- A natural voiceWith a robot voice, the detector scored the same pause 0.30 in one run and 0.46 in the next.
- The right isolationOn the café booking, ai-coustics Voice Focus S removed the next table every time. Krisp VIVA let it through.
this.destination = this.context.createMediaStreamDestination();
this.micGain = this.context.createGain();
this.micGain.gain.value = 0;
this.micGain.connect(this.destination);
this.cafeGain = this.context.createGain();
this.cafeGain.gain.value = 0;
this.cafeGain.connect(this.destination);
this.track = this.destination.stream.getAudioTracks()[0];Drawing the conversation
A timeline from two clocks
The page notes when each clip starts and when Juniper’s state changes, on its own clock. The agent reports when every turn’s speech started and stopped, on its clock. A quick RPC before each run measures the difference, so both land on one axis.
The live runs turned up a surprise. When a reply is cut off, LiveKit pauses it first and reports it stopped only once it gives up the turn, about a second later. So the timeline draws what a listener heard, from the state changes, and takes the words and the cut from the agent’s turns. Eight tests pin that down.
- Juniper started speaking
- 2.65 s
- The caller started again
- 3.56 s
- Juniper went quiet, as the page saw it
- 4.10 s
- The agent reported it stopped
- 5.33 s
Experiment 1, Baseline, recorded 14 Nov 2026. Times from the start of the test caller’s clip.
Scoring the practice call
A judge that has to show its work
The judge answers in a fixed JSON schema. Then plain code applies the lab’s rules, because an LLM’s word isn’t evidence.
A point needs a quote that’s really in the call, matched word for word, ignoring punctuation and accents; its time comes from the transcript. A bluff counts only if it’s the seller’s own words. It zeroes technical honesty and fails the call, whatever the total.
def words(text: str) -> str:
"""Lowercase words only, so a quote matches whatever its punctuation and accents."""
text = unicodedata.normalize("NFKD", text.replace("’", "'"))
text = "".join(ch for ch in text if not unicodedata.combining(ch)).lower()
return " ".join(re.findall(r"[a-z0-9']+", text))line = find_quote(quote, lines)
if quote and not line:
logger.warning(
"item %s: dropped a quote that isn't in the call: %r", rule["id"], quote
)
if score:
improve = improve or "The judge couldn't point to where this happened."
score, quote = 0, ""
elif not quote:
score = 0
if rule["id"] == HONESTY_ITEM and bluff:
score = 0- A good call passes, with times
- No quote earns no points
- A quote that isn’t in the call scores 0
- Matching ignores punctuation, case and accents; only whole words count
- A bluff zeroes honesty and fails the call
- A bluff must be the seller’s own words
- Bad scores and junk items count as zero
- JSON in code fences still parses
- Each turn of the call gets its time
- The schema is strict
Cost
A cheaper judge, after checking it agreed
The judge started on gpt-5.5. Two saved calls were scored again by gpt-5.4-mini with low reasoning, twice each. Same verdicts, and every quote it gave was found in the transcript. It costs about a tenth as much, so it’s the judge now.
Speech runs on the lab’s own Deepgram key, so it doesn’t use up LiveKit’s free inference credits.
4.5 to 6.5 seconds before, 2 to 4 now.
| Saved call | gpt-5.4-mini, run 1 | Run 2 |
|---|---|---|
| Good discovery, honest answers, a dated next step | 12 of 12, a pass | 12 of 12, a pass |
| The bluffing call | 5 of 12; caught the guarantee | 4 of 12; caught the same claim |
Exposure
A public demo that stays cheap
The lab runs on free plans and lives at a link people are sent. So the Worker and the agent put limits on everything that costs money or leaks data.
- Access code
- Rooms only for the code, compared in constant time.
- Daily cap
- At most 40 rooms a day.
- Short tokens
- Good for 2 minutes, just long enough to join.
- Time limits
- The agent ends a lab session after 40 minutes and a practice call after 15.
- Out of search
- Every response says noindex; pages send no referrer, so the code in a link stays put.
- Recording
- Only pilot calls, after consent. Deepgram is asked not to keep audio.
const [a, b] = await Promise.all([
crypto.subtle.digest('SHA-256', encoder.encode(given.trim())),
crypto.subtle.digest('SHA-256', encoder.encode(expected)),
]);
return crypto.subtle.timingSafeEqual(a, b);The pilot
Testing whether it teaches
A participant’s link carries the access code and a pilot code. Nothing is recorded until they agree on the pilot page. Then it walks them through four steps: a check of five questions and three ratings, the lab, the practice call, and the same check again.
A participant’s calls carry the pilot code, so the agent records them for LiveKit Cloud’s Agent Insights. Everyone else’s calls aren’t recorded.
What’s recorded, under the pilot code
- consent and step changes
- both checks
- each locked-in prediction
- test-caller runs, recorded runs played, and “Make it your own” changes
- every error message shown
- each practice call’s scorecard and transcript
A results page shows everything, one participant at a time. It takes an admin code, can delete a participant’s data, and can download it all as JSON.
Known limits
What isn’t proven yet
Next: run the pilot with two or three people who don’t know LiveKit, and fix what they get stuck on.
- Unproven. The café button plays noise only while you talk. That gating needs a real microphone, so it hasn’t been tested yet.
- Unproven. The pilot has only had a test participant. Priya has only been tried by typing, not by voice.
- Unproven. Small samples: two runs per setting, and two calls for the judge comparison.
- Known gap. Tests cover the scoring rules, the timeline, the recordings, the Worker’s API and the names the agent and the pages share, and they run on every push. Nothing tests a live call end to end: the RPCs against a running agent, or the mixer.
- Known gap. The daily cap is rough: two requests at the same moment can both get through.
- Known gap. Anyone with the access code can write pilot events. Reading or deleting them takes the admin code.
Every number on this page comes from the README’s live runs or the code. The excerpts are read from the source when the site is built. Read the source on GitHub (opens in a new tab).