You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next, you need a running agent. If you don't already have one, [it only takes a few minutes to set one up](https://docs.livekit.io/agents/start/voice-ai).
33
+
34
+
The rest of this guide assumes your agent is configured for [explicit dispatch](https://docs.livekit.io/agents/worker/agent-dispatch/#explicit) with `agent_name="example-agent"`.
35
+
36
+
Then, you can use the agents sdk to connect and interact with your agent:
37
+
38
+
```tsx
39
+
import { useEffect, useState } from"react";
40
+
import { TokenSource } from"livekit-client";
41
+
import {
42
+
useSession,
43
+
useAgent,
44
+
SessionProvider,
45
+
VideoTrack,
46
+
StartAudio,
47
+
RoomAudioRenderer,
48
+
} from"@livekit/components-react";
49
+
50
+
// Generated credentials manually and put them here
51
+
// Or, generate them another way: https://github.com/livekit/client-sdk-js?tab=readme-ov-file#generating-a-urltoken-with-tokensource
52
+
const tokenSource =TokenSource.literal({
53
+
serverUrl: "wss://my-livekit-server",
54
+
participantToken: 'generated-jwt',
55
+
});
56
+
57
+
exportdefaultfunction Example() {
58
+
const session =useSession(tokenSource, {
59
+
agentName: 'example-agent', /* <== Put your agent name here! */
0 commit comments