Skip to content

feat(plugins-tavus): rename replica/persona to face/pal#6239

Open
carolin-tavus wants to merge 5 commits into
livekit:mainfrom
carolin-tavus:feat/tavus-face-pal-rename
Open

feat(plugins-tavus): rename replica/persona to face/pal#6239
carolin-tavus wants to merge 5 commits into
livekit:mainfrom
carolin-tavus:feat/tavus-face-pal-rename

Conversation

@carolin-tavus

@carolin-tavus carolin-tavus commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Align the Tavus plugin with Tavus's renamed API (replica β†’ face, persona β†’ pal). Public params, env vars, and the wire payload move to the new naming; the old names stay working as deprecated aliases (non-breaking for plugin users).

  • Add face_id/pal_id params (and TAVUS_FACE_ID/TAVUS_PAL_ID env vars) to AvatarSession and TavusAPI.create_conversation.
  • Send face_id/pal_id on the conversation-create payload; add create_pal() hitting POST /v2/pals (pal_name + default_face_id), and auto-create a pal (not a persona) when none is supplied.
  • Keep replica_id/persona_id params, TAVUS_REPLICA_ID/TAVUS_PERSONA_ID env vars, and create_persona() (legacy /v2/personas) working as deprecated aliases with a DeprecationWarning.
  • Update the avatar_agents/tavus example to the new names.

Test plan

  • ruff check (E,W,F,I,B,C4,UP) and ruff format --check pass.
  • 7 mocked pytest cases pass (installed plugin, _post mocked): new keys map onto the face_id/pal_id wire payload, deprecated args/env still work and warn, auto-create routes to /v2/pals with default_face_id, the TAVUS_FACE_ID-required error, and AvatarSession alias resolution.
  • Verified live against staging end-to-end (auto-create pal via /v2/pals β†’ conversation with face_id/pal_id) on both the new-arg and deprecated-arg paths.

Notes

The face/pal wire support is live on Tavus prod (tavusapi.com); both old and new keys are accepted, so this is non-breaking for existing integrations.

Tavus is renaming its public API surface from replica_id/persona_id to
face_id/pal_id. Rename the plugin's public params (face_id/pal_id) and env
vars (TAVUS_FACE_ID/TAVUS_PAL_ID); the old replica_id/persona_id args and
TAVUS_REPLICA_ID/TAVUS_PERSONA_ID env vars still work as deprecated aliases.
The Tavus wire payload keys are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

carolin-tavus and others added 4 commits June 26, 2026 09:53
Mocked pytest unit tests (no live API): face_id/pal_id map onto the unchanged
wire keys, deprecated replica_id/persona_id args and TAVUS_REPLICA_ID/
TAVUS_PERSONA_ID env vars still work and warn, env-var fallback, the
TAVUS_FACE_ID-required error, and AvatarSession alias resolution.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Tavus API now accepts face_id/pal_id on /v2/conversations and exposes
/v2/pals (pal_name + default_face_id). Send the new keys, add create_pal()
hitting /v2/pals, and auto-create a pal (not a persona) when none is given.
create_persona() stays as a deprecated alias on the legacy /v2/personas.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A pal carries its own default_face_id, so a conversation can be created from
pal_id alone. Require face_id only when no pal_id is given (to create one);
otherwise send pal_id and let the pal's default face apply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Instead of erroring when neither a face nor a pal is given, fall back to a
default stock face to create the pal, so the zero-config path works.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@carolin-tavus carolin-tavus marked this pull request as ready for review June 26, 2026 12:35
@carolin-tavus carolin-tavus requested a review from a team as a code owner June 26, 2026 12:35

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

@@ -0,0 +1,127 @@
import warnings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟑 New test file missing required category marker, which will block CI collection

The new test module lacks the mandatory pytestmark declaration (test_tavus.py:1), so pytest's category enforcement will reject it.

Impact: The tests cannot be selected or run under the standard --unit flag, and CI will fail if this file is ever added to the main test paths.

AGENTS.md rule and enforcement details

The repository's AGENTS.md states:

Adding a test: give the new module a category marker (pytestmark = pytest.mark.unit, etc.) β€” collection fails with a hint if it lacks one.

Every other test module in the repo (including the comparable livekit-plugins/livekit-plugins-sarvam/tests/test_speech_timing.py:13) declares a module-level pytestmark. This file contains pure unit tests (everything is mocked, no network or credentials needed), so the correct marker is pytest.mark.unit.

Suggested change
import warnings
import warnings
import pytest
pytestmark = pytest.mark.unit
Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

Comment on lines +108 to +110
if not pal_id:
# no pal to reuse, so create one β€” falling back to the default face
pal_id = await self.create_pal(default_face_id=face_id or DEFAULT_FACE_ID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Behavioral change: missing face/pal no longer raises an exception

Previously, if no replica_id was provided (via argument or env var), create_conversation raised TavusException("TAVUS_REPLICA_ID must be set"). Now, if neither face_id nor pal_id is provided, the code silently auto-creates a pal using DEFAULT_FACE_ID = "r72f7f7f7c8b" (livekit-plugins/livekit-plugins-tavus/livekit/plugins/tavus/api.py:27). This is a deliberate UX improvement (zero-config start), but existing users who relied on the error to catch missing configuration will no longer get that safety net. The default face ID is hardcoded; if it becomes invalid on the Tavus side, the API call will fail with a less clear error from the Tavus API rather than a local validation error.

Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

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.

2 participants