Skip to main content

Attribution

The full diagnostic result for one trace. Returned by diagnose_pipeline and Origin.diagnose.

Properties

Methods

top_culprit() → NodeAttribution | None

The highest-confidence culprit, or None if there are none.

primary_culprits() → list[NodeAttribution]

All culprits with severity == "primary".

by_prompt() → list[PromptAttribution]

Roll span-level blame up to the prompt level. For each distinct prompt_id referenced by the culprits, aggregates the spans that share it: mean confidence, max severity, concatenated reasoning. Culprits with no prompt_id are skipped. This is the view Reflex consumes — it tells you which prompt to update and how confident Origin is that the update will help. Only culprits with fix_type="prompt" are meaningful inputs to Reflex.

render() → str

Multi-line human-readable rendering suitable for CLI output. Includes culprit list with severity/confidence/fix_type and the prompt-level rollup.

to_json(**kwargs) → str

JSON serialization. Accepts json.dumps keyword arguments (e.g. indent=2).

to_dict() → dict

Returns a plain dict. Roundtrippable via Attribution.from_dict(d).

NodeAttribution

One span’s share of the blame for a trace’s failure.

Properties

fix_type values

Methods

to_dict() → dict

Serializes to a plain dict. Roundtrippable via NodeAttribution.from_dict(d).

PromptAttribution

Aggregated blame rolled up to the prompt level. Returned by Attribution.by_prompt().

Properties

Methods

to_dict() → dict

Serializes to a plain dict.

Type aliases