Usage
The AgentSessionProvider doesn't render UI.
It is a context provider for the LiveKit session.
It is a context provider for the LiveKit session.
Code
'use client';import { useSession } from '@livekit/components-react';import { AgentSessionProvider } from '@/components/agents-ui/agent-session-provider';const TOKEN_SOURCE = TokenSource.sandboxTokenServer(process.env.MY_LK_SANDBOX_TOKEN_SERVER_ID);export function Demo() {const session = useSession(TOKEN_SOURCE);return (<AgentSessionProvider session={session}>{/* Agent UI application components go here */}</AgentSessionProvider>);}
Features
- Provides the agent session context to the child components
- Ensures remote participants’ audio tracks (microphones and screen share) are audible
Installation
pnpm dlx shadcn@latest add @agents-ui/agent-session-provider
Props
| Prop name | Type | Default |
|---|---|---|
session | UseSessionReturn | – |
children | ReactNode | – |
room? | Room | – |
volume? | number | – |
muted? | boolean | – |