Self-escalating solver — an agent that re-homes itself GoogleAnthropic mid-task

One agent starts on a cheap Gemini model. When it gets genuinely stuck it calls AgentSelf to upgrade its own model across vendors to Claude — carrying all of its work — and finishes. A black-box grader replies only PASS/FAIL; the agent is never told the answer.
The task

Draw samples from the distribution with unnormalized density f(x) = x·e^(−x/2) for x > 0 — a Gamma, true mean 4 — using a Metropolis-Hastings sampler whose proposal is multiplicative: x′ = x·e^ε. Then submit the samples to a grader that replies only PASS / FAIL.

Why it's a trap (semi-hard)

The textbook rule — accept with min(1, f(x′)/f(x)) — is wrong here. A multiplicative proposal is asymmetric, so a correct sampler needs the Metropolis-Hastings correction (the x′/x Jacobian). Omit it and you silently sample the wrong distribution — an Exponential (mean ≈ 2), not the Gamma (mean 4). The result looks plausible; it's a classic trap that catches non-experts.

The grader gives no hints — just PASS/FAIL — so a model has to know the fix, not be tutored to it. Watch which one can.

▦ buggy → Exponential (wrong) ▦ fixed → Gamma (target)

Watch them solve it (or fail)

Why this needs sagent

One agent that keeps its memory. The upgrade isn't a hand-off to a fresh expert — the stronger model inherits the entire working context (the task, the failed sampler, every grader verdict) and continues from there, instead of starting cold.
It crosses vendors mid-task. A Google model promotes itself to an Anthropic model while it's running. No other agent stack lets a live agent re-home to a different company's model on the fly.
The agent decides for itself. Nobody pre-routed this to the expensive model. The agent discovered it was stuck — the grader kept failing — and upgraded itself, and only as far as it needed (Sonnet, not Opus).