Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
davidzhao committed Sep 16, 2023
1 parent 60ffcad commit 1e04790
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
3 changes: 3 additions & 0 deletions auth/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type VideoGrant struct {
Hidden bool `json:"hidden,omitempty"`
// indicates to the room that current participant is a recorder
Recorder bool `json:"recorder,omitempty"`
// indicates that the holder can register as an Agent framework worker
// it is also set on all participants that are joining as Agent
Agent bool `json:"agent,omitempty"`
}

type ClaimGrants struct {
Expand Down
114 changes: 114 additions & 0 deletions livekit_agent.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright 2023 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";

import "google/protobuf/timestamp.proto";
import "livekit_models.proto";

message AgentInfo {
string id = 1;
string name = 2;
string version = 3;
}

message Job {
string id = 1;
JobType type = 2;
Room room = 3;
optional ParticipantInfo participant = 4;
}

// from Worker to Server
message WorkerMessage {
oneof message {
// agent workers need to register themselves with the server first
RegisterWorkerRequest register = 1;
// worker confirms to server that it's available for a job, or declines it
AvailabilityResponse availability = 2;
// worker can update its status to the server, including taking itself out of the pool
UpdateWorkerStatus status = 3;
JobStatusUpdate job_update = 4;
};
}

// from Server to Worker
message ServerMessage {
oneof message {
// server confirms the registration, from this moment on, the worker is considered active
RegisterWorkerResponse register = 1;
// server asks worker to confirm availability for a job
AvailabilityRequest availability = 2;
JobAssignment assignment = 3;
}
}

enum JobType {
JT_ROOM = 0;
JT_PARTICIPANT = 1;
}

enum WorkerStatus {
WS_AVAILABLE = 0;
WS_FULL = 1;
}

enum JobStatus {
JS_UNKNOWN = 0;
JS_SUCCESS = 1;
JS_FAILED = 2;
}

message RegisterWorkerRequest {
JobType type = 1;
// name of pool for the worker. each job is given to a single worker in each pool
string pool = 2;
string worker_id = 3;
string version = 4;
string name = 5;
}

message RegisterWorkerResponse {
string worker_id = 1;
string server_version = 2;
}

message AvailabilityRequest {
Job job = 1;
}

message AvailabilityResponse {
string job_id = 1;
bool available = 2;
}

message JobStatusUpdate {
string job_id = 1;
JobStatus status = 2;
string error = 3;
string user_data = 4;
}

message JobAssignment {
Job job = 1;
}

message UpdateWorkerStatus {
WorkerStatus status = 1;
}

0 comments on commit 1e04790

Please sign in to comment.