# `Spectre.Router.Receipt`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/router/receipt.ex#L1)

Privacy-safe summary of one router-only evaluation.

A receipt records the selected route, sanitized provider-call outcomes and
durations, and whether an LLM adapter was actually invoked. It deliberately
excludes input text, prompts, model output, candidate matches, and handlers
so evaluation artifacts can be shared without silently becoming conversation
logs.

# `attempt`

```elixir
@type attempt() :: %{
  :provider =&gt; atom(),
  :result =&gt; atom(),
  optional(:label) =&gt; atom() | nil,
  optional(:reason) =&gt; atom() | nil
}
```

# `candidate_summary`

```elixir
@type candidate_summary() :: %{
  :provider =&gt; atom(),
  :label =&gt; atom() | nil,
  :accepted? =&gt; boolean(),
  :score =&gt; number() | nil,
  :margin =&gt; number() | nil,
  :strength =&gt; atom(),
  optional(:eligible?) =&gt; boolean(),
  optional(:winner?) =&gt; boolean(),
  optional(:rejection_reason) =&gt; atom() | nil,
  optional(:required) =&gt; map()
}
```

# `outcome`

```elixir
@type outcome() :: :route | :clarify | :unknown | :error
```

# `provider_call`

```elixir
@type provider_call() :: %{
  :provider =&gt; atom(),
  :outcome =&gt; atom(),
  :duration_us =&gt; non_neg_integer(),
  :invoked? =&gt; boolean(),
  optional(:purpose) =&gt; atom()
}
```

# `t`

```elixir
@type t() :: %Spectre.Router.Receipt{
  accepted?: boolean(),
  arbitration: map() | nil,
  attempts: [attempt()],
  candidates: [candidate_summary()],
  duration_us: non_neg_integer(),
  error: atom() | nil,
  label: atom() | nil,
  llm_called?: boolean(),
  outcome: outcome(),
  provider_calls: [provider_call()],
  scope: Spectre.Definition.scope() | nil,
  strategy: atom() | nil,
  trace_codes: [atom()]
}
```

# `from_context`

```elixir
@spec from_context(Spectre.Router.Context.t(), non_neg_integer()) :: t()
```

Builds a receipt from a completed routing context.

# `from_error`

```elixir
@spec from_error(term(), non_neg_integer()) :: t()
```

Builds an error receipt when the router pipeline cannot complete.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
