I have the agent-starter-python template and I wan...
# ask-ai
g
I have the agent-starter-python template and I want to know how to deploy it and connect it to my frontend
t
Thanks for reaching out, Eden. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Ready to get your
agent-starter-python
template up and running with a frontend? Just follow these simple steps: 1. Bootstrap the Python Agent: Start by using the LiveKit CLI to create a new app from the
agent-starter-python
template: `lk app create --template agent-starter-python my-agent`This will clone the template repo, install everything you need, and set up your environment with your LiveKit project credentials. 2. Set Up Environment Variables: Next, copy
.env.example
to
.env.local
and fill in the required details like
LIVEKIT_URL
,
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, and any other API keys you might need (like
OPENAI_API_KEY
). Or, if you prefer, you can let the LiveKit CLI handle this automatically:
lk app env
3. Start the Agent: Head into your agent directory, activate the virtual environment, and launch the agent in development mode:
Copy code
cd my-agent
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 agent.py dev
4. Bootstrap and Run a Frontend: Now, create and start a frontend app that connects to your agent. We recommend using the
agent-starter-react
frontend:
Copy code
lk app create --template agent-starter-react my-frontend
cd my-frontend
pnpm install
pnpm dev
5. Connect and Test: Open your browser and go to
<FRONTEND_URL>
. Just hit Connect and you’re ready to chat with your voice agent! Oh, and by the way—you can also hook up other frontend templates like
agent-starter-android
,
agent-starter-swift
,
agent-starter-flutter
, or
agent-starter-react-native
to the same agent backend. They’re all designed to work seamlessly together. Sources: Bootstrapping an application | LiveKit Docs | README.md | OpenAI Realtime API Quickstart | LiveKit Docs | templates.yaml
g
I have a custom frontend with my API route setup. I just need to know how to connect my agent in the cloud to my frontend. Check the attached code files.
t
Let's get your custom frontend connected to an agent deployed in the cloud! Here’s a simple step-by-step guide to help you through it: 1. Deploy the Agent to LiveKit Cloud: Start by using the LiveKit CLI to deploy your agent. Just run: `lk agent create`This will register your agent with LiveKit Cloud, give it a unique ID, and deploy it for you. Behind the scenes, it uploads your agent code, builds an image from your Dockerfile, and gets everything set up. 2. Configure Your Frontend: Next, make sure your frontend app has the right environment variables set up. You’ll want to have things like
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, and
LIVEKIT_URL
all configured properly in your environment file. 3. Connect the Frontend to the Agent: Now, your frontend needs to connect to a LiveKit room where your agent is hanging out as an AI participant. You can use LiveKit components or APIs to make this happen. For example, if you’re using React, components like
LiveKitRoom
and hooks like
useVoiceAssistant
from
@livekit/components-react
are super handy. 4. Test the Integration: Finally, run your frontend and check that it connects smoothly to your cloud agent. Your agent should then chat with users just like you designed it to. If you want a hand with integrating your API route or handling interactions more specifically, just let me know a bit about your setup or share your code structure—I’m here to help! Sources: complex-agents/nutrition-assistant/nutrition-assistant-frontend/.env.exampl... | Agents Overview | LiveKit Docs | OpenAI and LiveKit partner to turn Advanced Voice into an API | Deploying to LiveKit Cloud | LiveKit Docs | AI Voice Assistant Quickstart | LiveKit Docs
g
How do i fix this deployment issue? PS C:\Users\3d3n2\ryznAI-v2\agent-starter-python> lk agent deploy WARNING: config file C:\Users\3d3n2/.livekit/cli-config.yaml should have permissions 600 WARNING: config file C:\Users\3d3n2/.livekit/cli-config.yaml should have permissions 600 Using project [rzn-ai-demo] Using agent [CA_j9aShTjUWjBP] Uploading 100% [==============================] (1.4 MB/s) Updated agent [CA_j9aShTjUWjBP] [+] Building 42.3s (15/15) FINISHED => [internal] load remote build context 0.1s => copy /context / 0.0s => resolve image config for docker-image://docker.io/docker/dockerfile:1 0.1s => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:38387523653efa0039f8e1c89bb74a30504e76ee9f565e25c9a09841f9 0.0s => => resolve docker.io/docker/dockerfile:1@sha256:38387523653efa0039f8e1c89bb74a30504e76ee9f565e25c9a09841f9427b05 0.0s => [internal] load metadata for ghcr.io/astral-sh/uv:python3.11-bookworm-slim 0.1s => [ 1/10] FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim@sha256:1c07cb9cae996d64f32093587506dc20e4ad952511c9f091caf 0.0s => => resolve ghcr.io/astral-sh/uv:python3.11-bookworm-slim@sha256:1c07cb9cae996d64f32093587506dc20e4ad952511c9f091caf37 0.0s => CACHED [ 4/10] WORKDIR /app 0.0s => CACHED [ 3/10] RUN apt-get update && apt-get install -y gcc g++ python3-dev && rm -rf /var/lib/apt/list 0.0s => CACHED [ 2/10] RUN adduser --disabled-password --gecos "" --home "/app" --shell "/sbin/nologin" - 0.0s => CACHED [ 5/10] COPY pyproject.toml uv.lock ./ 0.0s => CACHED [ 6/10] RUN mkdir -p src 0.0s => CACHED [ 7/10] RUN uv sync --locked 0.0s => [ 8/10] COPY . . 0.3s => [ 9/10] RUN chown -R appuser:appuser /app 31.4s => ERROR [10/10] RUN uv run src/agent.py download-files 0.9s ------ > [10/10] RUN uv run src/agent.py download-files: 0.200 Building agent-starter-python @ file:///app 0.864 Built agent-starter-python @ file:///app 0.866 Uninstalled 1 package in 0.49ms 0.867 Installed 1 package in 0.75ms 0.882 error: Failed to spawn:
src/agent.py
0.882 Caused by: No such file or directory (os error 2) ------ build failed for iad.ocir.io/axyci3pr8vxm/production-cloud-agents:p-3l8568mrvxk-ca-j9ashtjuwjbp-v20250822073838: failed to solve: process "/bin/sh -c uv run src/agent.py download-files" did not complete successfully: exit code: 2 PS C:\Users\3d3n2\ryznAI-v2\agent-starter-python>
t
It looks like you're seeing the error "Failed to spawn src/agent.py No such file or directory (os error 2)" because the deployment process can't find the agent entrypoint script. No worries—let's walk through some easy steps to fix this: 1. Double-check the File Path: Make sure your agent entrypoint file is actually at
src/agent.py
. If your main Python file has a different name (like
main.py
) or is in another folder, just update the path to match. 2. Update the Dockerfile: If your entrypoint isn't at
src/agent.py
, you'll want to change the
CMD
line in your Dockerfile to point to the right file. For example, if your entrypoint is
main.py
in the root directory, update the Dockerfile like this:
CMD ["uv", "run", "main.py", "start"]
3. Run the Deployment from the Correct Folder: Make sure you're running the deployment command inside the directory where your agent code and Dockerfile live. 4. Check Your Project Setup: Double-check that your project folder has all the necessary files, like
livekit.toml
and
Dockerfile
, before you deploy. Try these out, and hopefully, that clears things up! If you run into any other issues or have questions, just let me know—I'm here to help. Sources: Builds and Dockerfiles | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | cmd/lk/agent.go
g
I got this error: [10/10] RUN cd /app && uv run python -c "import sys; sys.path.append('/app'); from src.agent import download_files; import asyncio; asyncio.run(download_files())": 0.204 Building agent-starter-python @ file:///app 0.878 Built agent-starter-python @ file:///app 0.880 Uninstalled 1 package in 0.45ms 0.881 Installed 1 package in 0.60ms 0.891 Traceback (most recent call last): 0.891 File "<string>", line 1, in <module> 0.891 ModuleNotFoundError: No module named 'src.agent' ------ build failed for iad.ocir.io/axyci3pr8vxm/production-cloud-agents:p-3l8568mrvxk-ca-j9ashtjuwjbp-v20250822080011: failed to solve: process "/bin/sh -c cd /app && uv run python -c \"import sys; sys.path.append('/app'); from src.agent import download_files; import asyncio; asyncio.run(download_files())\"" did not complete successfully: exit code: 1 PS C:\Users\3d3n2\ryznAI-v2\agent-starter-python>
agent.py
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!