Skip to Content
Nuance LabsDocs

Follow the conversation

The events your page gets during a conversation, from its start to its end: what was said, when a reply ends, tool calls and errors.

The persona sends your page events as things happen in the conversation. Each one is a small JSON object with a type. For example, you get the persona's words as it says them:

{ "type": "session.output_transcript.delta", "event_id": "evt_88", "delta": " It's light rain" }

With the JavaScript SDK, you get each event in conversation.onInterfaceEvent. In a native app, Native apps shows how to receive them.

The conversation started

session.started arrives once the persona can hear the user's microphone. The user can speak from then, and your page can start sending events. Its session field describes what is running:

  • session.expires_at is when the conversation will end, in Unix seconds.
  • session.delegation holds your tool settings as the conversation uses them.
  • session.runtime_tools lists the persona's own tools as the conversation uses them.

It doesn't include your prompt or your tools' full definitions, so keep your own copy of what you put in the token.

Words

session.input_transcript.delta gives you the user's words and session.output_transcript.delta the persona's, a few at a time as they're spoken. Join the delta values in order; they include their own spaces.

When the persona starts answering, session.input_transcript.done gives you the full text of what the user just said. Keep this one, not the pieces, as the record of what the user said. Sometimes a corrected version of the same turn follows. It has a replaces_event_id with the earlier event's id, so replace the old text with it.

Card numbers, security codes, one-time codes and Social Security numbers the user says aloud show up as [redacted]. If your page lets the user type, typed messages don't appear in these events, so show them on your page yourself.

A reply ended

session.output_audio.done arrives each time the persona finishes speaking a reply, with a reason:

reasonWhy the reply ended
completedThe persona finished what it had to say.
interruptedThe reply was cut short: the user spoke over it, you sent session.output_audio.interrupt, Nuance stopped it, or the conversation closed.
revisedYour append with while_speaking: "revise" cut it, and the next reply continues from where it was cut.

Wait for this event before acting on something the persona said, such as hanging up after it says goodbye. It's the only reliable sign that the persona has finished talking.

The persona called a tool

When the user asks for something that needs one of your tools, you get session.delegation.created, followed by the tool calls themselves inside response.event events. With the SDK you don't need to read these: onToolCall gives you each tool call. Native apps shows how to handle them without the SDK.

When the persona stays quiet

Sometimes the persona deliberately doesn't answer for a while, because it chose to with its stay_quiet tool or because your page asked it to wait. You get session.quiet.started when the silence starts and session.quiet.ended when it ends.

Errors and notices

An error event means something you sent was refused, or the conversation hit a problem.

{ "type": "error", "event_id": "evt_90", "error": { "type": "invalid_request_error", "code": "command_refused", "message": "the agent is not talking", "client_event_id": "stop_1" } }

error.type is invalid_request_error, or server_error when the problem is on Nuance's side. Use error.code to tell errors apart in your code, not the message, which can change. error.param names the field at fault, and error.client_event_id the event_id of the event it answers. Most errors leave the conversation running; Errors lists the codes and the few that end it.

An info event is a notice, not an error, with a code and a message. One is delegation_cancelled: the persona started on a request for your tools but dropped it before calling any.

The conversation ended

session.closed is the last event. Its reason says why.

reasonWhy
close_requestedYou sent session.close.
expiredThe time limit ran out, at session.expires_at.
contentA safety check ended it for a policy violation, including the user saying a Social Security number. See Safety.
age_checkThe camera showed only people who look under 18. See Safety.
end_callThe persona ended the call after its goodbye, with its end_call tool.
errorThe conversation failed; start a new one with a new token. For now, one your server ended with the end route can also close with error, so check that first.
connection_lostThe connection ended without a session.close.

A content or age_check end also includes a message, the exact words to show your user.

A native app also gets ended on its events request, normally just after session.closed. When the call's connection is stuck, ended is the only one that arrives. Either way, hang up. The SDK does this for you and reports session-ended.

Every event you can get

EventWhen it arrives
session.startedThe conversation is live and the persona hears the user's microphone.
session.input_transcript.deltaThe user's words, in pieces, as they are heard.
session.input_transcript.doneThe full text of what the user said in one turn.
session.output_transcript.deltaThe persona's words, in pieces, as it says them.
session.output_audio.doneThe audio of the persona's reply has finished playing.
session.delegation.createdThe persona took on a request for your tools or your page.
response.eventOne event about a tool request, such as a call to run.
session.quiet.started, session.quiet.endedThe persona started or stopped staying quiet.
session.thinking.appended, session.instructions.appended, session.commentary.appendedYour append was applied.
session.input_audio.muted, session.input_audio.unmutedYour mute or unmute was applied.
session.updatedYour session.update was applied.
session.usage.updatedThe total seconds used so far, every 15 seconds.
errorSomething you sent was refused, or the conversation hit a problem.
infoA notice, such as a tool request the persona dropped.
session.closedThe conversation is over, with its reason.

On this page