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:
Magnus Müller
2025-07-18 16:46:50 +02:00
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@@ -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(),

View File

@@ -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]