How do I update my agent after fixing a few lines ...
# ask-ai
b
How do I update my agent after fixing a few lines of code?? i dont get the difference between lk agent update and lk agent update-secrets
t
Thanks for reaching out, YJ. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! I’d love to help clarify the difference between the commands
lk agent update
and
lk agent update-secrets
. Both are used to modify the configuration of a LiveKit Cloud Agent and will restart the agent after making changes, but they each have their own special focus: •
lk agent update
: Think of this as your all-in-one update command. It lets you change both metadata and secrets for an agent. You can update secrets using the
--secrets
or
--secrets-file
flags, and once done, it restarts the agent workers to apply the changes. •
lk agent update-secrets
: This one is designed just for updating the secrets of an agent. It comes with an
--overwrite
flag if you want to replace all existing secrets with a fresh set. Like the other command, it also restarts the agent after updating. So, if your goal is simply to update secrets,
lk agent update-secrets
is a great, focused choice. But if you need to update a wider range of settings, including metadata, then
lk agent update
is the way to go. Sources: cmd/lk/agent.go | Agent deployment CLI reference | LiveKit Docs | Secrets management | LiveKit Docs
b
Okay so how do I update my agent with updated code base?
t
To help you update your agent with the latest codebase, here’s a simple step-by-step guide: 1. Prepare Your Code: Make sure your updated codebase is all set in your local project directory, and don’t forget to include the
livekit.toml
configuration file there. 2. Deploy the Updated Code: In your project directory, just run this command: `lk agent deploy`This will package your code, upload it to LiveKit Cloud, build a new version, and deploy it seamlessly. 3. Graceful Update: The best part is that during deployment, your current sessions won’t be interrupted. Old instances will finish their work gracefully while the new ones take over incoming sessions. 4. Optional Secrets: If you need to add any secrets, simply include them like this:
lk agent deploy --secrets KEY1=VALUE1 --secrets KEY2=VALUE2
5. Verify Deployment: After deploying, you can check how things are going with:
lk agent status
6. Rollback (if needed): And if you ever run into any issues, don’t worry—you can roll back to a previous version easily:
lk agent rollback --version <version-number>
This way, your update happens smoothly without any service disruption. If you have any questions or need a hand with any step, just let me know—I’m here to help! Sources: cmd/lk/agent.go | Deploy and scale agents on LiveKit Cloud