Planned protocol reference. Session creation, renewal, sampling and the session stream are not
served by the current Talent API sandbox. The examples below cannot yet be run against it.
Start with the runnable quickstart and sandbox support matrix.
Start a session
Send the same fields as a check: the talent, the facet, the use, what the model receives, the end user and the model.generation_instructions entry.
If your voice provider verifies session tokens, pass it token and every renewed token. See the
session token format.
Sessions never escalate. Anything that would escalate is a deny, and the session comes back with
status: "denied", token: null and reasons. A license that holds every output for release
cannot start a session; the reason is session_not_permitted.
Connect to the stream
Open a WebSocket tostream_url. From a client, offer the subprotocols tlp.session.v1 and
tlp.session.<token>, with the session token. From a server, you can offer tlp.session.v1 and send
your secret key in Authorization instead. Reflections selects tlp.session.v1 and never echoes
the token. The stream checks the token once, when it opens. Renewing over REST keeps the session and
does not reconnect the stream; you need the newest token only if you reconnect.
If the connection drops, reconnect and read the session with
GET /v1/sessions/{session_id}. A termination you
missed shows there as status: "terminated" with termination.reason, and in the
session.terminated webhook.
Renew every 60 seconds
The token expires 5 minutes after it is issued. Renew it everyrenew_every.
409 session_not_active means the license was revoked or suspended, its window ended, or the
session was terminated. Stop output at once. On a network error, 429 or 5xx, keep retrying: you
may continue until the current expires_at, never past it.
Submit samples
sampling says how often Reflections checks what the session produces:
audio/wav or audio/ogg, frames are image/jpeg, each up to 2 MB. A transcript sample
sends kind: "transcript" with the words of one turn in text, such as “Great question. My
favourite trail is the ridge loop above the lake.”
Send samples on the stream
Instead of aPOST per sample, you can send each sample on the open stream as sample.submit, with
the same fields plus a ref of your own. This saves a round trip per sample. The decision comes back
on the stream as sample.decided with the same ref; a sample sent with POST gets its decision in
the response instead.
Stop within one second
Stop output within one second of any of these:- a sample returns
decision: "deny", in its response or insample.decided; session.terminatedarrives on the stream or as a webhook;- a renewal returns
session_not_active; - the current token reaches
expires_atwithout a successful renewal.
POST /v1/sessions/{session_id}/end. Reflections also
terminates the session on its side.
End the session and report usage
Call end when the user hangs up. Then report the session’s usage with a usage record whosesubject is the session ID, in the units and within
the time the usage_report obligation names (here, seconds within one day).
Planned test coverage
Sessions,rfl_test_terminate, stream messages and license-revocation helpers are not available
in the current sandbox. Use local fixtures to test renewal failure and termination handling;
check Sandbox before attempting this flow against the service.
Related
Session stream
Every message on the WebSocket channel.
Session token
Claims and renewal of the session token.
Voice platforms
Voices held at a provider, scripts and sessions.
Handle revocations
What a revocation requires beyond the session.