Skip to main content
Record what each PredictLeads company lookup costs next to your LLM spend. Every lookup becomes a tool span with its domain, the company data, latency and dollar cost, and the cost counts toward the trace total.
traceroot does not auto-instrument PredictLeads and does not know your plan’s price. You trace the lookup 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 lookup.

Usage

PredictLeads charges a fixed price per request, set by your plan. To record it:
  1. Wrap the lookup in a function traced as a tool span (type="tool").
  2. Check that the request succeeded; PredictLeads does not bill a rejected one.
  3. Report your price per call with update_current_span(cost=...) (updateCurrentSpan in TypeScript) while that span is open.
Call company_lookup 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.

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 company_lookup 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

  • PredictLeads bills a lookup that returns no data yet, so report the cost on every successful response.
  • A retry is another call and gets its own cost.

Next steps

Python SDK Reference

Explore the full Python SDK reference and instrumentation options.

Fixed price per call

Report your price on each billed call