Tracing

SDK reference

Every tracing function and option in trodo-node and trodo-python 3.x, with the exact names in each language.

trodo-node and trodo-python are at 3.0.7. Install with npm install trodo-node@^3 or pip install "trodo-python>=3". Release notes: Changelog.

Node uses camelCase and Python uses snake_case for the same things. Prompts and datasets have their own references: Prompts SDK, Datasets export.

init

NodePythonDefaultWhat it does
siteIdsite_idrequiredFrom Settings → General
autoInstrumentauto_instrumenttrueCapture installed providers and frameworks
disableInstrumentationsdisable_instrumentations[]Turn off some, e.g. ['openai']
deliverydelivery'auto''background', 'immediate' or 'auto'. Delivery
deliveryOptionsdelivery_optionsBatch size, interval, queue limits, retry time
otelModeotel_mode'trodo''otlp' to send auto-captured spans over OTLP. OpenTelemetry
debugdebugfalseLog every send and error
silentn/afalseHide setup warnings
apiBaseapi_basehttps://sdkapi.trodo.ai
onErroron_errorCalled on any API error

Runs

NodePythonWhat it does
wrapAgent(name, fn, options) → { result, runId }with wrap_agent(name, **options) as runOne run around your function. Wrap your agent
n/a@agent(name, **options)Decorator form
startRun(name, options) → runIdstart_run(name, **options) → run_idOpen a run to end later. Long-running runs
joinRun(runId, parentSpanId, fn, options)with join_run(run_id, parent_span_id, name=, kind=)Add spans to an open run from anywhere
endRun(runId, options)end_run(run_id, **options)Finish a run from startRun
currentRunId()current_run_id()The run you're in

Run options: distinctId, conversationId, metadata, user, parentRunId; startRun also takes runId (a UUID) and input. endRun takes status ('ok' or 'error'), output, errorSummary and metadata.

Run handle: setInput, setOutput, setMetadata, setErrorSummary(text, { type }), and runId (Python: set_input, set_output, set_metadata, set_error_summary, run_id).

Spans

NodePythonWhat it does
withSpan(name, fn, { kind, input, attributes })with span(name, kind=, input=, attributes=)A span around a block. Manual spans
tool(name, fn)@tool(name) or tool(name, fn)Every call of fn is a tool span
retrieval(name, fn)@retrieval(name)A retrieval span per call
trace(name, fn)@trace(name)A generic span per call
llm(name, fn, { model, provider, extractUsageMap })@llm(name, model=, provider=, extract_usage_map=)An llm span per call, with usage read from the response
trackLlmCall({...})track_llm_call(...)Record a model call you already made
trackMcp({...}) → spanIdtrack_mcp(...) → span_idOne span per MCP tool call, with no run. Trace your MCP server
currentSpanId()current_span_id()The span you're in
getTracer(name)get_tracer(name)A raw OpenTelemetry tracer

Span handle: setInput, setOutput, setTool, setLlm, setAttribute, setError({ message, type, statusCode }), setLevel, and spanId.

Across services

NodePythonWhat it does
propagationHeaders()propagation_headers()Headers that carry the run to the next service
expressMiddleware()fastapi_middleware()Joins the caller's run on the receiving side

See Distributed tracing.

Feedback and users

NodePythonWhat it does
feedback(runId, { satisfaction, rating, comment, metadata, spanId })feedback(run_id, satisfaction=, rating=, comment=, metadata=, span_id=)Feedback
users.upsert(distinctId, { properties, setOnce, fixedProperties })upsert_user(distinct_id, properties=, set_once=, fixed_properties=)Users
forUser(distinctId).people.*for_user(distinct_id).people.*Change one property

OpenTelemetry and delivery

NodePythonWhat it does
registerOTel({ siteId, mode })register_otel(site_id=, mode=)Set up the OTel pipeline; mode: 'otlp' to add Trodo beside other exporters
aiSdkTelemetry()n/aTrodo's Vercel AI SDK v7 integration, if you register it yourself
flush()flush()Send everything queued
shutdown()shutdown()Flush and stop
deliveryStats()client .delivery_stats()Queued, sent and dropped counts

On this page