Skip to main content

Official BilldogEng server SDK for Python — Analytics, Feature Flags (remote + local eval), Surveys, Messaging, and LLM observability.

Project description

billdogeng (Python)

Official BilldogEng server SDK for Python — the engagement suite for server-side use: Analytics, Feature Flags (remote + local evaluation), Surveys (data API), Messaging dispatch, and LLM observability.

This is the Python port of the canonical Node reference SDK; the wire protocol and method surface are identical across all billdogeng-* server SDKs.

Install

pip install billdogeng

Zero runtime dependencies (stdlib only). Requires Python 3.8+.

Quickstart

from billdogeng import BilldogEng

bd = BilldogEng("bd_test_xxx", local_evaluation=True)

# Analytics (batched + background flush + gzip + retry)
bd.capture("user-123", "order_completed", {"revenue": 49.99}, {"company": "acme"})
bd.identify("user-123", {"email": "a@b.com", "plan": "pro"})
bd.group_identify("company", "acme", {"seats": 50})
bd.alias("user-123", "anon-abc")

# Feature flags (local evaluation = deterministic murmurhash3 bucketing)
if bd.is_feature_enabled("new_checkout", "user-123"):
    ...
variant = bd.get_feature_flag("pricing_test", "user-123")
payload = bd.get_feature_flag_payload("pricing_test", "user-123")
all_flags = bd.get_all_flags("user-123")

# Surveys (data API — no rendering)
surveys = bd.surveys.list("user-123")
config = bd.surveys.fetch(survey_id, "user-123")
started = bd.surveys.start(survey_id, {"customer_id": "user-123"})
bd.surveys.submit(survey_id, [{"question_id": q, "answer_number": 9}],
                  {"respondent_id": started["respondent_id"]})

# Messaging dispatch (Bearer JWT auth)
bd.messaging.dispatch(
    project_id="…", channel="push",
    content={"title": "Hi", "body": "There"},
    access_token="<supabase-jwt>",
    targeting={"type": "all"},
    scheduling={"deliveryType": "immediate"},
)

# LLM observability
bd.llm.capture_trace(
    trace_id="t-1", span_id="s-1", model="claude-opus-4-8",
    input_text="…", output_text="…",
    prompt_tokens=10, completion_tokens=5, duration_ms=123, cost_usd=0.002,
)

bd.shutdown()  # flushes remaining events + stops the background timer

# Or as a context manager:
with BilldogEng("bd_test_xxx") as bd:
    bd.capture("user-123", "page_view")

Configuration

Option Default Description
host https://api.billdog.io/v1 Base URL for all requests
flush_at 20 Batch size that triggers a flush
flush_interval 10000 Background flush cadence (ms)
max_queue_size 1000 Max queued events before oldest are dropped
gzip True Gzip request bodies large enough to benefit
local_evaluation False Enable local (server-side) flag evaluation
request_timeout 10000 Per-request timeout (ms)
max_retries 3 Retry attempts for 5xx / network errors
group_type_index None Stable group-type → positional index map

Auth: x-api-key: <apiKey> on every request (bd_test_* sandbox / bd_live_* live). Messaging dispatch authenticates with a Bearer JWT instead.

Tests

python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest -q

The suite covers: batching (10 captures → 1 POST), identify/group/alias event shapes, the 12 canonical murmurhash3 vectors + rollout/targeting/multivariate evaluation, 503-then-200 retry with backoff (local stub server), and the survey round-trip + messaging dispatch + LLM trace payload shapes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

billdogeng-1.0.0b1.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

billdogeng-1.0.0b1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file billdogeng-1.0.0b1.tar.gz.

File metadata

  • Download URL: billdogeng-1.0.0b1.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for billdogeng-1.0.0b1.tar.gz
Algorithm Hash digest
SHA256 354f8cbab412dbbcbadc294f630b219ba81e094abeedc06711d91c3e93a47829
MD5 713f7ad510676df637001e726e61f8b3
BLAKE2b-256 8020e0e17ca4b549c0a8ab4bd848822fe1ae3a86f9901255544262b435ae6e03

See more details on using hashes here.

File details

Details for the file billdogeng-1.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: billdogeng-1.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for billdogeng-1.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c98a24969a9c546d01ad59ced120c83139b2cffdbfdeb4e323e04d721091abd
MD5 4291e1872025071fa7fab811657897b1
BLAKE2b-256 16b7b3750ffeec7c9fb7f7d3e70b6e3f38d6e07f177a3cf44e7874c902027b27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page