Skip to content

Commit 54e364c

Browse files
feat: implement otel tracing feature
1 parent 0bbb4cb commit 54e364c

6 files changed

Lines changed: 2234 additions & 2233 deletions

File tree

docs/09_observability_telemetry_tracing.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Observability, Telemetry, and Tracing
22

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.
44

55
### What Data Is Collected
66

@@ -67,3 +67,69 @@ from askui import ComputerAgent
6767
```
6868

6969
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

Comments
 (0)