Skip to content

Add the agent HTTP endpoints data plane protocol - #1728

Open
theomonnom wants to merge 9 commits into
mainfrom
theo/agent-http-endpoints
Open

theomonnom wants to merge 9 commits into
mainfrom
theo/agent-http-endpoints

Conversation

@theomonnom

@theomonnom theomonnom commented Aug 20, 2026

Copy link
Copy Markdown
Member

Protocol for the agent HTTP endpoints data plane. The worker connection is WebTransport (QUIC): one session per worker, a control stream carrying the existing WorkerMessage/ServerMessage exchange, and one QUIC stream per HTTP exchange (QUIC provides multiplexing, per-stream flow control, half-close, and reset natively, so there is no capsule/credit layer).

  • AgentHttp namespace in livekit_agent.proto: endpoint manifest (AgentEndpoint: path template, methods, public), kind enum, AgentEndpointSettings, and GoAway.
  • RegisterWorkerRequest: endpoints manifest, instance_id (epoch fencing), endpoint_protocol. Response carries negotiated endpoint_settings.
  • UpdateWorkerStatus: draining + seq; ServerMessage.go_away for control-connection drain.
  • ValidateAgentName + ValidateDeployment tightened to a URL-safe charset (both are URL path segments).

Based on the livekit-server go.mod pin; rebases forward with it.

@changeset-bot

changeset-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: da93cf9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Patch
@livekit/protocol Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

AgentHttp namespace in livekit_agent.proto: worker-dialed wires speak
AgentHttp.Frame (attach handshake, opaque HTTP/1.1 data bytes, eof/reset,
two-level credit), manifest + instance_id + endpoint_protocol in
RegisterWorkerRequest, negotiated endpoint_settings in the response,
draining/seq in UpdateWorkerStatus, GoAway. ValidateDeployment tightened to
a URL-safe charset.
theomonnom and others added 4 commits August 22, 2026 12:19
Replace the capsule/attach data-plane messages with the WebTransport model:
one QUIC session per worker carrying a control stream plus one stream per HTTP
exchange. Add ValidateAgentName so an agent name is usable as a single URL path
segment.
@theomonnom
theomonnom marked this pull request as ready for review August 31, 2026 04:27
paulwe and others added 4 commits September 13, 2026 15:22
Replace the L7 HTTP framing messages with a StreamPreamble that opens each
exchange stream, after which the stream carries an opaque HTTP/1.1 exchange.
The preamble holds only what a worker cannot derive from the HTTP bytes and
must not infer from them: kind, request_id, authenticated, route, timeout_ms,
client_addr, scheme.

Drop HttpRequestHeaders, HttpResponseHeaders, HttpTrailers, HttpHeader and
HttpCompletion. A body now ends by its own HTTP framing; a failure after bytes
have flowed is reported in x-lk-completion / x-lk-error trailers, and a failure
before any byte resets the stream with an HttpStreamResetCode.

HttpStreamResetCode is renumbered: HSR_ABORT takes 0 so that a teardown with
nothing to say cannot read as a claim that the request was never applied.
Add AgentEndpointGrant, carrying Call plus an optional AgentName and
Deployment. Allows() matches a request's agent and deployment exactly and
case-sensitively; an empty scope field matches any value, so a project-wide
token is the default and a narrower one is expressible without minting a
second key.

The grant is a sibling of the existing top-level grants rather than a field on
VideoGrant: VideoGrant.Agent authorizes registering a worker on the control
plane, and a caller of an agent's HTTP endpoints needs no such rights.

Rename StreamPreamble.authenticated to authorized, keeping field 3. It
previously meant "presented a valid project token", which every participant
token satisfies; it now means the caller holds call permission for the agent
and deployment in the URL.
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.

2 participants