github.com/livekit/protocol@v1.39.3/protobufs/livekit_agent.proto (about)

     1  // Copyright 2023 LiveKit, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //   http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package livekit;
    18  option go_package = "github.com/livekit/protocol/livekit";
    19  option csharp_namespace = "LiveKit.Proto";
    20  option ruby_package = "LiveKit::Proto";
    21  
    22  import "livekit_models.proto";
    23  
    24  message Job {
    25    string id = 1;
    26    string dispatch_id = 9;
    27    JobType type = 2;
    28    Room room = 3;
    29    optional ParticipantInfo participant = 4;
    30    string namespace = 5 [deprecated = true];
    31    string metadata = 6;
    32    string agent_name = 7;
    33    JobState state = 8;
    34  }
    35  
    36  message JobState {
    37    JobStatus status = 1;
    38    string error = 2;
    39    int64 started_at = 3;
    40    int64 ended_at = 4;
    41    int64 updated_at = 5;
    42    string participant_identity = 6;
    43    string worker_id = 7;
    44  }
    45  
    46  // from Worker to Server
    47  message WorkerMessage {
    48    oneof message {
    49      // agent workers need to register themselves with the server first
    50      RegisterWorkerRequest register = 1;
    51      // worker confirms to server that it's available for a job, or declines it
    52      AvailabilityResponse availability = 2;
    53  
    54      // worker can update its status to the server, including taking itself out of the pool
    55      UpdateWorkerStatus update_worker = 3;
    56      // job can send status updates to the server, useful for tracking progress
    57      UpdateJobStatus update_job = 4;
    58  
    59      WorkerPing ping = 5;
    60      SimulateJobRequest simulate_job = 6;
    61      MigrateJobRequest migrate_job = 7;
    62    };
    63  }
    64  
    65  // from Server to Worker
    66  message ServerMessage {
    67    oneof message {
    68      // server confirms the registration, from this moment on, the worker is considered active
    69      RegisterWorkerResponse register = 1;
    70      // server asks worker to confirm availability for a job
    71      AvailabilityRequest availability = 2;
    72      JobAssignment assignment = 3;
    73      JobTermination termination = 5;
    74      WorkerPong pong = 4;
    75    }
    76  }
    77  
    78  enum JobType {
    79    JT_ROOM = 0;
    80    JT_PUBLISHER = 1;
    81    JT_PARTICIPANT = 2;
    82  }
    83  
    84  enum WorkerStatus {
    85    WS_AVAILABLE = 0;
    86    WS_FULL = 1;
    87  }
    88  
    89  enum JobStatus {
    90    JS_PENDING = 0;
    91    JS_RUNNING = 1;
    92    JS_SUCCESS = 2;
    93    JS_FAILED = 3;
    94  }
    95  
    96  message SimulateJobRequest {
    97    JobType type = 1;
    98    Room room = 2;
    99    ParticipantInfo participant = 3;
   100  }
   101  
   102  message WorkerPing {
   103    int64 timestamp = 1;
   104  }
   105  
   106  message WorkerPong {
   107    int64 last_timestamp = 1;
   108    int64 timestamp = 2;
   109  }
   110  
   111  message RegisterWorkerRequest {
   112    JobType type = 1;
   113    string agent_name = 8;
   114    // string worker_id = 2;
   115    string version = 3;
   116    // string name = 4 [deprecated = true];
   117    uint32 ping_interval = 5;
   118    optional string namespace = 6;
   119    ParticipantPermission allowed_permissions = 7;
   120  }
   121  
   122  message RegisterWorkerResponse {
   123    string worker_id = 1;
   124    ServerInfo server_info = 3;
   125  }
   126  
   127  message MigrateJobRequest {
   128    // string job_id = 1 [deprecated = true];
   129    repeated string job_ids = 2;
   130  }
   131  
   132  message AvailabilityRequest {
   133    Job job = 1;
   134  
   135    // True when the job was previously assigned to another worker but has been
   136    // migrated due to different reasons (e.g. worker failure, job migration)
   137    bool resuming = 2;
   138  }
   139  
   140  message AvailabilityResponse {
   141    string job_id = 1;
   142    bool available = 2;
   143    bool supports_resume = 3;
   144    bool terminate = 8;
   145  
   146    string participant_name = 4;
   147    string participant_identity = 5;
   148    string participant_metadata = 6;
   149    map<string, string> participant_attributes = 7;
   150    // NEXT_ID: 9
   151  }
   152  
   153  message UpdateJobStatus {
   154    string job_id = 1;
   155  
   156    // The worker can indicate the job end by either specifying SUCCESS or FAILED
   157    JobStatus status = 2;
   158  
   159    // metadata shown on the dashboard, useful for debugging
   160    string error = 3;
   161  
   162    // the metadata can be updated multiple times
   163    // optional string metadata = 4 [deprecated=true];
   164  }
   165  
   166  message UpdateWorkerStatus {
   167    optional WorkerStatus status = 1;
   168    // optional string metadata = 2 [deprecated=true];
   169    float load = 3;
   170    uint32 job_count = 4;
   171  }
   172  
   173  message JobAssignment {
   174    Job job = 1;
   175    optional string url = 2;
   176    string token = 3;
   177  }
   178  
   179  message JobTermination {
   180    string job_id = 1;
   181  }