Skip to content

feat(tavus): rename replicaId/personaId options to faceId/palId#1886

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

feat(tavus): rename replicaId/personaId options to faceId/palId#1886
carolin-tavus wants to merge 9 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

Description

Align the Tavus plugin with Tavus's renamed API (replicaface, personapal). Public options, env vars, and the wire payload move to the new naming, with the old names kept as deprecated aliases (non-breaking for plugin users).

Changes Made

  • Add faceId/palId options (and TAVUS_FACE_ID/TAVUS_PAL_ID env vars) to AvatarSession and TavusAPI.createConversation.
  • Send face_id/pal_id on the conversation-create payload; add createPal() hitting POST /v2/pals (pal_name + default_face_id), and auto-create a pal (not a persona) when none is supplied.
  • Keep replicaId/personaId options, TAVUS_REPLICA_ID/TAVUS_PERSONA_ID env vars, and createPersona() (legacy /v2/personas) working as deprecated aliases with a warning.
  • turbo.json env-var declarations + changeset.

Pre-Review Checklist

  • Build passes: pnpm --filter @livekit/agents-plugin-tavus... build (incl. tsc typecheck), lint, prettier --check, and api:check pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title
  • Video demo: (n/a — naming/wire-key change, no behavior change)

Testing

  • Unit tests added — 7 mocked vitest cases (new keys on the face_id/pal_id wire payload, deprecated args/env still work + warn, auto-create routes to /v2/pals with default_face_id, the TAVUS_FACE_ID-required error)
  • Build/lint/typecheck/api:check pass locally
  • restaurant_agent.ts / realtime_agent.ts — n/a

Additional 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. Verified the full new path end-to-end against staging.

Tavus is renaming its public API surface from replica/persona to face/pal.
Rename the plugin's public options (faceId/palId) and env vars
(TAVUS_FACE_ID/TAVUS_PAL_ID); the old replicaId/personaId options 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>
@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bbc9aa6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@livekit/agents-plugin-tavus Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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.

turbo/no-undeclared-env-vars lint rule requires env vars read in source to
be listed in globalEnv.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
carolin-tavus and others added 5 commits June 26, 2026 09:52
Mocked vitest unit tests (no live API): faceId/palId map onto the unchanged
wire keys, deprecated replicaId/personaId still work and warn, env-var
fallback, and the TAVUS_FACE_ID-required error.

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 createPal()
hitting /v2/pals, and auto-create a pal (not a persona) when none is given.
createPersona() stays as a deprecated alias on the legacy /v2/personas.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
palId alone. Require faceId only when no palId is given (to create one);
otherwise send palId 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

@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 3 potential issues.

Open in Devin Review

Comment thread plugins/tavus/src/api.ts Outdated
Comment thread plugins/tavus/src/api.ts
Comment thread plugins/tavus/src/api.ts
Comment on lines +132 to +134
if (!palId) {
// no pal to reuse, so create one — falling back to the default face
palId = await this.createPal({ defaultFaceId: faceId || 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.

🚩 New pal is created on every conversation when palId is not cached

When no palId is provided (neither via options nor env), createConversation calls createPal which makes an extra HTTP request to /v2/pals on every invocation. If createConversation is called multiple times for the same face (e.g., in a loop or for multiple sessions), a new pal is created each time. There's no caching of the created pal ID. This may be intentional (each conversation gets its own pal) or it may cause unnecessary API calls and pal proliferation. Worth confirming with the Tavus API's expected usage pattern.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@carolin-tavus is this a valid comment?

Align the Tavus plugin with the new face/pal API, updating options and environment variables while maintaining deprecated aliases.

@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 1 new potential issue.

Open in Devin Review

Comment thread plugins/tavus/src/api.ts
Comment on lines +127 to +130
let palId =
resolveRenamedOption(options.palId, options.personaId, 'personaId', 'palId') ||
process.env.TAVUS_PAL_ID ||
deprecatedEnv('TAVUS_PERSONA_ID', 'TAVUS_PAL_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.

🚩 Deprecated personaId values are now sent as pal_id on the wire

When a caller passes the deprecated personaId option, resolveRenamedOption at plugins/tavus/src/api.ts:128 maps it to palId, which is sent as pal_id on the wire (plugins/tavus/src/api.ts:138). The old code sent this same value as persona_id. If the Tavus API treats persona IDs and pal IDs as distinct namespaces, existing persona IDs passed via the deprecated option would fail on the new endpoint. This is likely correct if Tavus's API migration accepts old persona IDs as pal IDs, but it's worth confirming with the Tavus API documentation.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@carolin-tavus is this a valid comment?

Previously the deprecation warning fired whenever a deprecated option was
present, even if the new option was also given and took precedence. Warn only
when the deprecated value is the one used. (addresses Devin review comment)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants