respan-instrumentation-browser-use
Respan tracing for browser-use agents.
pip install respan-ai respan-instrumentation-browser-use
from browser_use import Agent, ChatOpenAI
from respan import Respan
from respan_instrumentation_browser_use import BrowserUseInstrumentor
respan = Respan(instrumentations=[BrowserUseInstrumentor()]) # RESPAN_API_KEY
agent = Agent(task="Find the top story on Hacker News", llm=ChatOpenAI(model="gpt-4.1-mini"))
await agent.run()
respan.flush() # short scripts: send spans before the process exits
With respan-tracing alone, call BrowserUseInstrumentor().activate() after
RespanTelemetry(...).
What is traced
browser_use.agent agent task in; final result, success, steps, usage out
└─ browser_use.step task one per agent step: page URL/title, reasoning, actions, screenshot
├─ browser_use.llm chat every model call, any browser-use provider; tokens + cache tokens
└─ <action name> tool one per browser action (navigate, click, input, extract, done, ...)
- Screenshots. Each step's output carries that step's page screenshot as an
image_urlpart, re-encoded as JPEG (max 1280 px wide) to keep exports small. Respan stores it as log media and shows it in the log view. LLM prompts keep the screenshot the model actually saw. - Any LLM provider. Model calls are traced at browser-use's own chat-model
layer, so OpenAI, Anthropic, Google, Browser Use Cloud, OpenRouter, Ollama and
custom models all produce the same
chatspan. Provider SDK instrumentations that honour OpenTelemetry's language-model suppression key do not log the same call twice. - Action failures. browser-use returns action errors instead of raising them;
those
toolspans are marked as errors. - Anthropic cache tokens. browser-use's native Anthropic clients leave cache
writes out of
prompt_tokens; they are added back so Respan prices the full prompt. - Activation order. Models registered by an Agent built before activation are still traced.
- Secrets. Action parameters are captured before browser-use substitutes
sensitive_data, so secrets stay as their<secret>name</secret>placeholders. Any value that comes back with a real secret in it (a page URL, an error such as "Navigation to https://...?token=... blocked") is masked the same way before export. - Grouping. Every span of a run carries the Agent's session id as its thread,
session and trace-group identifier, so follow-up tasks on the same
Agent(add_new_task+run()) group together. Values set throughrespan.propagate_attributes(thread_identifier=..., group_identifier=...)win. - Replays.
Agent.rerun_history()is its own trace under abrowser_use.rerunagent span, in the same thread as the original run. - Customer context.
customer_identifier,metadataand the other fields set onRespan(...)orpropagate_attributes(...)reach every span.
Options
| Option | Default | Effect |
|---|---|---|
capture_content |
True |
False keeps span structure, timings, models, action names and token counts but drops the task, prompts, completions, action params and results, page URLs and titles, and exception messages (only the exception type is kept). TRACELOOP_TRACE_CONTENT=false does the same. |
capture_screenshots |
True |
False drops step screenshots and replaces inline images in prompts with a size placeholder. |
Not yet covered
- Session replay (rrweb recording synced to the step timeline). See
docs/GAPS.md. browser_use.betaagents.
Metadata
Release files for respan-instrumentation-browser-use 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| respan_instrumentation_browser_use-0.1.0.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_browser_use-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.6 kB
Release files / respan_instrumentation_browser_use-0.1.0.tar.gz
| Download URL | respan_instrumentation_browser_use-0.1.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b28a4e3863fa4e073a9b58bc71aabbb32d22754d5615fc364ec4169bef19fae7
|
|
BLAKE2b-256 checksum How to use checksums |
5dcef6826438c0fc9b5db6881a97ef198ab986f7d2f1d13a7d11b310b474b6b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / respan_instrumentation_browser_use-0.1.0-py3-none-any.whl
| Download URL | respan_instrumentation_browser_use-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e159cab2192a72ef9dc54bf02f5fd850c3c73764013a15d5b80f18fdab2a7d4f
|
|
BLAKE2b-256 checksum How to use checksums |
122426b6de7152957ef9432aa554545222d763e02c64c40815f60106e36498bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log