Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bc77171
Add agent session store protocols
theomonnom Jul 27, 2026
c4cdd6a
generated protobuf
github-actions[bot] Jul 27, 2026
1aeca88
Drop rpc comments that only restate the method name
theomonnom Jul 27, 2026
bd60d2b
Add AgentGrant.SessionAdmin
theomonnom Jul 28, 2026
376b8e6
Column-oriented session results, and drop tip from ListSessions
theomonnom Jul 28, 2026
6010a1e
generated protobuf
github-actions[bot] Jul 28, 2026
2b4b7a6
Rename AgentGrant.SessionAdmin to SessionStoreAdmin
theomonnom Jul 28, 2026
bb404b7
Trim comments on the session store protos
theomonnom Jul 28, 2026
e2795ae
generated protobuf
github-actions[bot] Jul 28, 2026
17bed51
agent session store: document unset ttl_seconds as no expiry
Jul 29, 2026
cd0d79b
agentdb: own namespace, and the unit is a database
Aug 4, 2026
218e366
generated protobuf
github-actions[bot] Aug 4, 2026
425485e
agentdb: nest the messages instead of a separate package
Aug 5, 2026
9fd858b
generated protobuf
github-actions[bot] Aug 5, 2026
9fd8348
agentdb: trim comments, drop the Cypher enum value
Aug 5, 2026
dfa0dac
Merge remote-tracking branch 'origin/main' into theo/agent-session-pr…
Aug 5, 2026
d418aad
agentdb: group the data plane under AgentDB.Wire
Aug 5, 2026
219d0f8
generated protobuf
github-actions[bot] Aug 5, 2026
f88d8e1
agentdb: field names follow the repo convention
Aug 5, 2026
81313f4
agentdb: drop user_attributes
Aug 5, 2026
d5c573f
generated protobuf
github-actions[bot] Aug 5, 2026
0a1275d
agentdb: consistent RPC and enum naming
Aug 5, 2026
d3e24c6
agentdb: one Database message, following Room
Aug 5, 2026
ae8092f
generated protobuf
github-actions[bot] Aug 5, 2026
2ea22ee
agentdb: the entity message is AgentDatabase
Aug 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,610 changes: 1,610 additions & 0 deletions livekit/livekit_agent_session_db.pb.go

Large diffs are not rendered by default.

683 changes: 683 additions & 0 deletions livekit/livekit_agent_session_store.pb.go

Large diffs are not rendered by default.

1,682 changes: 1,682 additions & 0 deletions livekit/livekit_agent_session_store.twirp.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions livekit/livekit_agent_simulation.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_cloud_agent.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_connector.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_egress.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_ingress.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_phone_number.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_room.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions livekit/livekit_sip.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func Proto() error {
twirpProtoFiles := []string{
"cloud_replay.proto",
"livekit_agent_dispatch.proto",
"livekit_agent_session_store.proto",
"livekit_egress.proto",
"livekit_ingress.proto",
"livekit_room.proto",
Expand All @@ -66,6 +67,7 @@ func Proto() error {

protoFiles := []string{
"livekit_agent.proto",
"livekit_agent_session_db.proto",
"livekit_analytics.proto",
"livekit_internal.proto",
"livekit_models.proto",
Expand Down
145 changes: 145 additions & 0 deletions protobufs/livekit_agent_session_db.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Copyright 2026 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package livekit;

option go_package = "github.com/livekit/protocol/livekit";
option csharp_namespace = "LiveKit.Proto";
option ruby_package = "LiveKit::Proto";

// Data plane for AgentSessionStore session databases: a SQL(+openCypher)
// protocol carried over a WebSocket. One binary-protobuf message per WS
// frame; requests and responses correlate by request_id (monotonic per
// connection, chosen by the client). One WebSocket = one session connection.
//
// Flow control: query results stream as SessionRowBatch frames paced by
// per-request credits (SessionCredit) the client advertises; the server
// never sends more un-consumed batches than granted, so any result size
// streams with bounded memory at every hop.

message SessionStoreRequest {
uint32 request_id = 1;
oneof message {
SessionHello hello = 2; // must be first on the socket
SessionStatement exec = 3; // no result rows; answers SessionExecResult
SessionStatement query = 4; // answers SessionColumns + SessionRowBatch* + SessionDone
SessionBatch batch = 5; // atomic multi-statement exec
SessionBegin begin = 6; // interactive transaction (server enforces idle/duration timeouts)
SessionCommit commit = 7;
SessionRollback rollback = 8;
SessionCancel cancel = 9; // stop a running query's stream/cursor
SessionCredit credit = 10; // grant more RowBatch credits for request_id
SessionPing ping = 11;
}
}

message SessionStoreResponse {
uint32 request_id = 1;
oneof message {
SessionHelloOk hello_ok = 2;
SessionColumns columns = 3;
SessionRowBatch row_batch = 4;
SessionExecResult exec_result = 5;
SessionDone done = 6;
SessionStoreError error = 7;
SessionPong pong = 8;
}
}

// SessionQueryLang selects the query language of a statement; both execute
// against the same session database.
enum SessionQueryLang {
SESSION_QUERY_LANG_SQL = 0;
SESSION_QUERY_LANG_CYPHER = 1;
}

// SessionValue mirrors SQLite's five storage classes exactly.
message SessionValue {
oneof value {
bool null_value = 1; // always true when set
int64 int_value = 2;
double double_value = 3;
string text_value = 4;
bytes blob_value = 5;
}
}

message SessionStatement {
string sql = 1; // statement text in the selected lang
repeated SessionValue params = 2; // positional bind parameters
SessionQueryLang lang = 3;
}

message SessionBatch {
repeated SessionStatement statements = 1; // applied atomically, in order
}

message SessionBegin {}
message SessionCommit {}
message SessionRollback {}
message SessionCancel {}

message SessionCredit {
uint32 batches = 1; // additional RowBatch frames the client can absorb
}

message SessionPing {
int64 timestamp = 1;
}

message SessionPong {
int64 last_ping_timestamp = 1;
int64 timestamp = 2;
}

message SessionHello {
string token = 1; // access token; authorization is checked here
string session_id = 2;
}

message SessionHelloOk {
int64 tip = 1; // latest durable commit sequence
uint32 ping_interval_ms = 2; // server-advertised keepalive cadence
uint32 ping_timeout_ms = 3;
}

message SessionColumns {
repeated string names = 1;
}

message SessionRow {
repeated SessionValue values = 1;
}

message SessionRowBatch {
repeated SessionRow rows = 1;
}

message SessionExecResult {
int64 rows_affected = 1;
int64 last_insert_id = 2;
int64 tip = 3; // durable commit sequence after this exec
}

message SessionDone {
int64 tip = 1; // snapshot the query ran at
uint64 total_rows = 2;
}

message SessionStoreError {
string code = 1; // stable machine-readable code
string message = 2;
}
90 changes: 90 additions & 0 deletions protobufs/livekit_agent_session_store.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Copyright 2026 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package livekit;

option go_package = "github.com/livekit/protocol/livekit";
option csharp_namespace = "LiveKit.Proto";
option ruby_package = "LiveKit::Proto";

// AgentSessionStore is the MANAGEMENT plane for per-session SQLite databases:
// lifecycle and export only. All querying goes through the data plane (a
// WebSocket speaking SessionStoreRequest/SessionStoreResponse, defined in
// livekit_agent_session_db.proto). project_id is taken from the authenticated
// principal (access key) on every call, never a request field.
service AgentSessionStore {
rpc CreateSession(CreateSessionRequest) returns (CreateSessionResponse);
rpc GetSession(GetSessionRequest) returns (GetSessionResponse);
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse);

// Deletes the stored data too, not just the metadata row.
rpc DeleteSession(DeleteSessionRequest) returns (DeleteSessionResponse);

// Exports a consistent full SQLite database file and returns a time-limited
// download URL (object-storage pre-authenticated request). Runs off the
// serving path; never blocks the session's writes.
rpc Dump(DumpSessionRequest) returns (DumpSessionResponse);
}

message CreateSessionRequest {
string region = 1;
string user_attributes = 2; // opaque JSON metadata for the caller
int64 ttl_seconds = 3; // per-session TTL, clamped to a hard max; never extended
}

message CreateSessionResponse {
string session_id = 1; // "SESS_..."
int64 expires_at_unix = 2;
}

message GetSessionRequest {
string session_id = 1;
}

message GetSessionResponse {
string session_id = 1;
string region = 2;
string user_attributes = 3;
int64 created_at_unix = 4;
int64 expires_at_unix = 5;
int64 tip = 6; // latest durable commit sequence
}

message ListSessionsRequest {
int32 page_size = 1; // server-clamped
string page_token = 2; // opaque cursor from a previous response
}

message ListSessionsResponse {
repeated GetSessionResponse sessions = 1;
string next_page_token = 2; // empty when exhausted
}

message DeleteSessionRequest {
string session_id = 1;
}

message DeleteSessionResponse {}

message DumpSessionRequest {
string session_id = 1;
}

message DumpSessionResponse {
string download_url = 1; // pre-authenticated object-storage URL
int64 expires_at_unix = 2; // URL expiry
int64 tip = 3; // commit sequence the dump is consistent at
}
Loading