Skip to main content

Install

This also installs aevyra-witness for tracing. Python 3.10+.

Set your API key

OpenAI and OpenRouter are also supported — see Providers.

Instrument your pipeline

Add @span decorators from aevyra_witness.runtime to the functions you want Origin to reason about. Each decorated function becomes a node in the execution trace:
The optimize=True and prompt_id= flags on answer tell Origin (and downstream Reflex) that this span’s behaviour is controlled by a prompt that can be rewritten. Spans without these flags — tools, retrievers, routers — can still be diagnosed; their fix_type just won’t be "prompt".

Run the diagnosis

diagnose_pipeline handles everything: runs your agent under a Witness tracer, captures the trace, scores it with your judge, and runs all three attribution methods. No separate tracing step, no pre-captured trace file needed.

Read the output

Each culprit tells you:
  • severity — whether this span was the primary cause or a contributing factor
  • confidence — how certain Origin is (0.0–1.0)
  • fix_type — where the repair effort belongs
In this example, the real problem is the retrieval index (fix=retrieval) and a routing misclassification (fix=routing). Rewriting the answer prompt won’t help much — fixing the retriever will.

Without a Verdict judge

Pass any Callable[[AgentTrace], float] as judge=:

Using a pre-captured trace

Already have a trace? Use the raw on-ramp:
Or via the CLI:

Routing results to Reflex

result.by_prompt() rolls span-level blame up to the prompt level — one entry per prompt_id, with mean confidence and max severity across all call sites:
Only fix_type="prompt" culprits are meaningful inputs to Reflex — if Origin says fix=retrieval, update the index rather than the prompt.

Next steps

Tutorial

Full walkthrough of a plan-act-respond agent

Methods

When to use critic, decomposition, and ablation

API reference

Full Attribution and NodeAttribution reference

Reflex

Automatically rewrite culprit prompts