Skip to main content
Record what each TinyFish remote browser session costs next to your LLM spend. Every session becomes a tool span with its URL, result, duration and dollar cost, and the cost counts toward the trace total.
traceroot does not auto-instrument TinyFish and does not know your rate. You trace the session with observe and report its cost yourself, and traceroot stores the cost you report. See Tool and API calls for how reported costs add up.

Install

Reporting a cost requires traceroot 0.5.0 or later, or @traceroot-ai/traceroot 0.7.0 or later.

Set up

Initialize traceroot once at startup. No integration flag is needed: the observe wrapper in the next step traces the session.

Usage

TinyFish bills remote browsers by the minute and returns no price, so you estimate the cost from the session’s length. To record it:
  1. Wrap the session in a function traced as a tool span (type="tool").
  2. Time the session from creation to close.
  3. Multiply the minutes by your price per minute and report it with update_current_span(cost=...) (updateCurrentSpan in TypeScript) before the span closes. A finally block reports it even when the session fails.
Call browse from your agent like any other function. Its span nests under the span that called it, and its cost adds to that trace’s total.
Span details for a tinyfish_open_page tool span with a cost of 0.000092, the page URL input and the loaded page title output

Browser minutes at the per-minute rate on the tool span

Verify

Run your code and confirm the trace arrives:
  1. In the traceroot UI: Navigate to Tracing > Traces in traceroot Cloud. You should see a tinyfish_open_page span, at the root or under your agent’s span. Open it to see its cost; the trace’s total cost includes it.
  2. Via the CLI: Run traceroot traces list to inspect your recent traces from the terminal.

What gets captured

Limitations

  • The cost is an estimate: TinyFish bills from its own usage records, which can run a little longer.

Next steps

Python SDK Reference

Explore the full Python SDK reference and instrumentation options.

Time used

Report time used at your price per minute