Skip to main content
The TraceRoot TypeScript SDK provides automatic and manual instrumentation for AI agents using OpenTelemetry.

Instrumentation

Pass module instances to initialize() to instrument all calls automatically:

The Observe Wrapper

Wrap any async function to create a span:

Parameters

Setting Trace Context

Use usingAttributes() to set user and session context for all spans created within a block:

Parameters

Updating Spans and Traces

Update the current span or trace programmatically:

updateCurrentSpan Parameters

updateCurrentTrace Parameters

Environment Variables