LiveAvatar

Updated

Use a LiveAvatar avatar to represent your agent on video in a Conversational AI Platform agent.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.

LiveAvatar by HeyGen provides AI-powered avatars with high-quality video rendering and customizable video quality settings, enabling professional video conversations with your AI agents.

Sample configuration

The following example shows how to configure LiveAvatar as the agent's avatar when you create or update an agent. For a complete example, see Create an agent and start a session.

LiveAvatar supports BYOK only. It isn't available in managed mode. Store your LiveAvatar API key in a secret set, and refer to it from the agent. For details, see Use your own provider keys.

from agora_agent import Agent, LiveAvatarAvatar, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure a TTS vendor with a 24,000 Hz sample rate
    .with_avatar(
        LiveAvatarAvatar(
            api_key=secret_ref("support_prod", "liveavatar"),
            quality="high",
            agora_uid="<avatar_rtc_uid>",
            agora_token="<avatar_rtc_token>",
            avatar_id="65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0",
        )
    )
)
import { Agent, LiveAvatarAvatar, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure a TTS vendor with a 24,000 Hz sample rate */)
  .withAvatar(
    new LiveAvatarAvatar({
      apiKey: secretRef('support_prod', 'liveavatar'),
      quality: 'high',
      agoraUid: '<avatar_rtc_uid>',
      agoraToken: '<avatar_rtc_token>',
      avatarId: '65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0',
    }),
  );
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure a TTS vendor with a 24,000 Hz sample rate */ ).
	WithAvatar(vendors.NewLiveAvatarAvatar(vendors.LiveAvatarAvatarOptions{
		APIKey:     agentkit.SecretRef("support_prod", "liveavatar"),
		Quality:    "high",
		AgoraUID:   "<avatar_rtc_uid>",
		AgoraToken: "<avatar_rtc_token>",
		AvatarID:   "65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0",
	}))

Add an avatar block to the pipeline. Set credential.mode to byok and credential.fields.api_key to the reference. In the following example, the key is stored as liveavatar in the support_prod set:

"avatar": {
  "enabled": true,
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.liveavatar"
    }
  },
  "vendor": "liveavatar",
  "params": {
    "agora_token": "<avatar_rtc_token>",
    "agora_uid": "<avatar_rtc_uid>",
    "quality": "high",
    "avatar_id": "65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0"
  }
}

Info

LiveAvatar only supports audio with a sample rate of 24,000 Hz. Using a TTS model configured with a different sample rate results in an error. Make sure that your TTS configuration matches this requirement.

Key parameters

The avatar block takes the following fields. In the SDKs, LiveAvatarAvatar sets them from its options, and passes any other parameters from its additional parameters option to params.

avatarrequired
enabledboolean
required

Set to true to show the avatar.

vendorstring
required

Set to liveavatar.

credentialobject
required

Set mode to byok and fields.api_key to a $secrets.<set>.<key> reference to your LiveAvatar API key. Get your API key from the LiveAvatar console.

paramsobject
required
qualitystring
required
Possible values
  • low
  • medium
  • high

The video quality for the avatar rendering.

  • "high" (720p)
  • "medium" (480p)
  • "low" (360p)

Higher quality provides a better visual experience but requires more bandwidth.

agora_uidstring
required

The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel.

agora_tokenstring
optional

The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials.

avatar_idstring
optional

The unique identifier for the avatar you want to use.

disable_idle_timeoutboolean
optional
Default value
false

Whether to disable the idle timeout feature.

activity_idle_timeoutinteger
optional
Default value
120

The number of seconds of inactivity before the avatar session times out. Only applies when disable_idle_timeout is false.

For advanced configuration options, refer to the LiveAvatar official documentation.

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.