### Install and Run Frontend Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/role-playing/role_playing_frontend/README.md Navigate to the frontend directory and install dependencies, then start the development server. Ensure the Python agent backend is running first. ```bash cd complex-agents/role-playing/role_playing_frontend pnpm install pnpm dev ``` -------------------------------- ### Install Dependencies and Run App Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/avatars/hedra/education_avatar/education-frontend/README.md Install project dependencies and start the development server. Access the app at http://localhost:3000. ```bash pnpm install pnpm dev ``` -------------------------------- ### Run the Frontend Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/exa-deep-researcher/README.md Navigate to the frontend directory and install its dependencies using pnpm, then start the development server. ```bash cd complex-agents/exa-deep-researcher/frontend pnpm install pnpm dev ``` -------------------------------- ### Install and Run Frontend Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/avatars/tavus/voice-assistant-frontend/README.md Commands to set up and start the frontend development server. Open http://localhost:3000 in your browser after running. ```bash cd voice-assistant-frontend npm install npm run dev ``` -------------------------------- ### Install Frontend Dependencies and Start Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/ivr-agent/README.md Installs Node.js dependencies for the React frontend and starts the development server. This should be run in a separate terminal. ```bash cd ivr-agent-frontend pnpm install pnpm dev ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/teleprompter/teleprompter-frontend/README.md Copies the example environment file and prompts for required LiveKit credentials. Alternatively, use the LiveKit CLI for automatic setup. ```console lk app env --write ``` -------------------------------- ### Run the Example Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/warm_handoff/README.md Execute the Python script from the command line to start the agent and handle warm handoffs. ```console python warm_handoff.py console ``` -------------------------------- ### Install Dependencies and Configure Environment Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/nova-sonic/nova-sonic-form-agent/README.md Installs project dependencies using pnpm and copies the example environment file. Configure your LiveKit credentials in the .env.local file. ```bash git clone cd nova-sonic-form-agent pnpm install cp .env.example .env.local ``` -------------------------------- ### Start the Frontend Application Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/vision/README.md Navigates to the frontend directory and starts the Next.js development server. Ensure Node.js and pnpm are installed. ```bash cd agent-vision-frontend pnpm install pnpm dev ``` -------------------------------- ### Start the Teleprompter Frontend Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/teleprompter/README.md Navigate to the frontend directory and install its dependencies, then start the Next.js development server. This makes the teleprompter interface accessible in your browser. ```bash cd teleprompter-frontend npm install npm run dev ``` -------------------------------- ### Launch Frontend Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/call-moderation/README.md Commands to install dependencies and start the frontend development server. Access the UI at http://localhost:3000. ```bash cd ../frontend pnpm install cp .env.example .env.local pnpm dev ``` -------------------------------- ### Full Audio Player Agent Example Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/playing_audio/README.md This comprehensive example sets up an agent that can play a local audio file when requested. It includes agent definition, function tool for audio playback, and server setup. ```python import logging from pathlib import Path import wave from dotenv import load_dotenv from livekit.agents import JobContext, JobProcess, AgentServer, cli, Agent, AgentSession, inference, RunContext, function_tool from livekit.plugins import silero from livekit import rtc load_dotenv() logger = logging.getLogger("playing-audio") logger.setLevel(logging.INFO) class AudioPlayerAgent(Agent): def __init__(self) -> None: super().__init__( instructions=''' You are a helpful assistant communicating through voice. Don't use any unpronouncable characters. If asked to play audio, use the `play_audio_file` function. ''' ) @function_tool async def play_audio_file(self, context: RunContext): """Play a local audio file""" audio_path = Path(__file__).parent / "audio.wav" with wave.open(str(audio_path), 'rb') as wav_file: num_channels = wav_file.getnchannels() sample_rate = wav_file.getframerate() frames = wav_file.readframes(wav_file.getnframes()) audio_frame = rtc.AudioFrame( data=frames, sample_rate=sample_rate, num_channels=num_channels, samples_per_channel=wav_file.getnframes() ) async def audio_generator(): yield audio_frame await self.session.say("Playing audio file", audio=audio_generator()) return None, "I've played the audio file for you." async def on_enter(self): self.session.generate_reply() server = AgentServer() def prewarm(proc: JobProcess): proc.userdata["vad"] = silero.VAD.load() server.setup_fnc = prewarm @server.rtc_session() async def entrypoint(ctx: JobContext): ctx.log_context_fields = {"room": ctx.room.name} session = AgentSession( stt=inference.STT(model="deepgram/nova-3-general"), llm=inference.LLM(model="openai/gpt-5-mini"), tts=inference.TTS(model="cartesia/sonic-3", voice="9626c31c-bec5-4cca-baa8-f8ba9e84c8bc"), vad=ctx.proc.userdata["vad"], preemptive_generation=True, ) await session.start(agent=AudioPlayerAgent(), room=ctx.room) await ctx.connect() if __name__ == "__main__": cli.run_app(server) ``` -------------------------------- ### Launch Dashboard Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/call-queue/README.md Navigate to the frontend directory, install dependencies, configure LiveKit credentials, and start the development server. Access the dashboard via the provided URL. ```bash cd ../frontend pnpm install cp .env.example .env.local # reuse the same LIVEKIT_* values pnpm dev ``` -------------------------------- ### Full Agent Example with Function Calling Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/update_tools/README.md This example demonstrates a complete Python agent setup. It includes defining a custom tool (`print_to_console`), prewarming resources, and dynamically updating the agent's tools with a new function (`random_number`) during an RTC session. Use this as a starting point for building your own LiveKit agents. ```python import logging import random from dotenv import load_dotenv from livekit.agents import JobContext, JobProcess, AgentServer, cli, Agent, AgentSession, inference, RunContext, function_tool from livekit.plugins import silero logger = logging.getLogger("function-calling") logger.setLevel(logging.INFO) load_dotenv() class AddFunctionAgent(Agent): def __init__(self) -> None: super().__init__( instructions=""" You are a helpful assistant communicating through voice. Don't use any unpronouncable characters. Note: If asked to print to the console, use the `print_to_console` function. """ ) @function_tool async def print_to_console(self, context: RunContext): print("Console Print Success!") return None, "I've printed to the console." async def on_enter(self): self.session.generate_reply() server = AgentServer() def prewarm(proc: JobProcess): proc.userdata["vad"] = silero.VAD.load() server.setup_fnc = prewarm @server.rtc_session() async def entrypoint(ctx: JobContext): ctx.log_context_fields = {"room": ctx.room.name} session = AgentSession( stt=inference.STT(model="deepgram/nova-3-general"), llm=inference.LLM(model="openai/gpt-4.1-mini"), tts=inference.TTS(model="cartesia/sonic-3", voice="9626c31c-bec5-4cca-baa8-f8ba9e84c8bc"), vad=ctx.proc.userdata["vad"], preemptive_generation=True, ) agent = AddFunctionAgent() async def _random_number() -> int: num = random.randint(0, 100) logger.info(f"random_number called: {num}") return num await agent.update_tools( agent.tools + [function_tool(_random_number, name="random_number", description="Get a random number")] ) await session.start(agent=agent, room=ctx.room) await ctx.connect() if __name__ == "__main__": cli.run_app(server) ``` -------------------------------- ### Install Frontend Dependencies and Start Dev Server Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/shopify-voice-shopper/README.md Installs Node.js dependencies and starts the Next.js development server for the frontend and Chrome extension. ```bash cd shopify-voice-frontend pnpm install pnpm dev ``` -------------------------------- ### Run the Example Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/replacing_llm_output/README.md Command to execute the agent server and run the example locally. ```bash python replacing_llm_output.py console ``` -------------------------------- ### Start Development Server Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/call-queue/frontend/README.md Starts the Next.js development server. This command should be run after installing dependencies and configuring environment variables. ```bash pnpm dev ``` -------------------------------- ### Run the Example Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/langchain_langgraph/README.md Execute the agent server from the console. ```console python langchain_langraph.py console ``` -------------------------------- ### Run the Frontend Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/role-playing/README.md Navigate to the frontend directory and start the development server. ```bash cd role_playing_frontend pnpm install && pnpm dev ``` -------------------------------- ### Full Example Code Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/large_context/README.md Provides the complete Python code for the large context LLM agent example, including all imports, setup, configuration, and execution logic. ```python import logging from pathlib import Path from dotenv import load_dotenv from livekit.agents import JobContext, JobProcess, cli, Agent, AgentSession, AgentServer, inference from livekit.plugins import openai, google, deepgram, silero load_dotenv() logger = logging.getLogger("google_llm") logger.setLevel(logging.INFO) ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/avatars/lemonslice/README.md Clone the repository and navigate into the project directory to begin installation. ```bash git clone cd lemonslice ``` -------------------------------- ### Setup Environment and Logging Source: https://github.com/livekit-examples/python-agents-examples/blob/main/docs/examples/keyword-detection/README.md Loads environment variables and configures logging for the agent. Ensure you have a `.env` file with LiveKit credentials. ```python import logging from dotenv import load_dotenv from livekit.agents import JobContext, JobProcess, cli, Agent, AgentSession, AgentServer, inference from livekit.plugins import silero load_dotenv() logger = logging.getLogger("keyword-detection") logger.setLevel(logging.INFO) server = AgentServer() ``` -------------------------------- ### Backend Configuration Example Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/avatars/lemonslice/README.md Example environment variables for LiveKit and LemonSlice configuration. ```bash # LiveKit Configuration LIVEKIT_API_KEY=your_livekit_api_key LIVEKIT_API_SECRET=your_livekit_api_secret LIVEKIT_URL=wss://your-project.livekit.cloud # LemonSlice Configuration LEMONSLICE_API_KEY=your_lemonslice_api_key ``` -------------------------------- ### Start the Frontend Development Server Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/avatars/lemonslice/README.md Navigate to the frontend directory and start the development server. ```bash cd frontend pnpm dev ``` -------------------------------- ### Clone Repository and Navigate to Demo Source: https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/avatars/anam/README.md Clone the repository and navigate to the anam demo directory to begin setup. ```bash git clone cd complex-agents/avatars/anam ```