Skip to content

agent: move the agent id to a [cloud] block in livekit.toml - #978

Open
u9g wants to merge 5 commits into
mainfrom
jason/toml-cloud-regions
Open

u9g wants to merge 5 commits into
mainfrom
jason/toml-cloud-regions

Conversation

@u9g

@u9g u9g commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Why

livekit.toml should say which agent it is and where that agent runs on LiveKit Cloud, as separate things. Right now the Cloud Agents id sits under [agent], and the agent's name isn't recorded anywhere. Proposal: https://app.notion.com/p/livekit/Proposal-livekit-toml-layout-for-agent-name-and-regions-3d83c4901a4281beb3b9f1f3e74de44d

What

lk agent create and lk agent config now write the agent's Cloud-assigned name to [agent] name and its id to a new [cloud] block:

[project]
subdomain = "my-project"

[agent]
name = "my-agent"

[cloud]
id = "CA_xxxxxxxxxxxx"

Older files that still have [agent] id keep working. The id is read into [cloud] on load and saved there the next time the file is written. A self-hosted agent can have [agent] name with no [cloud] block at all.

The prebuilt-image create path now calls CreateAgent directly, because the SDK's RegisterAgent wrapper drops the name from the response.

This PR supports one agent per file only; per-region [cloud.<region>] tables are out of scope. No server or protocol changes.

Verification

go build ./..., go vet ./cmd/lk ./pkg/config, and go test ./pkg/config ./cmd/lk pass. The new pkg/config/livekit_test.go covers moving a legacy id into [cloud], loading [cloud] id, and the exact saved layout.

@u9g

u9g commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Demo against the agent-test-arena project: a legacy [agent] id still resolves, lk agent config rewrites the file with [cloud] id, and with two [cloud.<region>] tables deploy --region rejects an unlisted region, --yes runs ask for --id, and interactive runs prompt for the region.

cloud-regions.mp4

u9g added 4 commits September 23, 2026 09:53
`lk agent create` and `lk agent config` write [agent] name alongside id.
The prebuilt-image create path calls CreateAgent directly since the SDK's
RegisterAgent wrapper drops the name from the response.
[agent] id becomes [cloud] id, or one [cloud.<region>] id per region for
agents deployed to several regions. A legacy [agent] id is still read and
migrates to [cloud] on the next save.
lk agent create and lk agent config record the new agent under [cloud] id.
Creating with --region into a file that already has an agent adds a
[cloud.<region>] entry instead of replacing it. lk agent deploy deploys
every region the file lists, or the one passed with --region; the other
agent commands prompt for a region when the file lists several.
@u9g
u9g force-pushed the jason/toml-cloud-regions branch from df44e3e to ebb16ad Compare September 23, 2026 13:57
@u9g u9g changed the title agent: [cloud] id block and multi-region livekit.toml agent: move the agent id to a [cloud] block in livekit.toml Sep 23, 2026
@u9g
u9g changed the base branch from jason/toml-agent-name to main September 23, 2026 13:57
livekit.toml holds a single [cloud] id. `lk agent create --region` replaces
the agent instead of adding a region entry, `lk agent deploy` deploys the
one agent, and the other agent commands no longer prompt for a region.
@u9g
u9g force-pushed the jason/toml-cloud-regions branch from ebb16ad to b5e1e6b Compare September 23, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant