dobby-collector
Capture telemetry from any Python AI agent and stream it to Dobby for governance, compliance, and observability.
What this gives you
Every agent run captured
Run lifecycle, LLM calls, tool invocations — a background thread flushes events every 10 seconds and immediately on run completion. Telemetry never blocks your agent.
Policy Scanner auto-fires
Each captured run triggers a compliance scan against your org's Policy Templates (SOC 2 / GDPR / HIPAA / EU AI Act / ISO 42001). Verdicts surface in /dashboard/compliance.
Survives outages and crashes
A SQLite dead-letter queue persists undelivered events through network outages and process crashes, then replays them on the next start.
tracing_enabled flips to configured
SDK auto-emits W3C traceparent per batch. The Surrounding-mode governance control "tracing_enabled" automatically marks your org as configured after the first run.
Install
pip install dobby-collectorManual API (any framework, recommended starting point)
Works with any agent code — no framework dependency. init once at startup, then decorate tools with @track, wrap fine-grained steps in span, and bracket each agent invocation with start_run / end_run.
from dobby_collector import init, track, span, start_run, end_run, shutdown
init(
api_key="dsdk_...", # token from the connect wizard (or DOBBY_API_KEY)
connector_id="wc_...", # connector id from the same wizard (or DOBBY_CONNECTOR_ID)
agent_anchor={"agent_key": "kyc-decisioner"}, # or DOBBY_AGENT_KEY — see below
)
@track(name="search_database", kind="tool")
def search_db(query: str) -> list:
return db.execute(query)
run = start_run(name="weekly_report", inputs={"week": "2026-W19"})
try:
with span("retrieval", kind="tool", inputs={"query": "sales"}):
docs = retriever.invoke("sales")
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
shutdown() # drains the buffer (also auto-fires via atexit)Agent identity (attestation)
Declare a stable agent_key — in code via agent_anchor, or with the DOBBY_AGENT_KEY environment variable. It is a name you choose and keep the same across deploys, not a secret and not an ID Dobby issues you. It is what lets Dobby resolve every run of this agent — across replicas and restarts — to one canonical entry in your org-wide Agent Register.
# Equivalent to passing agent_anchor={...} to init()
export DOBBY_AGENT_KEY=kyc-decisioner # stable name for THIS agent
export DOBBY_AGENT_VERSION=2.3.1 # optional — recorded, never a merge key
export DOBBY_ENV=prod # optional
export DOBBY_AGENT_OWNER=risk-team # optionalWithout a declared key, runs are still fully collected, governed and scanned — but their identity is recorded as unverifiable, the agent gets no Agent Register entry, and it is reported as unattributed in the Agent Identity & Coverage section of an evidence pack. Dobby never infers a key for you: an inferred identity is an unprovable claim in an audit, so Dobby reports unverifiable rather than a false attestation.
Framework auto-instrumentation
Each integration lives in dobby_collector.integrations — the base package pulls no framework dependencies, install only what you use.
LangChain
Pass DobbyCallbackHandler in callbacks — chain / LLM / tool events emit automatically, one run per top-level invocation.
from dobby_collector.integrations.langchain import DobbyCallbackHandlerCrewAI (≥ 1.0)
QuickstartInstruments crew kickoffs — agents, tasks, and tool calls land as spans.
from dobby_collector.integrations.crewai import DobbyCrewAIHandlerAutoGen (≥ 0.4)
Log-handler based — agent conversations and tool executions stream per run.
from dobby_collector.integrations.autogen import DobbyAutoGenLogHandlerOpenAI Assistants
Wraps Assistants runs — steps, tool calls, and messages captured per run.
from dobby_collector.integrations.openai_assistants import DobbyAssistantsHandlerGoogle Gen AI (Gemini)
QuickstartPatches client.models.generate_content (sync / stream / async). Install: pip install dobby-collector[google_genai].
from dobby_collector.integrations.google_genai import instrument_google_genaiOpenClaw
QuickstartInstruments OpenClaw agents without touching their code.
from dobby_collector.integrations.openclaw import instrument_openclawContent capture (on by default)
Unlike Dobby’s OTLP connectors (Claude Code, OpenClaw), the Collector SDK captures content by default: run inputs and outputs, per-call LLM prompt and completion text, and tool arguments / outputs travel inside the events your instrumentation emits, and Dobby stores them with the run — so compliance scans can inspect real evidence out of the box. What lands is what your code sends; you control it client-side:
@track(capture_args=False)/@track(capture_return=False)— skip a tool’s arguments or return value.init(exclude_fields=[...])— scrub named fields from event payloads before they leave the process.- The framework handlers truncate long values (about 4,000 characters per field), so oversized payloads don’t leave the process either.
If a compliance scan reports unverifiable and its evidence gap names a missing prompt, tool arguments, or final output, the run reached Dobby without that content — pass inputs / outputs to start_run / end_run, keep capture_args / capture_return on, or use a framework handler (they capture LLM and tool content automatically). The connector-level capture_content toggle gates Dobby’s OTLP connectors only — it does not change what this SDK’s ingest stores.
exclude_fields and the capture_* flags for fields that must never leave.Related
- SDK overview — all 4 Dobby SDKs (Client + Collector × Python + Node)
- Node.js sister SDK — wire-protocol identical, server-side normalizer shared
- How traceparent unlocks the tracing_enabled governance control
- Source on GitHub