{"id":25480478,"url":"https://github.com/cycle-sync-ai/livekit-voice-ai-agent-setup","last_synced_at":"2025-04-09T17:08:11.582Z","repository":{"id":275096798,"uuid":"923175554","full_name":"cycle-sync-ai/livekit-voice-ai-agent-setup","owner":"cycle-sync-ai","description":"This is the guide to show the method to build your own AI-Powered voice agent with LiveKit and Twillio","archived":false,"fork":false,"pushed_at":"2025-02-05T10:23:32.000Z","size":617,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T17:08:04.165Z","etag":null,"topics":["agent","ai","assistant","deepgram","elevenlabs","livekit","openai","phone","pstn","python","realtime-chat","realtime-messaging","sip","stt","tts","twilio","voice","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cycle-sync-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-27T19:09:32.000Z","updated_at":"2025-03-20T07:53:22.000Z","dependencies_parsed_at":"2025-02-03T20:37:28.713Z","dependency_job_id":null,"html_url":"https://github.com/cycle-sync-ai/livekit-voice-ai-agent-setup","commit_stats":null,"previous_names":["easy-ai-tech/livekit-voice-ai-agent-setup","cycle-sync-ai/livekit-voice-ai-agent-setup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle-sync-ai%2Flivekit-voice-ai-agent-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle-sync-ai%2Flivekit-voice-ai-agent-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle-sync-ai%2Flivekit-voice-ai-agent-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle-sync-ai%2Flivekit-voice-ai-agent-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycle-sync-ai","download_url":"https://codeload.github.com/cycle-sync-ai/livekit-voice-ai-agent-setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074976,"owners_count":21043490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","assistant","deepgram","elevenlabs","livekit","openai","phone","pstn","python","realtime-chat","realtime-messaging","sip","stt","tts","twilio","voice","websocket"],"created_at":"2025-02-18T15:52:56.535Z","updated_at":"2025-04-09T17:08:11.561Z","avatar_url":"https://github.com/cycle-sync-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Livekit-Voice-AI-Agent-Workflow](images/livekit-voice-ai-agent-workflow.png)\n\n# How to Build Your Own AI-Powered Voice Agent with LiveKit and Twillio: Step-by-Step Implementation Guide\n\n## Step 1: Create a Twilio Account\n\nStart by signing up for a Twilio account if you haven’t already. Simply visit [Twilio’s website](https://www.twilio.com/) and follow the registration process to set up your account.\n\n## Step 2: Create a Phone Number\n\nOnce your account is ready, navigate to the Twilio Console and create a phone number. You don’t need to configure any additional settings at this stage—just select a number and you’re good to go. This number will be used to handle incoming and outgoing calls in the later steps.\n\n## Step 3: Get Your API Credentials from Twilio\n\nNext, you’ll need your Twilio API credentials to integrate with LiveKit. These include your Account SID and Auth Token. Follow these steps:\n\n1. Go to the Twilio Console.\n2. Navigate to the Account Info section.\n3. Copy your Account SID and Auth Token, and Twillio phone number —you’ll use these in the next steps.\n   ![Twilio-API-Credentials](images/twilio-api-credentials.png)\n\n## Step 4: Create a LiveKit Account and Project\n\n1. Create a LiveKit Account\n\nSign up for a LiveKit account if you don’t have one already by visiting LiveKit’s website.\n\n2. Create a Project\n\nAfter signing up, log in and create a new project within LiveKit. This project will be used to handle real-time audio and video interactions.\n\n3. Get the Project URL and SIP URI Parameters\n\nNavigate to the Settings section of your newly created project and locate the Project URL and SIP URI parameters. These will be crucial in the later steps when configuring the integration.\n\n![LiveKit-Project-Settings](images/livekit-project-settings.png)\n\n## Step 5: Simplify Complex Settings with a Script\n\nTo streamline the configuration process for Twilio and LiveKit, use the pre-built script available at the following URL: Twilio \u0026 LiveKit Integration Script(scripts/create_inbound_trunk.py).\n\nHere’s what you need to do:\n\n1. Download or clone the script from the link above.\n\n2. Replace the placeholders in the script with the necessary details:\n\n- Account SID\n- Auth Token\n- Phone Number\n- SIP URI (found in previous steps)\n\n3. To ensure your environment is ready for Twilio, LiveKit, and OpenAI integration, install the necessary Python packages. Run the following command in your terminal:\n\n```bash\npip install -r requirements.txt\n```\n\n4. Install the LiveKit SDK\n\nIf you’re using macOS, you can install the LiveKit CLI via Homebrew:\n\n```bash\nbrew install livekit-cli # MacOS\nwinget install LiveKit.LiveKitCLI # Windows\ncurl -sSL https://get.livekit.io/cli | bash # Linux\n```\n\n5. Authenticate with LiveKit\n\nAfter installation, authenticate to your LiveKit account by running the following command:\n\n```bash\nlk cloud auth\n```\n\n6. Run the script to automatically configure Twilio and LiveKit with the required settings, minimizing the manual setup process. It will automatically create a SIP Trunk in Twilio and make all required configurations.\n\nThis script will handle most of the heavy lifting, simplifying the integration between Twilio and LiveKit for real-time communication.\n\n![Twilio-SIP-Trunk-Configuration](images/twilio-sip-trunk-configuration.png)\n\n## Step 6: Log in to Twilio and Update Voice Configuration on SIP Trunk\n\nAfter the script has automatically created the SIP Trunk on Twilio, you’ll need to manually update the Voice Configuration to ensure everything works correctly.\n\n# Run Voice Agent\n\n- OpenAI Realtime Voice AI Agent\n\n```bash\npython scripts/openai_realtime_voice_ai_agent.py\n```\n\n- Run Voice Pipeline AI Agent with Functional Calling and Saving chat message\n\n```bash\npython scripts/save_chatctx.py\n```\n\n# Useful livekit-cli commands\n\n```\nlk sip inbound list\nlk sip inbound create inbound_trunk.json\nlk sip inbound delete SIP_ID\n```\n\n# Preferences\n\nhttps://docs.livekit.io/agents/overview/\nhttps://docs.livekit.io/agents/quickstarts/voice-agent/\n\nhttps://agents-playground.livekit.io/\nhttps://kitt.livekit.io/\nhttps://cartesia-assistant.vercel.app/\n\nhttps://github.com/livekit/agents/tree/main/examples/voice-pipeline-agent/llamaindex-rag\n\nhttps://www.datavise.ai/blog/usage-of-realtime-openai-api-with-twillio-and-livekit\nhttps://gist.github.com/ShayneP/51eabe243f9e7126929ea7e9db1dc683\n\n# Author\n\n[Discord](https://discord.gg/TawJX4ue)\n[Email](mailto:worker.opentext@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle-sync-ai%2Flivekit-voice-ai-agent-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycle-sync-ai%2Flivekit-voice-ai-agent-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle-sync-ai%2Flivekit-voice-ai-agent-setup/lists"}