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
| Node | Python | Default | What it does |
|---|---|---|---|
siteId | site_id | required | From Settings → General |
autoInstrument | auto_instrument | true | Capture installed providers and frameworks |
disableInstrumentations | disable_instrumentations | [] | Turn off some, e.g. ['openai'] |
delivery | delivery | 'auto' | 'background', 'immediate' or 'auto'. Delivery |
deliveryOptions | delivery_options | Batch size, interval, queue limits, retry time | |
otelMode | otel_mode | 'trodo' | 'otlp' to send auto-captured spans over OTLP. OpenTelemetry |
debug | debug | false | Log every send and error |
silent | n/a | false | Hide setup warnings |
apiBase | api_base | https://sdkapi.trodo.ai | |
onError | on_error | Called on any API error |
Runs
| Node | Python | What it does |
|---|---|---|
wrapAgent(name, fn, options) → { result, runId } | with wrap_agent(name, **options) as run | One run around your function. Wrap your agent |
| n/a | @agent(name, **options) | Decorator form |
startRun(name, options) → runId | start_run(name, **options) → run_id | Open 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
| Node | Python | What 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({...}) → spanId | track_mcp(...) → span_id | One 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
| Node | Python | What 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
| Node | Python | What 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
| Node | Python | What 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/a | Trodo'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 |