From 02d0e1216f47c446c03a8c6e7d6e52f394d34329 Mon Sep 17 00:00:00 2001 From: Ryan Gaus Date: Mon, 13 Oct 2025 16:54:01 -0400 Subject: [PATCH 1/3] feat: update readme to include agents sdk example --- README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a987ab8ef..a53979506 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,86 @@ Use this SDK to add realtime video, audio and data features to your React app. B ![LiveKit Components Preview](./.github/assets/livekit-meet.jpg) -## Quick Start +## Agents Quick Start + +First add the library to your project: + +```shell +npm i @livekit/components-react +``` + +Next, [host an agent manually](https://docs.livekit.io/agents/start/voice-ai/) or via [LiveKit Cloud Agents](https://docs.livekit.io/agents/ops/deployment/), and give it the name "example agent" + +Then, you can use the agents sdk to connect and talk with your agent: + +```tsx +import { useEffect, useState } from "react"; +import { TokenSource } from "livekit-client"; +import { + useSession, + useAgent, + SessionProvider, + VideoTrack, + StartAudio, + RoomAudioRenderer, +} from "@livekit/components-react"; + +// Generated credentials manually and put them here +// Or, generate them another way: FIXME: add docs link here! +const tokenSource = TokenSource.literal({ + serverUrl: "wss://my-livekit-server", + participantToken: 'generated-jwt', +}); + +export default function Example() { + const session = useSession(tokenSource, { + agentName: 'example agent', /* <== Put your agent name here! */ + }); + + const toggleStarted = () => { + if (session.connectionState === 'disconnected') { + session.start(); + } else { + session.end(); + } + }; + + const agent = useAgent(session); + + return ( + + + + {session.isConnected ? ( +
+ + Connection State: + {session.connectionState} + + + Agent State: + {agent.state} + + + {session.local.cameraTrack ? ( + + ) : null} + {agent.cameraTrack ? ( + + ) : null} + + + +
+ ) : null} +
+ ); +} +``` + +### Video Conference Quick Start First add the library to your project: From 284d8e86404f0f4a8abc6f36bd5b65cb31760220 Mon Sep 17 00:00:00 2001 From: Ryan Gaus Date: Tue, 14 Oct 2025 10:43:49 -0400 Subject: [PATCH 2/3] Update README.md Co-authored-by: Ben Cherry --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a53979506..e793e65de 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,9 @@ First add the library to your project: npm i @livekit/components-react ``` -Next, [host an agent manually](https://docs.livekit.io/agents/start/voice-ai/) or via [LiveKit Cloud Agents](https://docs.livekit.io/agents/ops/deployment/), and give it the name "example agent" +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). + +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"`. Then, you can use the agents sdk to connect and talk with your agent: From e28dfe3a592bc9afe3c3aaa4b5a8a967e89cc3f6 Mon Sep 17 00:00:00 2001 From: Ryan Gaus Date: Tue, 14 Oct 2025 10:54:22 -0400 Subject: [PATCH 3/3] refactor: rename agent name to be kabob case --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e793e65de..54ea88284 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ npm i @livekit/components-react 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). -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"`. +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"`. -Then, you can use the agents sdk to connect and talk with your agent: +Then, you can use the agents sdk to connect and interact with your agent: ```tsx import { useEffect, useState } from "react"; @@ -56,7 +56,7 @@ const tokenSource = TokenSource.literal({ export default function Example() { const session = useSession(tokenSource, { - agentName: 'example agent', /* <== Put your agent name here! */ + agentName: 'example-agent', /* <== Put your agent name here! */ }); const toggleStarted = () => {