Athos Developer Docs
Browser SDK

Events

The roleplay session lifecycle events and their payloads.

Subscribe with session.on(name, cb). It returns an unsubscribe function — call it (or session.off) when your component unmounts to avoid leaks in single-page apps.

const off = session.on('personaSpeaking', ({ speaking }) => setAvatarTalking(speaking));
// later:
off();

Event reference

EventPayloadFires when
connecting—connect() was called; the token is being redeemed and the call joined.
ready{ persona: AthosPersona }The persona is connected and ready to speak. See The persona.
personaSpeaking{ speaking: boolean }The AI persona started (true) or stopped (false) speaking.
userSpeaking{ speaking: boolean }The local rep started (true) or stopped (false) speaking.
reconnecting—A transient network drop is being recovered automatically.
reconnected—The connection recovered after a transient drop.
ended{ callId: string; durationSec: number }The call ended. callId is the public athos_call_… id.
error{ code: string; message: string }A domain error. Branch on code — see Error codes.

There is no live transcript event. The transcript is delivered post-call via GET /v1/calls/:id, not streamed during the call.

The persona

ready carries the persona the rep is talking to: its name, and — for the Medicare Advantage, Hospital Indemnity and Critical Illness drills except ma-sep-hunting — the persona's details in details (null for every other drill). All of it is fictitious training data.

session.on('ready', ({ persona }) => {
  // persona.details:
  // {
  //   gender: 'female',
  //   dateOfBirth: '1950-12-29',
  //   mbi: '1EG4-TE5-MK72',            // the MBI the persona gives when asked
  //   address: { street: '4415 Cherry Blvd', city: 'Auburn', state: 'CA', zipCode: '95603', county: 'PLACER' },
  //   category: 'DSNP',                // MAPD | MA Only | CSNP | DSNP
  //   medicaidLevel: 'QI',             // null when the persona has no Medicaid
  //   currentPlan: { name: 'Wellcare Dual Liberty (HMO D-SNP)', contractId: 'H3561', planId: '009', planType: '01 - HMO (D-SNP)' },
  // }
});

Any field is null when the persona has no value for it. currentPlan is null when the persona has no Medicare Advantage plan today — always the case on ma-t65, where the rep is enrolling someone new to Medicare.

When ended fires

A call never ends by itself — the AI persona has no way to hang up. ended fires when you call session.disconnect(), when the two-hour ceiling is reached, or when the network drops and cannot recover (alongside a NETWORK_LOST error). Reaching the ceiling is not a failure: the payload is the same as any other call's and the call is scored normally. See How a call ends.

Using the callId

The ended event gives you the public callId. Scoring happens after the call ends, so the score is not available immediately — wait for the call.scored webhook (or poll GET /v1/calls) and look the call up by that same callId.

On this page