Skip to content

solvi.solutions.wrap

solvi.wrap configures explicit external-agent decision points. Disabled calls preserve the base call and result; enabled overrides require a strict declared expected-loss reduction, evidence and a durable journal record before return. Internal calls on the original agent are not automatically intercepted. Callback purity and expected-loss validity remain owner contracts; this is not a sandbox or welfare guarantee.

The module also provides training-only paired component selection over predeclared configurations, with incremental score/error records. It does not tune a holdout or certify utility gains. See external agent wrap.

Explicit external decision interception; loss estimates/evidence are owner declarations.

wrap

wrap(agent, *, decision_points, default=None, enabled=True, components=None, storage=None)

Intercept explicitly named external methods; other methods forward to the original agent.

Proposers receive detached finite JSON {args, kwargs, default}; return None or {action, default_loss, loss, evidence: [nonempty string IDs]}. A strict finite nonnegative loss reduction and declared evidence permit an override, journaled durably before return. Invalid/unsupported analysis keeps the original object. The first valid selected component wins. Disabled calls the base exactly once without analysis, proposer calls or journal writes. Internal self.calls are not patched. Estimates, evidence validity and proposer purity are owner assumptions; this adapter is neither a sandbox nor a theorem about real-world utility.

select_components

select_components(factory, evaluator, *, decision_points, seeds, directory, configurations=None, max_evaluations=None, costs=None)

Training-only paired utilities on fresh factory(seed) agents; no holdout or certificate.

Defaults to baseline plus each component separately. Extra combinations must be preregistered in configurations (tuples of component names). Costs are optional declared per-configuration per-cell metadata, not measured costs or utility. Each attempted cell is saved/fsynced; errors continue. Only complete paired configurations can be recommended, with baseline winning a zero-gain tie. Use a new directory per invocation; partial artifacts are not silently resumed.

priced_proposal

priced_proposal(default, alternatives, *, evidence)

Compare owner-declared expected losses, including refusing and asking.

Each option has action, p_wrong, wrong_cost and optional price. Alternatives require permitted=True; a hard default is never challenged. Probabilities, prices, permissions and evidence are declarations, not learned certificates. This produces a wrap proposal and executes no action or check.