Datadog LLM Observability `TraceSource` adapter for whatifd.
Project description
whatifd-datadog
Datadog LLM Observability TraceSource adapter for whatifd.
Reads previously-ingested LLM-Obs spans (read-only) and projects each trace
into a whatifd RawTrace, so you can fork Datadog-traced agent turns,
replay them under a proposed change, and gate a PR on the verdict.
Status
- ✅ Span-iterator adapter (
DatadogTraceSource) + conformance test (offline) - ✅ Thin Export-API client (
DatadogExportClient,[live]extra) - ❌ Recorded-cassette smoke against a live Datadog org — deferred (needs a real org)
Install
pip install whatifd-datadog # adapter core
pip install whatifd-datadog[live] # + httpx for the Export API client
Why a thin httpx client (not the official SDK)
The official datadog-api-client Python SDK covers LLM Observability
ingestion / experiments / eval-metric, but does not expose a
spans-read path. The documented read surface is the LLM Observability
Export API:
GET /api/v2/llm-obs/v1/spans/eventsPOST /api/v2/llm-obs/v1/spans/events/search
This package wraps it with a minimal httpx client. Auth requires both
the API key and the Application key.
Usage
import os
from whatifd_datadog import DatadogTraceSource
from whatifd_datadog.client import DatadogExportClient, make_spans_provider
client = DatadogExportClient(
api_key=os.environ["DD_API_KEY"],
app_key=os.environ["DD_APP_KEY"],
site=os.environ.get("DD_SITE", "datadoghq.com"),
)
source = DatadogTraceSource(
# ALWAYS bound the window — the Export API defaults to the last 15 min.
spans_provider=make_spans_provider(client, ml_app="my-agent", from_ts="now-24h"),
cohort_classifier=lambda spans: (
"failure" if any("whatifd:failure" in (s.get("tags") or []) for s in spans)
else "baseline"
),
)
for raw in source.iter_traces():
print(raw.trace_id, raw.cohort)
The adapter is span-iterator-shaped (like whatifd-phoenix): spans_provider
is any zero-arg callable yielding normalized span dicts, so you can wire your
own transport or feed fixtures in tests with no network.
Emitting verdict metrics (the sink)
After whatifd fork writes its report, push verdict + cohort metrics to
Datadog so dashboards/monitors can track Ship-rate and regression trends:
whatifd-datadog-emit reports/whatifd-fork-2026-06-04.json --tag service:my-agent
Emits gauges: whatifd.verdict.code (0=ship / 1=dont_ship / 2=inconclusive,
matching the CLI exit code), whatifd.cohort.{selected,replayed,scored, improved,regressed,unchanged,median_delta,ci_lower,ci_upper,floor_passed, regression_ratio,improvement_ratio} (tagged cohort:<name>; null-valued
fields like an unavailable CI bound are skipped, not zeroed), and
whatifd.findings.blocking.
- Out of whatifd core by design — it reads the already-written report and only reports; it never touches the verdict path.
- Soft-fails by default — a metrics hiccup exits 0 so it can't turn a green
verdict red in CI. Pass
--strictto fail the step on emission errors. - Agentless:
POST /api/v1/serieswithDD_API_KEY(DD_SITEfor region).--dry-runprints metrics without submitting. Needs the[live]extra.
Cardinal alignment
- #5 Sensitive[T] at the boundary — span
input/output(DatadogSearchedIO) are wrapped asSensitive[str]at ingress, on root and child spans alike; PII-registered attribute keys are wrapped viawrap_pii_attributes. - #1 failure-as-data —
make_spans_providerrequires an explicitfrom_ts; the API's 15-minute default would otherwise silently return a near-empty cohort. Missinghttpxraises a clear install hint. - #9 orchestration, not compute — streaming pagination; no CPU tricks.
- #10 statistical claims —
cluster_key_support()returns an empty tuple; Datadogsession_id/trace_idare not mined as cluster keys.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whatifd_datadog-0.3.0.tar.gz.
File metadata
- Download URL: whatifd_datadog-0.3.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cc82ca37412e292a51b35151e4ab1454e89bec7371f551c69d25fcc4c3e9851
|
|
| MD5 |
d706a2ebf69df0b439853c0da6429ffc
|
|
| BLAKE2b-256 |
07f32d85ea87ef0aa65f2db4521e0162c19601bea7e29f30283495917e808bd0
|
Provenance
The following attestation bundles were made for whatifd_datadog-0.3.0.tar.gz:
Publisher:
release.yml on victoralfred/whatifd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whatifd_datadog-0.3.0.tar.gz -
Subject digest:
1cc82ca37412e292a51b35151e4ab1454e89bec7371f551c69d25fcc4c3e9851 - Sigstore transparency entry: 1725309049
- Sigstore integration time:
-
Permalink:
victoralfred/whatifd@47869c1d0653ebe9d95106ca9e5d263ff58ee5e0 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/victoralfred
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47869c1d0653ebe9d95106ca9e5d263ff58ee5e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file whatifd_datadog-0.3.0-py3-none-any.whl.
File metadata
- Download URL: whatifd_datadog-0.3.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f01888794fef938d58d4049505596d1085ac4e3f55b101ce3c05c27631e36c8
|
|
| MD5 |
7a7d61053d7488c355dcc3f22bc07810
|
|
| BLAKE2b-256 |
6be89b4f4a7cec386788e8101b03de8b9837d6890fdac008fc698b7975caaff2
|
Provenance
The following attestation bundles were made for whatifd_datadog-0.3.0-py3-none-any.whl:
Publisher:
release.yml on victoralfred/whatifd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whatifd_datadog-0.3.0-py3-none-any.whl -
Subject digest:
1f01888794fef938d58d4049505596d1085ac4e3f55b101ce3c05c27631e36c8 - Sigstore transparency entry: 1725309699
- Sigstore integration time:
-
Permalink:
victoralfred/whatifd@47869c1d0653ebe9d95106ca9e5d263ff58ee5e0 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/victoralfred
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47869c1d0653ebe9d95106ca9e5d263ff58ee5e0 -
Trigger Event:
push
-
Statement type: