Skip to main content
While environment variables are the recommended way to configure PandaProbe, you can also configure either SDK programmatically.

Basic programmatic configuration

Python

Precedence rules

Parameters passed to init always take precedence over environment variables:
Python
Precedence order (highest to lowest):
  1. Explicit keyword arguments to pandaprobe.init()
  2. PANDAPROBE_* environment variables
  3. SDK defaults
TypeScript uses camelCase option names. Python uses snake_case.

SdkConfig fields

The resolved configuration is stored as a frozen SdkConfig dataclass. You can inspect it via the client:
Python
The equivalent TypeScript SdkConfig fields are apiKey, projectName, endpoint, environment, release, enabled, batchSize, flushInterval, maxQueueSize, and debug.
When tracing is enabled, both the API key and project name are required. Python raises ValueError; TypeScript throws Error if either value is missing.

Re-initialization

Calling pandaprobe.init() when a client already exists shuts down the previous client and creates a new one:
Python
TypeScript behaves the same way:
TypeScript

Auto-initialization

If you don’t call pandaprobe.init(), the SDK auto-initializes from environment variables on first use:
Python
Auto-initialization is attempted once. If it fails (for example, missing API key), subsequent calls to get_client() return None and convenience functions like flush() and shutdown() silently no-op. TypeScript also auto-initializes once on first use. If initialization fails, getClient() returns null; flush(), shutdown(), and score() safely no-op until init() is called.