Skip to content
Fourohtwo

Next-period traffic weights from arm outcomes

www.brainiac.software/api/v1/experimentation/bandit-allocate

Next-period traffic weights from arm outcomes: Thompson-sampling probabilities by deterministic quadrature, or UCB1 indices, with an exploration floor. Docs: https://www.brainiac.software/api/experimentation/bandit-allocate

BaseAnswering
POSThttps://www.brainiac.software/api/v1/experimentation/bandit-allocate

Uptime100% of 3 checks in 30 days

30 days agoToday

Try it

Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.

The response shows up here.

Call it from an agent

// npm install fourohtwo
import { createPayer } from "fourohtwo";

// One agent key pays USDC on Base or USDG on Robinhood Chain, inside your spending rules.
const pay = createPayer({ privateKey: process.env.AGENT_KEY, maxPerCallUsd: "0.05" });
const res = await pay("https://www.brainiac.software/api/v1/experimentation/bandit-allocate", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"arms":[{"failures":900,"name":"A","successes":100},{"failures":880,"name":"B","successes":120},{"failures":910,"name":"C","successes":90}],"minShare":0.05,"policy":"thompson","prior":{"alpha":1,"beta":1}}),
});
console.log(await res.json());

Example input

{
  "arms": [
    {
      "failures": 900,
      "name": "A",
      "successes": 100
    },
    {
      "failures": 880,
      "name": "B",
      "successes": 120
    },
    {
      "failures": 910,
      "name": "C",
      "successes": 90
    }
  ],
  "minShare": 0.05,
  "policy": "thompson",
  "prior": {
    "alpha": 1,
    "beta": 1
  }
}