Skip to main content

Setup Flow

Follow this path to install @asymptote/sdk, initialize tracing, create a first span, and flush it before the process exits.

1. Install

Install the SDK
The package requires Node.js 20 or newer.

2. Configure Export

Choose Asymptote Managed hosted Observe or a customer-managed OTLP endpoint.

Hosted Observe

Hosted Observe requires an Asymptote Managed account. To get an ASYMPTOTE_API_KEY, reach out for a demo, then initialize Observe as early as possible in your application startup:
Set the Asymptote Managed API key
Hosted Observe initialization
Hosted export uses OTLP/HTTP traces. The SDK appends /v1/observe when the configured base URL or endpoint does not already include it.

Customer-Managed OTLP

Use an explicit OTLP endpoint when traces should go to a local or customer-managed collector instead of Asymptote Managed hosted Observe:
Set the OTLP endpoint
Customer-managed OTLP initialization
Explicit OTLP export does not require an Asymptote Managed API key.

3. Create A First Trace

Wrap application code with Observe.observe() to create a Beacon-compatible span.
Create a traced function

Export Precedence

Observe.initialize() resolves export configuration in this order: If neither hosted credentials nor an explicit OTLP endpoint is configured, use a custom exporter or disable the default exporter.
Initialize with a custom exporter

Instrumentation

Configure SDK initialization, module patching, and existing OpenTelemetry providers.

Observe

Wrap custom agent functions and control span metadata.

SDK Lifecycle

Decide when to flush or shut down tracing.

Agent SDK Integrations

Add supported Anthropic, Claude Agent SDK, OpenAI, or Vercel AI SDK instrumentation.

Flush Before Exit

For short-lived scripts, CI jobs, and serverless handlers, flush spans before the process exits:
Flush spans before exit
When the process owns the OpenTelemetry provider lifecycle, shut it down during graceful termination:
Shut down tracing on exit