Arize Phoenix / OpenInference `TraceSource` adapter for whatifd. Phase D of the v0.2 plan.
Project description
whatifd-phoenix
Arize Phoenix / OpenInference TraceSource adapter for whatifd.
Phase D of the v0.2 plan. Implements whatifd.adapters.TraceSource
against an OpenInference span-iterator surface — Phoenix's native
span shape — so callers can wire any Phoenix client variant (or any
OpenInference-emitting tracer) without the adapter pinning a specific
Phoenix SDK version.
Install
uv pip install whatifd-phoenix # adapter only
uv pip install whatifd-phoenix[live] # + arize-phoenix-client
The base install gives you the Protocol surface; the [live] extra
pulls arize-phoenix-client for live integration. The adapter is
API-agnostic beyond the span-iterator shape, so you can use any
Phoenix client variant by writing a small spans_provider adapter.
Usage
from arize.phoenix.client import Client
from whatifd_phoenix import PhoenixTraceSource
client = Client(endpoint="http://localhost:6006")
def spans_provider():
# Cardinal #9 (orchestration, not compute) note: avoid
# `df.iterrows()` — it's pandas-backed row iteration that pulls
# NumPy buffers per row. Prefer the streaming form below
# (`itertuples` returns lightweight named tuples) or, better,
# iterate a list-of-dicts response directly if your Phoenix
# client surface offers one.
spans = client.query_spans(query=...).to_dict(orient="records")
yield from spans
def classify(spans):
# Cohort classification has access to ALL spans of a trace
# (root + children), so a tag set on a tool span is reachable.
if any(s.get("attributes.tag.failed") for s in spans):
return "failure"
return "baseline"
source = PhoenixTraceSource(
spans_provider=spans_provider,
cohort_classifier=classify,
max_traces=40,
)
for raw in source.iter_traces():
print(raw.trace_id, raw.cohort)
Why span-iterator-shaped (not Phoenix-Client-shaped)
Phoenix's Python client API has shifted across versions
(arize-phoenix → arize-phoenix-client; methods on Client have
churned between major versions). Pinning a specific Client shape in
this adapter would force a sync-with-Phoenix-release cycle on every
Phoenix major bump.
The span-iterator shape is the stable API:
OpenInference span
attributes are an open standard, and downstream consumers (Phoenix,
but also custom OTLP collectors) emit this shape. Wiring is a
~5-line spans_provider callable that you control.
OpenInference attributes the adapter reads
| Attribute | Used for |
|---|---|
context.trace_id |
Grouping spans into traces. Required. |
parent_id |
Identifying the root span (parent-less). |
openinference.span.kind |
Fallback root identification. |
input.value |
Wrapped as Sensitive[str] → RawTrace.user_message. |
output.value |
Wrapped as Sensitive[str] → RawTrace.original_response. |
| All other attributes | Pass through to RawTrace.metadata (NOT wrapped). |
Spans without context.trace_id are silently dropped (logged at
DEBUG level). Other malformed spans are best-effort: missing input
or output values render as empty Sensitive[""], which downstream
guards surface as a structured failure rather than crashing the run.
Cardinal alignment
- #5 Sensitive[T] at the boundary:
input.valueandoutput.valueare wrapped. Other attributes pass through unwrapped because they carry tooling state (model name, latency, tool calls), not user content. The conformance test pins this contract. - #9 orchestration, not compute: no DataFrames, no NumPy in the hot path. Spans arrive as dicts; the adapter groups by trace_id and emits.
- #10 statistical claims:
cluster_key_supportreturns an emptyavailable_keystuple. v0.2 does NOT mine cluster keys from OpenInference attributes (e.g.,user.id,session.id) because those weren't predeclared at experiment design time. v0.3+ may add explicit per-attribute opt-in.
Status
| Surface | v0.2 | Notes |
|---|---|---|
Protocol shape (TraceSource) |
✅ | Conformance test against the parent repo's harness. |
| Span grouping by trace_id | ✅ | Pinned by TestSpanGrouping. |
| Root span identification | ✅ | Parent-less + OpenInference kind fallback. |
| Recorded-cassette smoke (live Phoenix) | ❌ — v0.3 | Awaiting Phoenix HTTP-cassette infrastructure parity with whatifd-langfuse. |
Cluster keys from user.id / session.id |
❌ — v0.3+ | Cardinal #10 requires predeclaration; opt-in landed alongside cluster bootstrap. |
License
Apache-2.0.
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_phoenix-0.2.0.tar.gz.
File metadata
- Download URL: whatifd_phoenix-0.2.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
802506f939d4fc3be782b02149d1da371de2f2ff73fa57f212497aa2c56cc3ad
|
|
| MD5 |
f6530528246d4285ac357898fdc8de17
|
|
| BLAKE2b-256 |
1ba413a39775425bb1678b2b35a6a6b475e68f8fe812eb5496e4aebf4b736d4d
|
Provenance
The following attestation bundles were made for whatifd_phoenix-0.2.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_phoenix-0.2.0.tar.gz -
Subject digest:
802506f939d4fc3be782b02149d1da371de2f2ff73fa57f212497aa2c56cc3ad - Sigstore transparency entry: 1498131565
- Sigstore integration time:
-
Permalink:
victoralfred/whatifd@9cadf0c5cacdb8826311364713746099b68aff3a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/victoralfred
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9cadf0c5cacdb8826311364713746099b68aff3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file whatifd_phoenix-0.2.0-py3-none-any.whl.
File metadata
- Download URL: whatifd_phoenix-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.7 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 |
4ce054d92dddc8853e27a19de52588c4a61e9620b7db2b58a64d3aafa71b92b7
|
|
| MD5 |
d63e38fe3e2f99ba7d27c0825d6b3b16
|
|
| BLAKE2b-256 |
9086fb4896c4eb47264dbbd6730266bbbd6340c174980c27b6aa539d0b70c67d
|
Provenance
The following attestation bundles were made for whatifd_phoenix-0.2.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_phoenix-0.2.0-py3-none-any.whl -
Subject digest:
4ce054d92dddc8853e27a19de52588c4a61e9620b7db2b58a64d3aafa71b92b7 - Sigstore transparency entry: 1498131713
- Sigstore integration time:
-
Permalink:
victoralfred/whatifd@9cadf0c5cacdb8826311364713746099b68aff3a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/victoralfred
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9cadf0c5cacdb8826311364713746099b68aff3a -
Trigger Event:
push
-
Statement type: