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
2. Configure export
Choose Beacon Cloud hosted Observe or a customer-managed OTLP endpoint.Hosted Observe
Hosted Observe requires a Beacon Cloud account. To get anASYMPTOTE_API_KEY, reach out for a demo, then initialize Observe as early as possible in your application startup:
Set the Beacon Cloud API key
Hosted Observe initialization
The SDK appends
/v1/observe when the configured base URL or endpoint does not already include it.
The base URL must use https://. Plain http:// is accepted only for loopback (localhost, 127.0.0.1, [::1]), so a local stub keeps working; any other http:// base URL with an API key makes Observe.initialize() throw instead of sending the key in cleartext.
Customer-managed OTLP
Use an explicit OTLP endpoint when traces should go to a local or customer-managed collector instead of Beacon Cloud hosted Observe:Set the OTLP endpoint
Customer-managed OTLP initialization
ASYMPTOTE_API_KEY is also set, the SDK attaches it only if the OTLP endpoint has the same origin (scheme, host and port) as the Beacon Cloud base URL; a third-party or customer collector never receives it. Headers you pass in initialize({ headers }), including your own authorization, are sent unchanged.
3. Create a first trace
Wrap application code withObserve.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
What to read next
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
Shut down tracing on exit