Versioned, provider-neutral execution envelope shared by all optimizers.
The original evaluation fields remain directly available. project/3 adds a
runtime identity and typed events for GEPA, MIPROv2, SIMBA, RLM, ReAct, and
generic evaluation adapters. dump/1 is the canonical cross-runtime wire
representation: it is JSON-safe, deterministic, and redacts secrets in
structured fields. Opaque attachment bytes are preserved unchanged. An
Imp.History is written by Imp.History.dump/1 and read by
Imp.History.load!/1. load/1 validates the complete envelope and fails
closed.
Map keys load as the atoms or strings they were written as, with one
exception: loading never creates an atom, so a key written as an atom that
does not exist in the loading VM loads as its name, a string. A prediction's
metadata keys that are strings (written that way, or loaded as names) become
their atoms when those atoms exist, so Imp.Prediction.get_lm_usage/1 and
Imp.Prediction.complete?/1 read them. A map that holds a key as both an
atom and a string is refused on load, as on dump.
Summary
Functions
Dumps every trajectory field into a deterministic JSON-safe versioned map.
True when this trajectory's failure came from a killed evaluation task (timeout or deadline exhaustion), not from model or metric behavior.
Loads and strictly validates a canonical trajectory wire map.
Loads a trajectory or raises DecodeError for any malformed field.
Projects an existing trajectory or runtime prediction into the canonical contract.
Returns a secret-redacted trajectory while preserving all typed structs.
Returns the current trajectory wire schema version.
Validates ordering, tool alignment, accounting, cache, and named parameter invariants.
Validates a batch as index-aligned, ordered canonical trajectories.
Types
@type runtime() ::
:evaluation
| :gepa
| :mipro_v2
| :simba
| :rlm
| :agent
| :react
| :optimize_anything
@type t() :: %Imp.Optimizer.Trajectory{ cache: struct() | nil, error: term(), events: list(), example: term(), feedback: term(), index: integer(), metadata: map(), metric_metadata: map() | nil, named_parameters: list(), prediction: term(), program_id: term(), rollout_id: term(), runtime: runtime(), schema_version: pos_integer(), score: number(), timing: struct(), trace: list() | nil, usage: struct() }
Functions
Dumps every trajectory field into a deterministic JSON-safe versioned map.
True when this trajectory's failure came from a killed evaluation task (timeout or deadline exhaustion), not from model or metric behavior.
Loads and strictly validates a canonical trajectory wire map.
Loads a trajectory or raises DecodeError for any malformed field.
Projects an existing trajectory or runtime prediction into the canonical contract.
Returns a secret-redacted trajectory while preserving all typed structs.
Returns the current trajectory wire schema version.
Validates ordering, tool alignment, accounting, cache, and named parameter invariants.
Validates a batch as index-aligned, ordered canonical trajectories.