Why can't I create the agent?
# ask-ai
m
Why can't I create the agent?
t
Thanks for reaching out, Ezequiel. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like you're encountering the error "project does not match agent subdomain []". This usually happens when the project URL set in your environment doesn’t quite match the subdomain specified in your agent's configuration file (
livekit.toml
). Here’s a friendly step-by-step to help you resolve this: 1. First, double-check that your project URL follows the format
<PROTOCOL>://<SUBDOMAIN>.livekit.cloud
, and that the subdomain matches exactly with your project. 2. Take a look at the
livekit.toml
file in your project directory. Make sure the
[project]
section has the correct subdomain, like this:
Copy code
[project]
subdomain = "my-project"
3. Using the CLI, you can confirm the right project is selected by running
lk project list
to see your projects, and then
lk project set-default <project-name>
to pick the default one. 4. If things still seem off, try regenerating the configuration file with
lk agent config
or reinitialize your project using
lk agent init
. Also, if you’re seeing the error "yaml: line 2: could not find expected ':'", that usually points to a little syntax hiccup in your YAML file. Please take a moment to check that all keys and values are properly formatted with colons, like
key: value
. If you’d like, I’m here to help you through any of these steps—just let me know! Sources: pkg/config/config.go | Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWiki | CLI Tools & Token Management | livekit/livekit_composite | DeepWiki | complex-agents/nova-sonic/nova-sonic-form-agent/.env.example | Agent deployment CLI reference | LiveKit Docs
m
Why is it showing this error? app2$ lk agent list Using project [meu-primeiro-projeto] unable to list agents: Error from intermediary with HTTP status code 401 "Unauthorized"
t
I'm sorry you're encountering the error "unable to list agents: Error from intermediary with HTTP status code 401 Unauthorized." This usually points to an authentication hiccup when trying to list agents. Here are a few things to check: 1. Invalid API credentials: Please double-check that your
apiKey
and
secretKey
are accurate and properly set up. 2. Missing or expired access tokens: Make sure your access token is still valid and hasn't expired. 3. Insufficient permissions: Confirm that your token includes the necessary
RoomAdmin
permissions for the room you're working with. Taking a moment to review your authentication details usually helps clear this up. If you’d like, I’m here to help you step through it—just let me know! Sources: livekit/livekit_agent_dispatch.twirp.go | agent_dispatch_client.go | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | SIP troubleshooting guide | LiveKit Docs
m
How do I associate an agent with the sandbox?
t
I'd love to help you associate an agent with a sandbox in LiveKit! Here are a couple of friendly ways to do it: Method 1: Using the LiveKit CLI (Recommended) 1. Simply run this command to create an agent and link it to your sandbox:
lk app create --template agent-starter-node --sandbox <SANDBOX_ID>
2. This handy command will also set the
LIVEKIT_SANDBOX_ID
environment variable for you in your project, making things smoother. Method 2: Manual Configuration 1. You can manually add the
LIVEKIT_SANDBOX_ID
in your configuration file like this:
LIVEKIT_SANDBOX_ID=<your_sandbox_id>
2. Don't forget to also set other important environment variables such as
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
to keep everything running perfectly. Once you've got this set up, your agent will connect seamlessly to any rooms created within the sandbox. If you have any questions or need a hand with anything else, just let me know—I'm here to help! Sources: Sandbox | LiveKit docs | cmd/lk/agent.go | README.md | README.md | README.md