Laminar.initialize(options?)
Initialize Laminar tracing and auto-instrumentation. Parameters:| Name | Type | Default | Description |
|---|---|---|---|
projectApiKey | string | LMNR_PROJECT_API_KEY env | Project API key |
baseUrl | string | https://api.lmnr.ai | Base URL |
baseHttpUrl | string | baseUrl | OTLP HTTP base URL |
httpPort | number | 443 | OTLP HTTP port |
grpcPort | number | 8443 | OTLP gRPC port |
instrumentModules | Record<string, unknown> | undefined | Libraries to auto-instrument |
disableBatch | boolean | false | Disable batching span processor |
traceExportTimeoutMillis | number | 30000 | Export timeout |
maxExportBatchSize | number | 512 | Max spans per export batch |
forceHttp | boolean | false | Force OTLP HTTP exporter |
logLevel | 'error' | 'warn' | 'info' | 'debug' | 'error' | SDK log level |
sessionRecordingOptions | SessionRecordingOptions | — | Browser session recording options |
void
instrumentModules
Pass modules to auto-instrument ininitialize().
| Key | Package |
|---|---|
openAI / OpenAI | openai |
anthropic | @anthropic-ai/sdk |
azureOpenAI | Azure OpenAI |
cohere | cohere-ai |
bedrock | AWS Bedrock |
google_vertexai | Vertex AI |
google_aiplatform | AI Platform |
pinecone | @pinecone-database/pinecone |
langchain | langchain (with submodules) |
llamaIndex | llamaindex |
chromadb | chromadb |
qdrant | @qdrant/js-client-rest |
together | together-ai |
playwright | playwright |
puppeteer | puppeteer |
stagehand | @browserbasehq/stagehand |
kernel | Microsoft Kernel |
claudeAgentSDK | @anthropic-ai/claude-agent-sdk |
- Pass
undefined→ auto-instrument all supported - Pass
{}→ disable all auto-instrumentation
Laminar.patch(modules)
Manually instrument modules after initialization.| Name | Type | Default | Description |
|---|---|---|---|
modules | InitializeOptions['instrumentModules'] | — | Modules to instrument |
void
Note: Throws if modules empty. Warns if Laminar not initialized.
Laminar.wrapClaudeAgentQuery(originalQuery)
Instrument Claude Agent SDK query function.Laminar.initialize() or in ESM environments.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
originalQuery | Function | — | The original Claude Agent SDK query function |
Function (same type as originalQuery)
Alternative: Use the top-level export instrumentClaudeAgentQuery(originalQuery).