Skip to main content

Telemetry collector for AI agents — stream runs, tools, LLM calls, and chains to the Dobby AI Control Plane for governance

Project description

dobby-collector

Telemetry collector for AI agents — stream runs, tools, LLM calls, and chains to the Dobby AI Control Plane for governance and compliance.

Status Python License

dobby-collector is the customer-side Python package for sending telemetry from any AI agent — LangChain, CrewAI, AutoGen, plain OpenAI/Anthropic SDKs, or custom code — to Dobby's governance plane. Every captured run gets evaluated by the Policy Scanner against your imported Compliance Packs (SOC 2, GDPR, EU AI Act, etc.) and surfaces violations in the Dobby dashboard.

Install

pip install dobby-collector

Quickstart

from dobby_collector import init, track, span, start_run, end_run

# 1. Initialize once at agent startup
init(
    api_key="dsdk_...",       # Generate at /dashboard/workloads/connect/python-sdk
    connector_id="wc_...",       # Same wizard hands you the connector ID
    framework="langchain",        # or 'crewai' | 'autogen' | omit to auto-detect
)

# 2. Decorate tool functions
@track(name="search_database", kind="tool")
def search_db(query: str) -> list:
    return db.execute(query)

# 3. Use spans for fine-grained capture
with span("retrieval", kind="tool", inputs={"query": "find AI startups"}):
    docs = retriever.invoke("find AI startups")

# 4. Wrap agent invocations in start/end_run
run = start_run(name="weekly_report", inputs={"week": "2026-W19"})
try:
    output = my_agent.run("Generate the weekly report")
    end_run(run, outputs={"report": output}, status="success")
except Exception as e:
    end_run(run, error=str(e), status="error")
    raise

The SDK runs a background thread that flushes events every 10 seconds (or immediately on terminal run.completed / run.failed events). Telemetry never blocks your agent — buffer overflow drops the oldest events silently.

What gets captured

What When Captured fields
Run boundaries start_run / end_run inputs, outputs, status, duration
Tool calls @track(kind="tool") or span(kind="tool") tool name, args, output, duration
LLM calls LangChain auto-instrument (Phase 2b), or @track(kind="llm") model, prompt, completion, tokens, latency
Custom spans @track() / span() name, inputs, outputs, duration

Config reference

init(
    api_key="dsdk_...",              # REQUIRED — or set DOBBY_API_KEY env var
    connector_id="wc_...",              # REQUIRED — or set DOBBY_CONNECTOR_ID env var
    base_url="https://dobby-ai.com",    # Override for self-hosted; or DOBBY_BASE_URL env
    flush_interval_seconds=10.0,        # How often the sender thread flushes
    max_buffer_events=10_000,           # Ring buffer cap (oldest dropped on overflow)
    framework="auto",                   # Hint or pin: 'langchain' | 'crewai' | 'autogen'
    host_fingerprint=None,              # Optional hostname/container ID for multi-replica
    pii_redact=False,                   # Opt-in: redact emails/SSNs/credit cards (Phase 2b)
    exclude_fields=[],                  # Fields to scrub from `data` payloads (Phase 2b)
)

Environment variables

The SDK reads these as fallbacks for init() args:

Env var Default Purpose
DOBBY_API_KEY Connector bearer token (dsdk_*) — minted by the wizard
DOBBY_CONNECTOR_ID Workload connector ID (wc_*)
DOBBY_BASE_URL https://dobby-ai.com Dobby control-plane URL

Set them in your deployment config and skip the corresponding init() args.

Lifecycle

from dobby_collector import init, shutdown

init(...)
# ... your agent runs ...
shutdown(timeout_seconds=5.0)  # Drains buffer + stops sender thread

shutdown() auto-fires via atexit if you forget, but call it explicitly when possible — atexit hooks have less time to drain before SIGTERM.

Status

Phase 2a (this release): Manual instrumentation API — init, track, span, start_run, end_run, shutdown. In-memory ring buffer + background sender + HTTP retries.

Phase 2b (next):

  • LangChain auto-instrument via BaseCallbackHandler — zero code changes for LangChain agents
  • DLQ to local SQLite — events survive network outages

Phase 4: CrewAI / AutoGen / OpenAI SDK / Anthropic SDK auto-instrument.

License

MIT — see LICENSE.

Links

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

dobby_collector-0.1.0.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

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

dobby_collector-0.1.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file dobby_collector-0.1.0.tar.gz.

File metadata

  • Download URL: dobby_collector-0.1.0.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for dobby_collector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df960610438bf4c1a072a896a1b70f9baa25519ae9aab27f6f10ae3d38d9cdd0
MD5 7b0160b083dd43576689e0c411707d6f
BLAKE2b-256 5375d5d4dd2110fb1204eb9187e47db38773363b5ef8b80f11ec1ba3edae0a8d

See more details on using hashes here.

File details

Details for the file dobby_collector-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dobby_collector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95a62380566f838ab1aaddc854367569e88df87305851f4332aa43171fb1bb08
MD5 8f32d7665ddfcc066c8e51a48aab14f2
BLAKE2b-256 f89059dce5299034085ee5760e24d2ef69f8ed6c7c676df2820491b77748711f

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