Repository navigation
Conversation
86d5c39 to
05dcc7a
Compare
|
Demo of the change: without a toml-agent-name-fixed.mp4 |
|
Follow-up to the demo: the missing-toml error now scans the project's Python/JS source for the literal name the agent registers under ( OutputFalls back to |
05dcc7a to
e1bf524
Compare
e1bf524 to
6e59c0e
Compare
|
Animated walkthrough of how this PR fits with protocol#1793, agents-private#446 and web#6131: dispatch-agent-name.mp4 |
`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.
6e59c0e to
1243e51
Compare
The run's agent_name is now [agent] name from livekit.toml, stable across runs so the dashboard can filter and group by agent; simulate refuses to spawn without it. The throwaway name a locally spawned worker registers under travels separately as dispatch_agent_name. With --agent-name, the live agent's name is dispatched to, and a livekit.toml in the working directory still supplies the identity when present.
1243e51 to
c958345
Compare
|
|
||
| // agentNameInSource matches the literal agent name an agent registers under: | ||
| // Python `agent_name="x"` and JS `agentName: "x"`. | ||
| var agentNameInSource = regexp.MustCompile(`(?:agent_name\s*=|agentName\s*:)\s*["'` + "`" + `]([^"'` + "`" + `]+)["'` + "`" + `]`) |
There was a problem hiding this comment.
Can we really move this to a file called "legacy" etc.
That's super hacky and should be temporary until we have v2
| ID string `toml:"id"` | ||
| // Identity of the agent under test in simulation runs; self-hosted agents | ||
| // set it by hand. | ||
| Name string `toml:"name"` |
Why
Simulation runs are filtered and grouped by
agent_namein the cloud dashboard, but whenlk agent simulatespawns the agent locally it sends the throwawaysimulation-<random>dispatch name in that field. Every run gets a unique name, so filtering by agent groups nothing. The random name itself is required: the local worker must not collide with the deployed agent's dispatch name.Depends on livekit/protocol#1793 (already pinned in go.mod at its branch SHA; re-pin once merged).
What
Commit 1:
[agent] namein livekit.toml.lk agent createandlk agent configwrite the agent's name next to its id. The prebuilt-image create path now callsCreateAgentdirectly because the SDK'sRegisterAgentwrapper drops the name from the response.Commit 2: simulate uses it.
agent_nameis[agent] namefrom livekit.toml, stable across runs.dispatch_agent_name; the spawned worker still registers under it viaLIVEKIT_AGENT_NAME_OVERRIDE.lk agent config; self-hosted users add:--agent-name(already-running agent), jobs dispatch to that name; a livekit.toml in the working directory still supplies the identity when present.Old runs keep their random names for their 30-day life.
Verification
go build ./cmd/lk,go vet ./cmd/lk,go test ./cmd/lkpass.