Contributing an avatar plugin: SpatialReal (on-device rendered avatars)

I’ve written an avatar plugin for LiveKit Agents and would like to upstream it into livekit/agents, so I wanted to introduce the integration here first.

How it works: the plugin takes over the agent session’s audio output and forwards the agent’s speech to our service. A worker joins the LiveKit room as a second participant and publishes the avatar’s audio together with an animation stream; the client SDK in the frontend renders the character from that stream, so what crosses the network is animation data rather than encoded video.

Two things in the plugin are worth mentioning because they go beyond the usual avatar integration:

  • On a false interruption it pauses playback on our side and resumes the same request from where it stopped, instead of discarding the segment and regenerating it. It’s gated on a capability the server advertises, and falls back to the ordinary interrupt path when that isn’t available.
  • If the connection drops mid-session it reconnects with a fresh session rather than failing the job, and confirms recovery by observing playback before handing audio back.

We’ve been running it in production and publishing it ourselves as livekit-plugins-spatialreal on PyPI, with an integration guide on our docs site, following the advice in the FAQ not to block users while a PR is in review.

Two questions before/alongside the PR:

  1. Anything you’d like to see in the PR beyond the usual plugin layout?
  2. The PyPI name livekit-plugins-spatialreal is currently published by us. For in-tree plugins your CI publishes that name — how do you normally handle the handover?

Happy to answer anything about how the integration works.

Docs: https://docs.spatialreal.ai
Examples: GitHub - SpatialReal-ai/spatialreal-examples: Runnable examples for SpatialReal: talking avatars rendered on the viewer's device · GitHub

@y.han, The precedent is already in-tree: livekit-plugins-spatius is another third-party avatar plugin that upstreamed, so it is the closest template to model your PR on for layout, README, and tests, and it shows the publish-then-upstream path works end to end (livekit-plugins-spatius). The integration contract your plugin implements against lives in the agents avatar module (voice/avatar), and CONTRIBUTING.md covers the repo-wide checks.

The two things you asked, what the maintainers want in the PR and the PyPI-name handover, are their call, so raise both in the PR description. The spatius plugin carrying a third-party name in-tree means the handover is a known step, not a blocker. Good to see another on-device option heading upstream.

What is the relationship between SpatialReal and Spatius?

From a Spatius.ai blog, “Spatius (formerly SpatialReal) is a real-time digital human…”. But SpatialReal still exists at https://spatialreal.ai/.

Thanks Darryn! We appreciate you pointing this out.
To clarify, there is absolutely no relationship between SpatialReal and Spatius. We are an independent US company based in San Jose. The statement on the Spatius.ai blog claiming that Spatius was ‘formerly SpatialReal’ is FALSE and misleading. SpatialReal still exists as its own entity and has never undergone any rebranding.
Thanks again for bringing this to our attention!

Thanks @y.han , it will be good to make that clear when you submit the PR.

In addition to the advice from @Muhammad_Usman_Bashir , after you submit, can you please fill in the form here: Notion

I also have an FAQ at Frequently Asked Questions (FAQ) - #16 by darryncampbell which it looks like you have followed.

Thanks @darryncampbell, and thanks Muhammad.

PR is up: #7640 — the description now states plainly that SpatialReal and Spatius are unrelated companies and that SpatialReal has never been renamed. Checks pass, CLA signed, AI review comments addressed, and the Notion form is filled in.

This looks interesting! I’m curious how the on-device rendering compares to traditional video-streamed avatars in terms of latency and bandwidth usage. Also, how much work would it take to integrate this into an existing LiveKit Agents project?