mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
52 lines
1.1 KiB
Python
52 lines
1.1 KiB
Python
from abc import ABC, abstractmethod
|
|
from dataclasses import asdict, dataclass
|
|
from typing import Any, Dict, Optional
|
|
|
|
|
|
@dataclass
|
|
class BaseTelemetryEvent(ABC):
|
|
@property
|
|
@abstractmethod
|
|
def name(self) -> str:
|
|
pass
|
|
|
|
@property
|
|
def properties(self) -> Dict[str, Any]:
|
|
return {k: v for k, v in asdict(self).items() if k != "name"}
|
|
|
|
|
|
@dataclass
|
|
class RegisteredFunction:
|
|
name: str
|
|
params: dict[str, Any]
|
|
|
|
|
|
@dataclass
|
|
class ControllerRegisteredFunctionsTelemetryEvent(BaseTelemetryEvent):
|
|
registered_functions: list[RegisteredFunction]
|
|
name: str = "controller_registered_functions"
|
|
|
|
|
|
@dataclass
|
|
class AgentRunTelemetryEvent(BaseTelemetryEvent):
|
|
agent_id: str
|
|
task: str
|
|
name: str = "agent_run"
|
|
|
|
|
|
@dataclass
|
|
class AgentStepErrorTelemetryEvent(BaseTelemetryEvent):
|
|
agent_id: str
|
|
error: str
|
|
name: str = "agent_step_error"
|
|
|
|
|
|
@dataclass
|
|
class AgentEndTelemetryEvent(BaseTelemetryEvent):
|
|
agent_id: str
|
|
task: str
|
|
steps: int
|
|
success: bool
|
|
error: Optional[str] = None
|
|
name: str = "agent_end"
|