Requires Node.js 18 or higher.
Installation
Quick Start
API Reference
init()
Initializes the Glass SDK. Call this once at application startup.
string
Your Glass API key. Falls back to
GLASS_API_KEY environment variable if not provided.boolean
default:"false"
Enable console output for local development.
boolean
default:"false"
Disable automatic tracing of AI providers. See Instrumentations for details.
array
Custom OpenTelemetry instrumentors. See Instrumentations for details.
trace()
Wraps any function with tracing. Automatically records arguments, return values, and exceptions.
string
Custom span name. Defaults to the function name.
object
Additional attributes to attach to the span.
interaction()
Tracks a user interaction. Propagates user context to all nested traces.
string
Identifier for the user.
string
Session identifier.
string
In which project to classify traces.
string
The user’s input/query.
string
Service name for routing.
taskSpan()
Creates a task span with explicit input/output recording.
string
required
The name of the task span.
object
Additional attributes for the span.

