Module agents.backend.protocol
Protocol definitions for VideoSDK Agent backend communication.
This module defines the message types and structures used for communication between VideoSDK agents and the backend registry server.
Classes
class AvailabilityRequest (type: str = 'availability_request',
job_id: str = '',
room_id: str = '',
agent_name: str = '')-
Expand source code
@dataclass class AvailabilityRequest: """Request from server asking if worker is available for a job.""" type: str = "availability_request" job_id: str = "" room_id: str = "" agent_name: str = ""Request from server asking if worker is available for a job.
Instance variables
var agent_name : strvar job_id : strvar room_id : strvar type : str
class AvailabilityResponse (type: str = 'availability_response',
job_id: str = '',
available: bool = False,
error: str | None = None,
token: str | None = None)-
Expand source code
@dataclass class AvailabilityResponse: """Response from worker indicating availability.""" type: str = "availability_response" job_id: str = "" available: bool = False error: Optional[str] = None token: Optional[str] = None # Worker's auth token when accepting job def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultResponse from worker indicating availability.
Instance variables
var available : boolvar error : str | Nonevar job_id : strvar token : str | Nonevar type : str
Methods
def dict(self) ‑> Dict[str, Any]-
Expand source code
def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultConvert to dictionary, excluding None values.
class JobAssignment (type: str = 'job_assignment',
job_id: str = '',
room_id: str = '',
agent_name: str = '',
token: str = '',
url: str = '',
room_options: Dict[str, Any] | None = None,
metadata: Dict[str, Any] | None = None,
wait: bool = False)-
Expand source code
@dataclass class JobAssignment: """Job assignment from server to worker.""" type: str = "job_assignment" job_id: str = "" room_id: str = "" agent_name: str = "" token: str = "" url: str = "" room_options: Optional[Dict[str, Any]] = None metadata: Optional[Dict[str, Any]] = None wait: bool = False def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultJob assignment from server to worker.
Instance variables
var agent_name : strvar job_id : strvar metadata : Dict[str, Any] | Nonevar room_id : strvar room_options : Dict[str, Any] | Nonevar token : strvar type : strvar url : strvar wait : bool
Methods
def dict(self) ‑> Dict[str, Any]-
Expand source code
def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultConvert to dictionary, excluding None values.
class JobStatus (*args, **kwds)-
Expand source code
class JobStatus(str, Enum): """Job status enumeration.""" PENDING = "pending" RUNNING = "running" COMPLETED = "completed" FAILED = "failed" CANCELLED = "cancelled"Job status enumeration.
Ancestors
- builtins.str
- enum.Enum
Class variables
var CANCELLEDvar COMPLETEDvar FAILEDvar PENDINGvar RUNNING
class JobTermination (type: str = 'job_termination', job_id: str = '', reason: str | None = None)-
Expand source code
@dataclass class JobTermination: """Job termination request from server.""" type: str = "job_termination" job_id: str = "" reason: Optional[str] = NoneJob termination request from server.
Instance variables
var job_id : strvar reason : str | Nonevar type : str
class JobUpdate (type: str = 'job_update',
job_id: str = '',
status: str = '',
error: str | None = None,
participant_identity: str | None = None,
participant_name: str | None = None,
participant_metadata: str | None = None)-
Expand source code
@dataclass class JobUpdate: """Update from worker about job status.""" type: str = "job_update" job_id: str = "" status: str = "" error: Optional[str] = None participant_identity: Optional[str] = None participant_name: Optional[str] = None participant_metadata: Optional[str] = None def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultUpdate from worker about job status.
Instance variables
var error : str | Nonevar job_id : strvar participant_identity : str | Nonevar participant_metadata : str | Nonevar participant_name : str | Nonevar status : strvar type : str
Methods
def dict(self) ‑> Dict[str, Any]-
Expand source code
def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultConvert to dictionary, excluding None values.
class ServerMessage (type: str,
worker_id: str | None = None,
success: bool | None = None,
message: str | None = None,
job_id: str | None = None,
room_id: str | None = None,
agent_name: str | None = None,
token: str | None = None,
url: str | None = None)-
Expand source code
@dataclass class ServerMessage: """Base message from server to worker.""" type: str worker_id: Optional[str] = None success: Optional[bool] = None message: Optional[str] = None job_id: Optional[str] = None room_id: Optional[str] = None agent_name: Optional[str] = None token: Optional[str] = None url: Optional[str] = None def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultBase message from server to worker.
Instance variables
var agent_name : str | Nonevar job_id : str | Nonevar message : str | Nonevar room_id : str | Nonevar success : bool | Nonevar token : str | Nonevar type : strvar url : str | Nonevar worker_id : str | None
Methods
def dict(self) ‑> Dict[str, Any]-
Expand source code
def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultConvert to dictionary, excluding None values.
class UpdateJobStatus (job_id: str,
status: JobStatus,
error: str | None = None,
participant_identity: str | None = None,
participant_name: str | None = None,
participant_metadata: str | None = None)-
Expand source code
@dataclass class UpdateJobStatus: """Update job status message.""" job_id: str status: JobStatus error: Optional[str] = None participant_identity: Optional[str] = None participant_name: Optional[str] = None participant_metadata: Optional[str] = NoneUpdate job status message.
Instance variables
var error : str | Nonevar job_id : strvar participant_identity : str | Nonevar participant_metadata : str | Nonevar participant_name : str | Nonevar status : JobStatus
class UpdateWorkerStatus (status: WorkerStatus,
load: float | None = None,
job_count: int | None = None,
error: str | None = None)-
Expand source code
@dataclass class UpdateWorkerStatus: """Update worker status message.""" status: WorkerStatus load: Optional[float] = None job_count: Optional[int] = None error: Optional[str] = NoneUpdate worker status message.
Instance variables
var error : str | Nonevar job_count : int | Nonevar load : float | Nonevar status : WorkerStatus
class WorkerMessage (type: str,
worker_id: str | None = None,
agent_name: str | None = None,
capabilities: List[str] | None = None,
status: str | None = None,
load: float | None = None,
job_count: int | None = None,
job_id: str | None = None,
available: bool | None = None,
participant_identity: str | None = None,
participant_name: str | None = None,
participant_metadata: str | None = None,
error: str | None = None,
registry_uuid: str | None = None,
max_capacity: int | None = None,
current_load: float | None = None,
token: str | None = None,
load_threshold: float | None = None,
max_processes: int | None = None)-
Expand source code
@dataclass class WorkerMessage: """Base message from worker to server.""" type: str worker_id: Optional[str] = None agent_name: Optional[str] = None capabilities: Optional[List[str]] = None status: Optional[str] = None load: Optional[float] = None job_count: Optional[int] = None job_id: Optional[str] = None available: Optional[bool] = None participant_identity: Optional[str] = None participant_name: Optional[str] = None participant_metadata: Optional[str] = None error: Optional[str] = None registry_uuid: Optional[str] = None max_capacity: Optional[int] = None current_load: Optional[float] = None token: Optional[str] = None # Authentication token for registry # Workload configuration from agent load_threshold: Optional[float] = None # Agent's load threshold (e.g., 0.8) max_processes: Optional[int] = None # Agent's max processes (e.g., 3) def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultBase message from worker to server.
Instance variables
var agent_name : str | Nonevar available : bool | Nonevar capabilities : List[str] | Nonevar current_load : float | Nonevar error : str | Nonevar job_count : int | Nonevar job_id : str | Nonevar load : float | Nonevar load_threshold : float | Nonevar max_capacity : int | Nonevar max_processes : int | Nonevar participant_identity : str | Nonevar participant_metadata : str | Nonevar participant_name : str | Nonevar registry_uuid : str | Nonevar status : str | Nonevar token : str | Nonevar type : strvar worker_id : str | None
Methods
def dict(self) ‑> Dict[str, Any]-
Expand source code
def dict(self) -> Dict[str, Any]: """Convert to dictionary, excluding None values.""" result = {} for key, value in self.__dict__.items(): if value is not None: result[key] = value return resultConvert to dictionary, excluding None values.
class WorkerPing (type: str = 'ping', timestamp: int | None = None)-
Expand source code
@dataclass class WorkerPing: """Ping message from worker.""" type: str = "ping" timestamp: Optional[int] = NonePing message from worker.
Instance variables
var timestamp : int | Nonevar type : str
class WorkerPong (type: str = 'pong', timestamp: int | None = None)-
Expand source code
@dataclass class WorkerPong: """Pong response from server.""" type: str = "pong" timestamp: Optional[int] = NonePong response from server.
Instance variables
var timestamp : int | Nonevar type : str
class WorkerStatus (*args, **kwds)-
Expand source code
class WorkerStatus(str, Enum): """Worker status enumeration.""" IDLE = "idle" BUSY = "busy" OFFLINE = "offline" ERROR = "error"Worker status enumeration.
Ancestors
- builtins.str
- enum.Enum
Class variables
var BUSYvar ERRORvar IDLEvar OFFLINE