Worked practice-studio samples
The endpoint list below documents every operation’s parameters; this overlay walks a roleplay session the way a coaching integration actually uses it: list the built-in scenarios → drive the simulated customer’s next turn → grade the finished session. Success envelopes are{ data, meta }, error envelopes
{ error, meta } — see How to read a
worked sample. The instructor persona lives
in the scenario (persona, situation, objective, grading rubric); the
roleplay client keeps the transcript across calls, and the grade summary
moves to per-criterion feedback the LLM judge returns.
Every response carries meta.request_id. Quote the request id when a
rubric score disagrees with a session replay — support can pair the
scenario id, the score, and the request id from the turn index.
1. List built-in practice scenarios
GET /api/v1/practice-studio/scenarios returns the built-in
AI-simulated-customer roleplay scenarios: persona, situation,
objective, and grading rubric. Use this to pick a starting scenario for
your coaching loop before you drive turns.
200
2. Drive the simulated customer’s next turn
POST /api/v1/practice-studio/turn returns the next customer message
and session signals — mood, satisfaction, resolved, ended. The AI stays
in character as the customer and never coaches the trainee, so the
transcript is the only surface of truth you need to keep.
200
3. Grade the finished session
POST /api/v1/practice-studio/score takes the full transcript and an
LLM judges the trainee against the scenario rubric — weighted overall
score, per-criterion feedback, strengths, and concrete improvements.
Call it when signals.ended flips to true.
200
4. Errors
Errors follow the{ error, meta } envelope. The failure every client
hits:
422 — missing scenario. A scenario_id or inline scenario was not
supplied:
422