Repository navigation
feat(agent): lk agent versions, secrets, dockerfile and build logs through the Public API when signed in - #1139
Open
Topherhindman wants to merge 3 commits into
Conversation
This was referenced Nov 24, 2026
Open
Topherhindman
force-pushed
the
topherhindman/agent-user-auth-reads
branch
from
December 1, 2026 00:22
8782ea1 to
7ef243e
Compare
Topherhindman
force-pushed
the
topherhindman/agent-user-auth-reads
branch
from
December 1, 2026 04:55
7ef243e to
5b95c2a
Compare
The Public API client reads the rest of what lk's agent commands read from AgentService: an agent's versions, the names of its secrets, the build log of a version, and the project's client settings. Each returns LiveKit's own message (livekit.AgentVersion, livekit.AgentSecret, livekit.ClientSettingsResponse), as ListAgents and GetAgent do, so the commands print what they print with an API key. A build log comes back with whether the API cut it to its end.
…h the Public API Under --user-auth, these commands now call the Public API's AgentService in place of the token bridge, so a member below admin can run the reads that their role allows: - lk agent versions: ListAgentVersions, for a READ member. - lk agent secrets: ListAgentSecrets, which still needs a project admin. The refusal now comes from AgentService and names the role. - lk agent dockerfile, and the settings read in create, deploy and private-link create: GetAgentClientSettings, for a READ member. - lk agent logs --log-type build: GetAgentBuildLog, for a READ member. lk has no --version flag, so it reads the build log of the version that the deployment runs, as cloud agents does when lk names none: it finds that version in GetAgent. It needs no deployment region, so it skips the check for one. When the API cut the log, lk says so. A runtime log (--log-type deploy) stays on the bridge, which needs a project admin. Output matches the API-key path: lk puts back the zero deploy time that the Public API leaves out of a version never deployed.
public.Agent's Info is Cloud since the Public API moved it (livekit/public-api-server#240), so the build log finds the version that the deployment runs in Cloud. The reads script's GetAgent answers in the new shape.
Topherhindman
force-pushed
the
topherhindman/agent-user-auth-reads
branch
from
December 3, 2026 00:18
5b95c2a to
8abe4c5
Compare
Topherhindman
marked this pull request as ready for review
December 3, 2026 00:57
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under
--user-auth, the agent reads that #1138 left on the token bridge now go through the Public API'sAgentService:lk agent versions,lk agent secrets,lk agent dockerfile(and the client settings thatcreate,deployandprivate-link createread), andlk agent logs --log-type build. The bridge needs theAgent.Admingrant, so before this only a project admin could run them. Now a READ member can run every one of them exceptsecrets, which the Public API still keeps to admins.Stacked on #1138.
Commands
--user-authagent versionsListAgentVersionsagent secretsListAgentSecrets(names only)agent dockerfile, and the settings read ofcreate,deploy,private-link createGetAgentClientSettingsagent logs --log-type buildGetAgentfor the version, thenGetAgentBuildLogagent logs(runtime, the default)create,deploy,update,update-secrets,restart,rollback,promote,delete,private-link *What's in it
feat(public):ListAgentVersions,ListAgentSecrets,GetAgentBuildLogandGetAgentClientSettings. Each returns LiveKit's own message, decoded with protojson, asListAgentsdoes.feat(agent):userAuthAgentAPIcalls them.agentServiceErrorwords a refusal for a role that is too low as "this command needs a project admin (…)", not "your account doesn't have access to this project".fix(agent): the build log reads the agent'scloud, which replacedinfoin livekit/public-api-server#240.Decisions
--versionflag onlogs. With an API key, cloud agents streams the build log of the version that the deployment runs. Under--user-auth, lk finds that version inGetAgentby the same rule (the deployment's first region with a version, else, for production, the agent's version), then reads that version's log.--user-authlogs --log-type buildskips the "no agent deployments found" check that the runtime stream needs.--and--jsonmatches.Output differences vs the API-key path
logs --log-type buildon a build in progress streams it; under--user-authit says "build log not found".createanddeploystill stream their builds through the bridge.--user-auth, cloud agents' "failed to get logs: no version deployed to deployment - map[…]" with an API key.secretslists in name order under--user-auth(the Public API sorts), in cloud agents' order with an API key.Open questions
lk agent logs --log-type buildget a--versionflag? The Public API takes any version.Blockers
pkg/publicgenerated from livekit/public-api-server@372fb27e (production v2026-12-02-2258).Testing
GOPRIVATE= go build ./...,go vet ./cmd/lk/... ./pkg/...,go test ./cmd/lk/... ./pkg/...andgolangci-lint run ./cmd/lk/... ./pkg/public/...pass.agent-version-secret-log-reads-with-user-auth:versions(table and--json),secrets(table and--json),dockerfile(both files) andlogs --log-type build(production and--deployment staging) print the same in both modes against the same data. It also checks the truncation note, "build log not found", a deployment with no version, and that a runtime log still gets the bridge's admin refusal. The fake Public API refuses every token request, and the request log shows lk made none for the reads.agent-commands-with-user-authandagent-commands-need-admin-with-user-authnow expectsecretsthroughAgentService, and its refusal naming the role.deployedVersionandagentServiceError.Demo
Recorded on staging, not uploaded yet:
~/hosted-agents-work/demos/M2/m2-agent-reads.mp4(write-up~/hosted-agents-work/demos/M2/README.md). Local Public API from this stack against staging cloud-agents (staging database read-only); lk from #1140. A WRITE member runslk agent versions,dockerfileandlogs --log-type build; secret names are refused for WRITE and shown for ADMIN.Depends on #1136 (the hints name
lk agent builder).