Skip to main content
To get started with the ABV Python SDK you need to install the SDK and initialize the client.

Installation

To install the SDK, run:
pip install abvdev

Initialize Client

Begin by initializing the ABV client. You must provide your ABV api key. These can be passed as constructor arguments or set as environment variables (recommended).If you are using a data region other than the US default (e.g., EU: https://eu.app.abv.dev), ensure you configure the host argument or the ABV_HOST environment variable (recommended).via Environment Variables (recommended)
.env
ABV_API_KEY="sk-abv-..."
ABV_HOST="https://app.abv.dev" # US region
# ABV_HOST="https://eu.app.abv.dev" # EU region
via Constructor Arguments
from abvdev import ABV

# Initialize with constructor arguments
abv = ABV(
    api_key="YOUR_API_KEY",
    host="https://app.abv.dev" # US region
    # host="https://eu.app.abv.dev" # EU region
)
If you are reinstantiating the ABV client with different constructor arguments in the same process, the new configuration will be used for all subsequent calls.
Key configuration options:
Constructor ArgumentEnvironment VariableDescriptionDefault value
api_keyABV_API_KEYYour ABV project’s secret API key. Required.
hostABV_HOSTThe API host for your ABV instance."https://app.abv.dev"
timeoutABV_TIMEOUTTimeout in seconds for API requests.5
httpx_client-Custom httpx.Client for making non-tracing HTTP requests.
debugABV_DEBUGEnables debug mode for more verbose logging. Set to True or "True".False
tracing_enabledABV_TRACING_ENABLEDEnables or disables the ABV client. If False, all observability calls become no-ops.True
flush_atABV_FLUSH_ATNumber of spans to batch before sending to the API.512
flush_intervalABV_FLUSH_INTERVALTime in seconds between batch flushes.5
environmentABV_TRACING_ENVIRONMENTEnvironment name for tracing (e.g., “development”, “staging”, “production”). Must be lowercase alphanumeric with hyphens/underscores."default"
releaseABV_RELEASERelease version/hash of your application. Used for grouping analytics.
media_upload_thread_countABV_MEDIA_UPLOAD_THREAD_COUNTNumber of background threads for handling media uploads.1
sample_rateABV_SAMPLE_RATESampling rate for traces (float between 0.0 and 1.0). 1.0 means 100% of traces are sampled.1.0
mask-A function (data: Any) -> Any to mask sensitive data in traces before sending to the API.
ABV_MEDIA_UPLOAD_ENABLEDWhether to upload media files to ABV S3.True

Accessing the Client Globally

The ABV client is a singleton. It can be accessed anywhere in your application using the get_client function. Optionally, you can initialize the client via ABV() to pass in configuration options (see above). Otherwise, it is created automatically when you call get_client() based on environment variables.
from abvdev import get_client

# Optionally, initialize the client with configuration options
# abv = ABV(api_key="sk-abv-...")

# Get the default client
client = get_client()