|
| 1 | +<!-- |
| 2 | +SPDX-FileCopyrightText: 2025 LiveKit, Inc. |
| 3 | +
|
| 4 | +SPDX-License-Identifier: Apache-2.0 |
| 5 | +--> |
| 6 | + |
| 7 | +# Beyond Presence plugin for LiveKit Agents |
| 8 | + |
| 9 | +Support for [Beyond Presence](https://docs.bey.dev) virtual avatars. |
| 10 | + |
| 11 | +See [https://docs.livekit.io/agents/integrations/avatar/bey/](https://docs.livekit.io/agents/integrations/avatar/bey/) for more information. |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +```bash |
| 16 | +npm install @livekit/agents-plugin-bey |
| 17 | +``` |
| 18 | + |
| 19 | +or |
| 20 | + |
| 21 | +```bash |
| 22 | +pnpm add @livekit/agents-plugin-bey |
| 23 | +``` |
| 24 | + |
| 25 | +## Pre-requisites |
| 26 | + |
| 27 | +Create a developer API key from the [creator dashboard](https://app.bey.chat) and set the `BEY_API_KEY` environment variable with it: |
| 28 | + |
| 29 | +```bash |
| 30 | +export BEY_API_KEY=<your-bey-api-key> |
| 31 | +``` |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +```typescript |
| 36 | +import { AvatarSession } from '@livekit/agents-plugin-bey'; |
| 37 | +import { AgentSession } from '@livekit/agents'; |
| 38 | + |
| 39 | +// Create an avatar session |
| 40 | +const avatarSession = new AvatarSession({ |
| 41 | + avatarId: 'your-avatar-id', // optional, defaults to stock avatar |
| 42 | + apiKey: process.env.BEY_API_KEY, // optional if set via env var |
| 43 | +}); |
| 44 | + |
| 45 | +// Start the avatar in your agent |
| 46 | +await avatarSession.start(agentSession, room, { |
| 47 | + livekitUrl: process.env.LIVEKIT_URL, |
| 48 | + livekitApiKey: process.env.LIVEKIT_API_KEY, |
| 49 | + livekitApiSecret: process.env.LIVEKIT_API_SECRET, |
| 50 | +}); |
| 51 | +``` |
| 52 | + |
| 53 | +## API |
| 54 | + |
| 55 | +### `AvatarSession` |
| 56 | + |
| 57 | +Creates a new Beyond Presence avatar session. |
| 58 | + |
| 59 | +#### Constructor Options |
| 60 | + |
| 61 | +- `avatarId?: string` - The avatar ID to use. Defaults to stock avatar. |
| 62 | +- `apiUrl?: string` - The Bey API URL. Defaults to `https://api.bey.dev`. |
| 63 | +- `apiKey?: string` - Your Bey API key. Can also be set via `BEY_API_KEY` environment variable. |
| 64 | +- `avatarParticipantIdentity?: string` - The identity for the avatar participant. Defaults to `'bey-avatar-agent'`. |
| 65 | +- `avatarParticipantName?: string` - The name for the avatar participant. Defaults to `'bey-avatar-agent'`. |
| 66 | +- `connOptions?: APIConnectOptions` - Connection options for retry logic. |
| 67 | + |
| 68 | +#### Methods |
| 69 | + |
| 70 | +##### `start(agentSession: AgentSession, room: Room, options?: StartOptions): Promise<void>` |
| 71 | + |
| 72 | +Starts the avatar session and connects it to the room. |
| 73 | + |
| 74 | +**Options:** |
| 75 | +- `livekitUrl?: string` - The LiveKit server URL. Can also be set via `LIVEKIT_URL` environment variable. |
| 76 | +- `livekitApiKey?: string` - Your LiveKit API key. Can also be set via `LIVEKIT_API_KEY` environment variable. |
| 77 | +- `livekitApiSecret?: string` - Your LiveKit API secret. Can also be set via `LIVEKIT_API_SECRET` environment variable. |
| 78 | + |
| 79 | +## License |
| 80 | + |
| 81 | +Apache 2.0 |
0 commit comments