i have created a livekit voice agent and have conf...
# ask-ai
f
i have created a livekit voice agent and have configured the sanbox using project credentials. I want to use the livekit sandbox url link and run it in browser, i have my livekit project running locally using terminal: python main.py dev which i run from terminal and open livekit playground, how can i use the sandbox url to link this backend project?
t
Thanks for reaching out, Viren. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you link your locally running backend project with the LiveKit sandbox URL! Just follow these simple steps: 1. Set Up LiveKit CLI: First, install the LiveKit CLI and authenticate with your LiveKit Cloud account by running
lk cloud auth
. This step connects your local project to the sandbox smoothly. 2. Configure Your Backend: Next, update your backend project with these environment variables: ◦
LIVEKIT_API_KEY
◦
LIVEKIT_API_SECRET
◦
LIVEKIT_URL
(for example,
wss://<project-subdomain>.livekit.cloud
) ◦
LIVEKIT_SANDBOX_ID
(if your template requires it) 1. Run Your Backend: Then, start your backend server locally (something like
python main.py dev
or whatever fits your project setup). 2. Access the Sandbox URL: Finally, open the sandbox URL in your browser. Your frontend will talk to your backend using the shared project credentials. Just a quick tip: make sure your backend and the sandbox frontend use the same
roomName
so you join the right session. If you have any questions or run into any trouble, please don’t hesitate to reach out—I’m here to help! Sources: complex-agents/role-playing/role_playing_frontend/.env.example | TEMPLATE.md | TEMPLATE.md | .env.example | .env.example
f
i have "LIVEKIT_URL" in my .env which is different from "Hosted url" in sandbox.
t
Thanks for reaching out! I’d love to help clarify the difference between the
LIVEKIT_URL
and the "Hosted URL" in the sandbox—they actually serve different but important roles: • `LIVEKIT_URL`: This is the WebSocket endpoint (for example,
wss://<project-subdomain>.livekit.cloud
) that your backend and clients use to connect to the LiveKit server for real-time communication. • Hosted URL: This is the public web address of the sandboxed application (like `https://cloud.livekit.io/projects/p_/sandbox`) where the frontend lives and is accessible to users. To make sure everything works smoothly, your backend should connect using the
LIVEKIT_URL
, while the "Hosted URL" is what you use to access the sandboxed frontend. If anything’s still unclear or you’d like a hand setting this up, just let me know—I’m here to help! Sources: base-frontend-template/.env.example | Self-hosting the Egress Service | LiveKit docs | Sandbox | LiveKit docs | Template Dependency System | livekit/livekit_composite | DeepWiki | cmd/lk/agent.go
f
where do i get the "LIVEKIT_SANDBOX_ID" value from?
t
I'm happy to help you find your
LIVEKIT_SANDBOX_ID
! You can locate it easily in the LiveKit Cloud Console by following these steps: 1. First, log in to your LiveKit Cloud account. 2. Then, head over to the Sandboxes page. 3. Find the sandbox you created, and you’ll see the
LIVEKIT_SANDBOX_ID
displayed right there. Once you have that ID, just add it to your environment configuration (like your
.env
file) under
LIVEKIT_SANDBOX_ID
. If you run into any questions or need a hand with anything else, please don’t hesitate to reach out—I’m here to support you! Sources: lib/services/token_service.dart | .env.example | VoiceAgent/.env.example.xcconfig | swift-frontend/VisionDemo/.env.example.xcconfig | lib/src/token_source/sandbox.dart
f
is it just above launch icon?
t
Hi there! You'll usually find the
LIVEKIT_SANDBOX_ID
just above the "Launch" icon on the Sandboxes page in your LiveKit Cloud Console. Once you spot it, feel free to copy it and use it in your environment configuration. If you have any questions or need a hand with anything else, just let me know—I'm here to help!
f
please help me understand how will my livekit sandbox interact with my main.py in backend?
t
I'm glad you're exploring how your LiveKit sandbox connects with your
main.py
backend! They work together by joining the same LiveKit room, which allows them to communicate in real time. Here's a friendly breakdown of how it all fits together: 1. Sandbox Frontend: This part runs a frontend application that connects to the LiveKit server using your
LIVEKIT_URL
and authenticates with tokens, making sure everything is secure. 2. Backend Configuration: Your
main.py
backend uses the LiveKit Python SDK to join that same LiveKit room. Just make sure your environment variables include: Setting these up correctly helps everything run smoothly! ◦
LIVEKIT_URL
◦
LIVEKIT_API_KEY
◦
LIVEKIT_API_SECRET
1. Real-Time Interaction: Once connected, your backend can participate in the room, handle media streams, and chat with the frontend using Remote Procedure Calls (RPC). It’s like they’re having a live conversation! 2. Example Workflow: For example, your backend might do things like transcribing audio or running AI processes, then send updates back to the frontend instantly. If you'd like, I’d be happy to walk you through some detailed code examples or help clarify how to set up the Python SDK. Just let me know—I’m here to help! Sources: Sandbox | LiveKit docs | complex-agents/nova-sonic/nova-sonic-form-agent/.env.example | README.md | Remote method calls | LiveKit docs | templates.yaml