Overview
Observatory can be configured using environment variables, programmatic configuration, or a combination of both. The SDK automatically handles API key authentication and endpoint routing.Environment Variables
The following environment variables are supported across all Observatory packages:Your Observatory API key. Keys starting with
dev_ automatically route to the development environment.Custom ingestion endpoint URL. Overrides the default production/development URL selection.Default behavior:
- Production:
https://api.thecontext.company/v1/custom - Development:
https://dev.thecontext.company/v1/custom(when API key starts withdev_)
Enable debug logging to console. Set to
1 or true to activate.Custom feedback endpoint URL for user feedback submission.Default:
https://api.thecontext.company/v1/feedbackDisable anonymous usage telemetry collection. Set to
true to opt out.Observatory collects limited anonymous usage data to improve the SDK. No sensitive or personally identifiable information is ever collected. See the telemetry events source code for details.
Programmatic Configuration
You can configure Observatory programmatically using theconfigure() function. This is useful for dynamic configuration or when you prefer code-based settings.
Basic Configuration
Configuration Options
API key for authentication. Overrides
TCC_API_KEY environment variable.Enable debug logging. Overrides
TCC_DEBUG environment variable.Custom ingestion endpoint. Overrides
TCC_URL environment variable.Default auto-flush timeout in milliseconds for all runs. Runs that don’t complete within this duration are automatically flushed with error status.Default:
1200000 (20 minutes)Set to 0 to disable auto-flush.Merging Configuration
Multiple calls to
configure() are merged together. You only need to pass the fields you want to change.Configuration Priority
When both environment variables and programmatic configuration are present, the following priority order applies:Example
Framework-Specific Configuration
Next.js with AI SDK
For Next.js applications using the AI SDK integration:.env.local:
.env.local
Custom SDK
For custom agents using the manual instrumentation SDK:API Key Management
Development vs Production
Observatory automatically routes to the appropriate environment based on your API key prefix:- Keys starting with
dev_route tohttps://dev.thecontext.company - All other keys route to
https://api.thecontext.company
Security Best Practices
.env.local
