A Beyond Presence avatar session.

This class manages the connection between a LiveKit agent and a Beyond Presence avatar, routing agent audio output to the avatar for visual representation.

Example

const avatar = new AvatarSession({
avatarId: 'your-avatar-id',
apiKey: 'your-bey-api-key',
});
await avatar.start(agentSession, room);

Constructors

Methods

Constructors

Methods

  • Starts the avatar session and connects it to the agent.

    This method:

    1. Creates a LiveKit token for the avatar participant
    2. Calls the Beyond Presence API to start the avatar session
    3. Configures the agent's audio output to stream to the avatar

    Parameters

    • agentSession: AgentSession<unknown>

      The agent session to connect to the avatar

    • room: Room

      The LiveKit room where the avatar will join

    • options: StartOptions = {}

      Optional LiveKit credentials (falls back to environment variables)

    Returns Promise<void>

    Throws

    BeyException if LiveKit credentials are not available or if the avatar session fails to start