Skip to content

livekit-plugins-yoob: AvatarSession (Yoob characters rendered on the user's device) - #8763

Open
ofirkris wants to merge 6 commits into
livekit:mainfrom
Yoob-com:yoob-avatar
Open

ofirkris wants to merge 6 commits into
livekit:mainfrom
Yoob-com:yoob-avatar

Conversation

@ofirkris

@ofirkris ofirkris commented Nov 24, 2026 •

Copy link
Copy Markdown

Adds yoob.AvatarSession to livekit-plugins-yoob: a Yoob character as the agent's face, rendered on the user's own device.

Stacked on #8718 (the Yoob TTS and STT plugin). Only the last commit is new here.

Unlike the server-side avatar plugins, nothing joins the room and no video is streamed. The user's app runs a Yoob SDK (web @yoob/avatar/livekit, iOS YoobLiveKit, Android yoob-avatar-livekit), which plays the agent's normal audio track through the character, so the call uses only audio bandwidth. This plugin is the agent's half:

  • announces the character in the agent's attributes (yoob.avatar.character, yoob.avatar.version)
  • registers the RPC yoob.avatar.session: when the user's app asks, it opens a Yoob session with the agent's YOOB_API_KEY and returns it, so the key stays with the agent and the app needs no backend of its own for it
  • only participants that are not agents get sessions, a few per minute each (max_sessions_per_minute)
  • leaves the agent's audio output untouched; wait_for_join() waits until a device has opened its session; aclose() unregisters the RPC and clears the attributes

The character builds the web and Android SDKs load by default carry a visible Yoob watermark baked into the footage; nothing is drawn over the video at runtime.

await ctx.connect()
avatar = yoob.AvatarSession(character="astrid")
await avatar.start(session, room=ctx.room)
// the app (web)
const { character, version, getCredentials } = await agentAvatar(room);
const avatar = new YoobAvatar({ container, character, version, getCredentials });
await new YoobLiveKitSession(avatar, { room }).start();

Checks run locally: ruff check, ruff format --check, mypy -p livekit.plugins.yoob, 8 new offline tests against a fake of Yoob's session API (attributes, RPC registration, agent callers refused, per-minute cap, refusals passed on without retry, 5xx retried, invalid answers not retried, setup errors), 23/23 with the existing Yoob tests. In a real LiveKit room (livekit-server 1.13, this branch's agents): the user's side read the announced character 3 s after joining (agent start-up), the session RPC answered in 6 ms against a local stand-in of the session API, and against the real API with an invalid key the user received Yoob's unauthorized reason.

CI: test-stt fails on this fork as it does on #8718: providers without credentials in fork CI (OpenAI, AWS, Fireworks); the Yoob tests are skipped there. A YOOB_API_KEY for your CI is available on request.

Yoob text to speech (OpenAI-compatible /v1/audio/speech, HTTP and WebSocket streaming with
emotion and sound tags) and speech to text (yoob-asr-turbo-v1 / yoob-asr-pro-v1, batch and
realtime WebSocket with interim results). Adds the yoob extra, the uv workspace entry, and yoob
to tests/test_tts.py and tests/test_stt.py.
…iming)

- STT and TTS sockets connect with autoping=False and read through
  utils.aio.WebSocketMonitor, so a half-open connection fails within
  conn_options.liveness_timeout instead of hanging.
- STT: a final that follows VAD silence closes the turn it belongs to
  (start, final, end) instead of opening a second one; a late partial
  stays in its turn too.
- STT: multichannel input is mixed down to mono before resampling.
- STT: no ready message is an APITimeoutError (retryable), not a bare
  asyncio.TimeoutError; after stop, the last results must arrive within
  conn_options.timeout (non-retryable: the audio is spent).
- STT: END_OF_SPEECH carries speech_end_time from the utterance's last
  final, so endpointing counts from the end of speech.
- STT: recognize() honours conn_options.timeout (FallbackAdapter's
  attempt timeout) instead of a fixed 60 s.
- TTS: once all text is sent, audio or done must keep arriving within
  conn_options.timeout.
- README: LiveKit docs links; tests section points at the shared suites.
- tests/test_plugin_yoob.py: offline tests for each of the above.
- STT: a send that fails after end_input() is not retried; the frames the
  dead connection consumed cannot be replayed.
- TTS: the render deadline starts when the end message is sent and resets
  on every message; one read stays outstanding across the phases.
- STT: recognize() gives the whole request one budget,
  ClientTimeout(total=conn_options.timeout).
- tests/test_plugin_yoob.py: a test for each (3 fail on the previous commit).
stream() ignored the model (every stream ran yoob-asr-turbo-v1) and every transcript was
tagged English. The model and a new language option (also stream(language=...) and
recognize(language=...)) now go to the API; transcripts carry the requested or detected
language. Tests for both; live check: Turbo and Pro streams transcribe and label en.
…n the user's device

The agent announces the character in its attributes (yoob.avatar.character, yoob.avatar.version)
and opens Yoob sessions for the people in the call over an RPC (yoob.avatar.session), with the
agent's own Yoob key. The user's browser renders the character with the Yoob web SDK from the
agent's normal audio track: no avatar server, no video track. Offline tests against a fake of
Yoob's session API.
@ofirkris ofirkris changed the title livekit-plugins-yoob: AvatarSession (Yoob characters as avatars) livekit-plugins-yoob: AvatarSession (Yoob characters rendered on the user's device) Nov 24, 2026
@ofirkris
ofirkris marked this pull request as ready for review November 24, 2026 22:02
@ofirkris
ofirkris requested a review from a team as a code owner November 24, 2026 22:02
devin-ai-integration[bot]

This comment was marked as resolved.

Once end_input() has been called the audio this connection consumed cannot be
replayed, so a retry (for example after a busy answer to stop) would reconnect
with nothing to send and could finish without the transcript or an error. Any
retryable error then becomes final, with the server's reason kept; errors while
input is still open stay retryable. Test: busy after stop with retries enabled
fails once, with one connection.
@ofirkris

Copy link
Copy Markdown
Author

On the test-stt failure (run 45501282300): the failing cases are openai (recognize and stream), openai.realtime, fireworksai and aws, which have no credentials in fork CI. The Yoob cases are skipped there. The same five fail on other fork PRs that touch tests/test_stt.py (for example run 44693271789), while the /test-stt runs on main pass. Every other check on this PR passes. A maintainer's /test-stt would run it with secrets, and we can provide a YOOB_API_KEY for your CI if you'd like the Yoob cases to run too.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant