Created
November 18, 2025 17:33
-
-
Save superMDguy/2b9096085b03be3349b977489dd0fc8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dotenv import load_dotenv | |
| from livekit import agents | |
| from livekit.agents import Agent, AgentSession | |
| from livekit.plugins import elevenlabs | |
| load_dotenv() | |
| class Assistant(Agent): | |
| def __init__(self) -> None: | |
| super().__init__( | |
| instructions="""You are a helpful voice AI assistant. | |
| You eagerly assist users with their questions by providing information from your extensive knowledge. | |
| Your responses are concise, to the point, and without any complex formatting or punctuation including emojis, asterisks, or other symbols. | |
| You are curious, friendly, and have a sense of humor.""", | |
| ) | |
| async def entrypoint(ctx: agents.JobContext): | |
| session = AgentSession( | |
| stt="assemblyai/universal-streaming:en", | |
| llm="openai/gpt-4.1-mini", | |
| tts=elevenlabs.TTS( | |
| model="eleven_flash_v2_5", | |
| # Or any other voice ID you haven't used yet | |
| voice_id="OUMCzFUTd0F4Q6lkLkco", | |
| ), | |
| ) | |
| await session.start( | |
| room=ctx.room, | |
| agent=Assistant(), | |
| ) | |
| await session.generate_reply( | |
| instructions="Greet the user and offer your assistance." | |
| ) | |
| if __name__ == "__main__": | |
| agents.cli.run_app( | |
| agents.WorkerOptions( | |
| entrypoint_fnc=entrypoint, | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment