|
1 | 1 | # Observability, Telemetry, and Tracing |
2 | 2 |
|
3 | | -Understanding what your AI agents are doing, debugging issues, and monitoring performance is critical for production deployments. Telemetry collects usage data to help improve AskUI Vision Agent. This data is used to detect bugs, understand usage patterns, and improve the user experience. |
| 3 | +Telemetry collects usage data to help improve AskUI Vision Agent. This data is used to detect bugs, understand usage patterns, and improve the user experience. |
4 | 4 |
|
5 | 5 | ### What Data Is Collected |
6 | 6 |
|
@@ -67,3 +67,69 @@ from askui import ComputerAgent |
67 | 67 | ``` |
68 | 68 |
|
69 | 69 | When disabled, no usage data is collected or transmitted. |
| 70 | + |
| 71 | +## OpenTelemetry Tracing |
| 72 | + |
| 73 | +AskUI supports exporting traces via [OpenTelemetry](https://opentelemetry.io/) (OTLP/HTTP) for integration with observability backends like Grafana, Jaeger, or Datadog. |
| 74 | + |
| 75 | +### Setup |
| 76 | + |
| 77 | +To use OpenTelemetry Tracing, you first need to install the optional tracing dependencies |
| 78 | +``` |
| 79 | +pip install askui[otel] |
| 80 | +``` |
| 81 | + |
| 82 | + |
| 83 | +### Configuration via Environment Variables |
| 84 | + |
| 85 | +Set the following environment variables to configure tracing. All variables use the `ASKUI__OTEL_` prefix. |
| 86 | + |
| 87 | +| Environment Variable | Description | Default | |
| 88 | +|---|---|---| |
| 89 | +| `ASKUI__OTEL_ENABLED` | Enable or disable OpenTelemetry tracing | `False` | |
| 90 | +| `ASKUI__OTEL_B64_SECRET` | Base64-encoded secret for OTLP authentication (required when enabled) | — | |
| 91 | +| `ASKUI__OTEL_ENDPOINT` | OTLP HTTP endpoint URL | — | |
| 92 | +| `ASKUI__OTEL_SERVICE_NAME` | Service name reported in traces | `askui-python-sdk` | |
| 93 | +| `ASKUI__OTEL_SERVICE_VERSION` | Service version reported in traces | Current package version | |
| 94 | +| `ASKUI__OTEL_CLUSTER_NAME` | Cluster name reported in traces | `askui-dev` | |
| 95 | + |
| 96 | +#### Linux & MacOS |
| 97 | +```bash |
| 98 | +export ASKUI__OTEL_ENABLED=True |
| 99 | +export ASKUI__OTEL_B64_SECRET="your-base64-encoded-secret" |
| 100 | +export ASKUI__OTEL_ENDPOINT="https://your-otlp-endpoint/v1/traces" |
| 101 | +``` |
| 102 | + |
| 103 | +#### Windows PowerShell |
| 104 | +```powershell |
| 105 | +$env:ASKUI__OTEL_ENABLED="True" |
| 106 | +$env:ASKUI__OTEL_B64_SECRET="your-base64-encoded-secret" |
| 107 | +$env:ASKUI__OTEL_ENDPOINT="https://your-otlp-endpoint/v1/traces" |
| 108 | +``` |
| 109 | + |
| 110 | +### Usage |
| 111 | + |
| 112 | +Once environment variables are set, pass `OtelSettings` to the `act()` method. Settings are automatically read from the environment: |
| 113 | + |
| 114 | +```python |
| 115 | +from askui import ComputerAgent |
| 116 | +from askui.telemetry.otel import OtelSettings |
| 117 | + |
| 118 | +with ComputerAgent() as agent: |
| 119 | + agent.act( |
| 120 | + goal="Open Chrome and navigate to askui.com", |
| 121 | + tracing_settings=OtelSettings(enabled=True), |
| 122 | + ) |
| 123 | +``` |
| 124 | + |
| 125 | +You can also override individual settings in code: |
| 126 | + |
| 127 | +```python |
| 128 | +from askui.telemetry.otel import OtelSettings |
| 129 | + |
| 130 | +settings = OtelSettings( |
| 131 | + enabled=True, |
| 132 | + service_name="my-custom-service", |
| 133 | + cluster_name="production", |
| 134 | +) |
| 135 | +``` |
0 commit comments