mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
feat: add CDP URL to Agent Telemetry events (#2299)
<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Added the CDP URL to Agent Telemetry events so each event now includes the browser session's CDP endpoint when available. <!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -11,6 +11,7 @@ import time
|
||||
from collections.abc import Awaitable, Callable
|
||||
from pathlib import Path
|
||||
from typing import Any, Generic, TypeVar
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
@@ -1116,6 +1117,9 @@ class Agent(Generic[Context, AgentStructuredOutput]):
|
||||
use_validation=self.settings.validate_output,
|
||||
version=self.version,
|
||||
source=self.source,
|
||||
cdp_url=urlparse(self.browser_session.cdp_url).hostname
|
||||
if self.browser_session and self.browser_session.cdp_url
|
||||
else None,
|
||||
action_errors=self.state.history.errors(),
|
||||
action_history=action_history_data,
|
||||
urls_visited=self.state.history.urls(),
|
||||
|
||||
@@ -29,6 +29,7 @@ class AgentTelemetryEvent(BaseTelemetryEvent):
|
||||
use_validation: bool
|
||||
version: str
|
||||
source: str
|
||||
cdp_url: str | None
|
||||
# step details
|
||||
action_errors: Sequence[str | None]
|
||||
action_history: Sequence[list[dict] | None]
|
||||
|
||||
Reference in New Issue
Block a user