I have multiple agent, should I setup more than on...
# ask-ai
c
I have multiple agent, should I setup more than one livekit.toml?
t
Thanks for reaching out, Meng. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just a quick tip to help you get things running smoothly: each agent should have its very own
livekit.toml
file. This file holds all the important agent-specific settings, like a unique agent ID, and it’s what the LiveKit CLI uses to know exactly which agent you’re working with. To make this easy to manage, try organizing your agents into separate folders, with each one having its own
livekit.toml
file. Here’s a simple example:
Copy code
project/
├── agent-1/
│   ├── livekit.toml  # Contains agent-1's ID and config
│   └── main.py
├── agent-2/
│   ├── livekit.toml  # Contains agent-2's ID and config
│   └── main.py
Doing it this way keeps everything nicely separated and fits perfectly with how LiveKit expects things to be set up. If you need any more help or have questions, I’m here for you! Sources: CLI Tools & Token Management | livekit/livekit_composite | DeepWiki | Deploying to production | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | cmd/lk/agent.go
c
can you show me the steps to do so?
t
I'd be happy to guide you through creating separate
livekit.toml
files for multiple agents. Here’s a simple way to do it: 1. First, create separate directories for each agent:
Copy code
mkdir agent1
mkdir agent2
mkdir agent3
2. Next, generate configuration files for your existing agents:
Copy code
# For agent1
cd agent1
lk agent config --id AGENT_ID_1

# For agent2
cd ../agent2
lk agent config --id AGENT_ID_2

# For agent3
cd ../agent3
lk agent config --id AGENT_ID_3
3. If you prefer, you can also create new agents like this:
Copy code
# Create first agent
mkdir agent1 && cd agent1
lk agent create

# Create second agent
cd .. && mkdir agent2 && cd agent2
lk agent create
Each time you run
lk agent create
or
lk agent config
, it will generate a unique
livekit.toml
file for that agent. Just make sure each directory holds the agent’s source code along with its configuration file. This way, everything stays nicely organized and easy to manage. Sources: CLI Tools & Token Management | livekit/livekit_composite | DeepWiki | Agent deployment CLI reference | LiveKit Docs | cmd/lk/agent.go | Deploying to production | LiveKit Docs
c
does
AGENT_ID_1
randomly generated by livekit?
t
Absolutely! The
AGENT_ID
is automatically generated by LiveKit when you create an agent. So, when you run
lk agent create
, LiveKit Cloud takes care of assigning a unique ID to your agent and saves it in the
livekit.toml
file for you. The ID follows the format
AG_xxxxxxxxxxxxx
, which helps ensure that every agent has its own unique identifier. If you have any more questions about this, feel free to ask—I’m here to help! Sources: Deploying to production | LiveKit Docs | cmd/lk/agent.go | CLI Tools & Token Management | livekit/livekit_composite | DeepWiki
c
if I want to deploy agent-1, should I navigate to agent1 folder, then
lk agent deploy
?
t
I'm happy to guide you through deploying
agent-1
! You have two friendly options: 1. First, you can navigate to the agent folder: `cd agent1 lk agent deploy`This way, the deployment uses the
livekit.toml
file right there in your current directory. 2. Or, you can specify the agent folder directly without changing directories: `lk agent deploy /path/to/agent1`This is super handy if you want to keep your current location in the terminal. Both methods work perfectly, so feel free to pick whichever feels more comfortable for you. If you have any questions along the way, I’m here to help! Sources: Deploying to production | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | CLI Tools & Token Management | livekit/livekit_composite | DeepWiki | README.md
c
show me a folder hireachy of a repo which contains two agent
t
I'd love to share an example folder hierarchy that might help you organize a repository with two agents:
Copy code
project-root/
├── agent-1/
│   ├── livekit.toml  # Configuration for agent-1
│   ├── main.py       # Source code for agent-1
│   └── Dockerfile    # Optional Dockerfile for agent-1
├── agent-2/
│   ├── livekit.toml  # Configuration for agent-2
│   ├── main.py       # Source code for agent-2
│   └── Dockerfile    # Optional Dockerfile for agent-2
└── shared-resources/ # Optional shared resources for both agents
This setup is great because it keeps each agent’s configuration and code nicely separated, while still giving you the option to share resources if that’s something you need. If you have any questions or want to explore this further, I’m here to help! Sources: Python Agents Core Architecture | livekit/livekit_composite | DeepWiki
c
I created an empty folder, navigate to it, but cannot setup the agent due to below error - unable to determine project type: project type could not be identified; expected package.json, requirements.txt, pyproject.toml, or lock files, please use a supported project type, or create your own Dockerfile in the current directory
t
It looks like the error is happening because the folder is empty, and the LiveKit CLI can’t quite detect the project type. No worries though! Here are a few friendly options to help you get back on track: 1. Use
lk agent init
(Highly Recommended):
`lk agent init [AGENT-NAME] --lang python`This command will gently set up a new project for you, including all the necessary files and configurations. 2. Create project files manually: ◦ If you’re working with Python: simply add a
requirements.txt
or
pyproject.toml
file. ◦ If you prefer Node.js: add a
package.json
and run
npm install
to get things ready. 1. Create a custom Dockerfile: You can also add a
Dockerfile
to the folder if you want a custom build process tailored to your needs. Honestly, using the
lk agent init
command is the smoothest way to start, as it takes care of the setup automatically for you. If you have any questions or need a hand, I’m here to help! Sources: cmd/lk/agent.go | CLI Tools & Token Management | livekit/livekit_composite | DeepWiki | Agent deployment CLI reference | LiveKit Docs