In what scenarios must an instance refuse a cost-aware SLA handoff when the peer's advertised price curve is non-monotone across the requested batch window

**Date of Record:** 2026 December 2 **Scope:** Applies to any agent that delegates a batch of sub-tasks to a peer agent under an SLA contract whose price is a function of batch size (per-unit cost curves, tiered pricing, or volume discounts), where the delegating agent must commit to a batch size before the peer returns per-item results. Does not apply to fixed per-call pricing, streaming token billing, or single-item synchronous calls where price is known before commitment.

Core Distinction

The distinction that matters here is not "cheap vs. expensive peer" — it is **monotone vs. non-monotone price curves across the batch window the delegating agent is about to commit to**. A monotone-decreasing curve (bigger batch → lower per-unit price, everywhere) makes delegation a simple optimization: send everything the budget allows. A non-monotone curve — one that dips, then rises, then dips again as batch size grows — turns delegation into a *trap*: the agent's planner, reasoning over a sampled or partially-observed price table, will converge on a batch size that sits on a local minimum and silently pay a higher effective total than a smaller or larger batch would have cost. The failure is not that the peer lied about price. The failure is that the delegating agent's *sampling of the price function* is sparser than the function's own structure, and the planner's local search over that sparse sample is a non-convex optimization it believes is convex.

This is a boundary condition of contract negotiation, not of execution: it fires at the instant the delegating agent signs the SLA, before any sub-task runs. Once signed, the batch size is fixed and the overpayment is locked in.

What Was Observed

A delegating orchestrator (`D`) held a 40-item batch of extraction sub-tasks and negotiated with peer `P`, which advertised a cost-aware SLA of the form: `price(n) = base + n * unit(n)`, where `unit(n)` was tiered — 0.10 for n≤10, 0.08 for 11≤n≤25, 0.06 for 26≤n≤35, then 0.09 for n>35 (a "burst surcharge" tier the peer applied because large batches exceeded its own concurrency budget and forced it to rent overflow capacity).

`D`'s negotiation module queried the price at three probe points — n=10, n=25, n=40 — to fit a curve. It saw 1.00, 2.00, 3.60 and concluded per-unit cost was decreasing (0.100 → 0.080 → 0.090, but total was still "cheap enough"). It then ran a local search from n=25 and moved *upward* toward n=40 because total throughput per unit time looked better and the SLA's latency term rewarded larger committed batches. It committed to n=40.

The actual optimal commitment was n=35: `base + 35*0.06 = 2.10` versus the committed `base + 40*0.09 = 3.60`. `D` overpaid by 71% and, because the burst surcharge tier also carried a *higher* latency SLA (the peer's overflow capacity was slower), it missed its own downstream deadline. The probe at n=40 landed exactly on the surcharge tier boundary, so the sampled curve appeared to have only two segments; the n=36..∞ rise was invisible because no probe fell inside it.

The trace: `probe(10) → 1.00`, `probe(25) → 2.00`, `probe(40) → 3.60`; planner fit a monotone-decreasing model; local search stepped 25→30→35→40 using *interpolated* per-unit values (0.080, 0.070, 0.062, 0.090 — the interpolation between 35 and 40 was wrong because the function is discontinuous at 35); committed at 40. The discontinuity at the tier boundary was never sampled.

Condition of Validity

The refusal-to-commit guardrail is valid — and must fire — only when all of the following hold:

  1. The peer's price is a function of committed batch size `n`, not of realized item count.
  2. `D`'s observation of `price(n)` is a finite sample `S` with `|S| <` the number of monotonicity segments in the true function.
  3. `D`'s planner uses local search or gradient-style stepping over `S`, i.e., it assumes local convexity between probes.
  4. The commitment is irreversible or carries a cancellation penalty (the SLA is signed before results return).

If any of these fails, the guardrail is unnecessary: with per-item pricing (1 fails) there is no curve to mis-sample; with exhaustive probing (2 fails) the structure is known; with a global optimizer over a known-convex surrogate (3 fails) local search is safe; with revocable commitment (4 fails) the agent can renegotiate after observing realized cost.

The invariant: **a delegating agent must not commit to a batch size unless it has probed at least one point on each side of every suspected tier boundary, or has received an explicit monotonicity warrant from the peer.** Absent that warrant, the price function is *unbounded in structure* and the planner's convexity assumption is unsound.

Decision Boundary

The boundary is between *probing to fit* and *probing to falsify*. Fitting assumes the curve's shape family (monotone, convex, piecewise-linear with known breakpoints) and estimates parameters. Falsifying assumes nothing and searches for a probe pair `(n_i, n_j)` with `n_i < n_j` but `price(n_j)/n_j > price(n_i)/n_i` — a per-unit inversion, which is the signature of a non-monotone tier. If the negotiation module finds such an inversion, or if the gap between adjacent probes exceeds the peer's declared tier granularity, it must **not** interpolate across the gap; it must either probe inside the gap or refuse to commit.

Concretely: if the peer's SLA metadata declares `tier_granularity = 10` and the probes are at 25 and 40, the gap of 15 spans more than one tier and the module must refuse. If the peer declares no granularity, the module must treat the entire gap as unknown and refuse any commitment whose `n` falls strictly inside it. The peer can discharge the refusal by returning a signed monotonicity warrant (`∂unit/∂n ≤ 0` over the requested range) or by exposing the full tier table. A warrant that the peer cannot cryptographically bind to the price it will actually charge is not a warrant — it is a claim, and the delegating agent must treat it as advisory.

Operational Effect

When the guardrail fires, the delegating agent's behavior changes in three ways. First, it **shrinks the commitment** to the largest probed `n` on the favorable side of the last confirmed tier boundary (n=35 in the trace above), converting an overpayment into a bounded under-utilization it can top up with a second, separately-negotiated batch. Second, it **records the refusal** in its episodic memory as a negotiation event with the peer's ID and the probed points, so that subsequent delegations to the same peer start from a denser sample rather than re-probing from scratch — this is the episodic-to-semantic distillation that prevents the same trap from re-firing. Third, it **escalates to a renegotiation** with an explicit request for the tier table or a monotonicity warrant, which is the only path that lets it commit to the true optimum.

The cost of the guardrail is latency: an extra probe round-trip or a renegotiation handshake adds one RTT to the delegation. The cost of omitting it is unbounded — the overpayment scales with the batch and the surcharge tier, and the SLA-latency miss can cascade into downstream deadline failures that the delegating agent cannot recover from because the batch is already committed. The asymmetry justifies the guardrail unconditionally.

from dataclasses import dataclass
from typing import Callable, Sequence


class NonMonotonePriceCurveError(RuntimeError):
    """Raised when a delegating agent is asked to commit to a batch size
    whose price curve has not been adequately probed for tier inversions."""


@dataclass(frozen=True)
class Probe:
    n: int
    total_price: float

    @property
    def unit_price(self) -> float:
        if self.n <= 0:
            raise NonMonotonePriceCurveError(f"invalid probe size n={self.n}")
        return self.total_price / self.n


@dataclass(frozen=True)
class SlaOffer:
    peer_id: str
    price_fn: Callable[[int], float]
    declared_tier_granularity: int | None  # None => peer withheld granularity


def assert_commitment_safe(
    offer: SlaOffer,
    probes: Sequence[Probe],
    requested_n: int,
) -> None:
    """Guardrail: refuse to commit unless every gap between adjacent probes
    is narrower than the peer's declared tier granularity, and no per-unit
    inversion exists across the probed range."""
    if len(probes) < 2:
        raise NonMonotonePriceCurveError(
            f"peer {offer.peer_id}: fewer than 2 probes; curve structure unknown"
        )

    ordered = sorted(probes, key=lambda p: p.n)

    # 1. Per-unit inversion check: any n_i < n_j with unit(n_j) > unit(n_i)
    #    is the signature of a non-monotone tier the planner would miss.
    for i in range(len(ordered) - 1):
        a, b = ordered[i], ordered[i + 1]
        if b.unit_price > a.unit_price + 1e-12:
            raise NonMonotonePriceCurveError(
                f"peer {offer.peer_id}: per-unit inversion between n={a.n} "
                f"({a.unit_price:.4f}) and n={b.n} ({b.unit_price:.4f}); "
                f"planner would interpolate across a surcharge tier"
            )

    # 2. Granularity check: a gap wider than the declared tier size can hide
    #    an unsampled boundary, so commitment inside it is unsound.
    if offer.declared_tier_granularity is None:
        raise NonMonotonePriceCurveError(
            f"peer {offer.peer_id}: no tier granularity declared; "
            f"cannot bound unsampled structure"
        )
    for i in range(len(ordered) - 1):
        gap = ordered[i + 1].n - ordered[i].n
        if gap > offer.declared_tier_granularity:
            raise NonMonotonePriceCurveError(
                f"peer {offer.peer_id}: probe gap {ordered[i].n}->{ordered[i+1].n} "
                f"({gap}) exceeds declared granularity "
                f"{offer.declared_tier_granularity}; boundary may be hidden"
            )

    # 3. The requested commitment must fall on or below the last confirmed
    #    favorable probe; committing above it is an unverified extrapolation.
    if requested_n > ordered[-1].n:
        raise NonMonotonePriceCurveError(
            f"peer {offer.peer_id}: requested n={requested_n} exceeds "
            f"highest probe n={ordered[-1].n}; extrapolation unsound"
        )


def negotiate(
    offer: SlaOffer,
    probes: Sequence[Probe],
    requested_n: int,
) -> int:
    """Return the safe commitment size, shrinking to the highest probed n
    on the favorable side of the last confirmed boundary if the guardrail fires."""
    try:
        assert_commitment_safe(offer, probes, requested_n)
        return requested_n
    except NonMonotonePriceCurveError:
        # Fall back to the largest probed size at or below the request.
        safe = max((p.n for p in probes if p.n <= requested_n), default=None)
        if safe is None:
            raise NonMonotonePriceCurveError(
                f"peer {offer.peer_id}: no safe commitment available; "
                f"renegotiation required before delegation"
            )
        return safe