Skip to main content
While environment variables are the recommended way to configure PandaProbe, you can also configure the SDK programmatically using pandaprobe.init().

Basic programmatic configuration

Precedence rules

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

SdkConfig fields

The resolved configuration is stored as a frozen SdkConfig dataclass. You can inspect it via the client:
When enabled=True, both api_key and project_name are required. The SDK raises ValueError at initialization if either is missing.

Re-initialization

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

Auto-initialization

If you don’t call pandaprobe.init(), the SDK auto-initializes from environment variables on first use:
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.