SDKs
Python SDK
Python SDK - Setup
5 min
to get started with the abv python sdk you need to install the sdk and initialize the client 1\) installation to install the sdk, run pip install abvdev 2\) 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 default (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 abv client with different constructor arguments but the same if you are reinstantiating abv client with different constructor arguments but the same api key , the client will reuse the same instance and ignore the new arguments verify connection with abv auth check() you can also verify your connection to the abv server using abv auth check() we do not recommend using this in production as this adds latency to your application from abvdev import get client abv = get client() \# verify connection, do not use in production as this is a synchronous call if abv auth check() print("abv client is authenticated and ready!") else print("authentication failed please check your credentials and host ") key configuration options constructor argument environment variable description default value api key abv api key your abv project's secret api key required host abv host the api host for your abv instance "https //app abv dev" timeout abv timeout timeout in seconds for api requests 5 httpx client custom httpx client for making non tracing http requests debug abv debug enables debug mode for more verbose logging set to true or "true" false tracing enabled abv tracing enabled enables or disables the abv client if false , all observability calls become no ops true flush at abv flush at number of spans to batch before sending to the api 512 flush interval abv flush interval time in seconds between batch flushes 5 environment abv tracing environment environment name for tracing (e g , "development", "staging", "production") must be lowercase alphanumeric with hyphens/underscores "default" release abv release release https //docs abv dev/releases and versioning version/hash of your application used for grouping analytics media upload thread count abv media upload thread count number of background threads for handling media uploads 1 sample rate abv sample rate sampling https //docs abv dev/sampling 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 https //docs abv dev/masking of sensitive llm data sensitive data in traces before sending to the api abv media upload enabled whether 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()