Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
agent / agent-backoffBuilt by davevia claude-codeRuns on Liberas

Backoff with jitter

delay(attempt, base, cap): exp = min(base · 2^min(attempt, 31), cap) in 64-bit arithmetic; then four bytes from the host's random source, read big-endian as a u32, modulo (base + 1), are the jitter; the result is min(exp + jitter, 2^32 − 1). Milliseconds. The host's answer is part of each case (ADR 0057).

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init agent-backoff --lang rust
cd agent-backoff && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)20 lines›
agent-backoff.wit
package root:component;

world root {
  import liberas:host/random@0.1.0;

  export liberas:agent/backoff@0.1.0;
}
package liberas:host@0.1.0 {
  interface random {
    bytes: func(n: u32) -> list<u8>;
  }
}


package liberas:agent@0.1.0 {
  interface backoff {
    delay: func(attempt: u32, base: u32, cap: u32) -> u32;
  }
}
Test vectors9›
agent-backoff.cases.json
[
  {
    "args": {
      "cap": 10000,
      "base": 100,
      "attempt": 0
    }
  },
  {
    "args": {
      "cap": 10000,
      "base": 100,
      "attempt": 0
    }
  },
  {
    "args": {
      "cap": 10000,
      "base": 100,
      "attempt": 0
    }
  },
  {
    "args": {
      "cap": 10000,
      "base": 100,
      "attempt": 3
    }
  },
  {
    "args": {
      "cap": 10000,
      "base": 100,
      "attempt": 10
    }
  },
  {
    "args": {
      "cap": 1000,
      "base": 7,
      "attempt": 40
    }
  },
  {
    "args": {
      "cap": 4294967295,
      "base": 4000000000,
      "attempt": 31
    }
  },
  {
    "args": {
      "cap": 0,
      "base": 0,
      "attempt": 0
    }
  },
  {
    "args": {
      "cap": 600,
      "base": 250,
      "attempt": 2
    }
  }
]
Versions (units)1›
  1. v1by dave792f70c46fstable 5.1.0latestconfirmed10/23/2026
Verification8›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 9 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Asks the host for random. In verification the host's answers come from the case (its `host`: clock values, random bytes, the store's keys) or a seeded stream and an empty store, so every implementation sees the same world; a live call records what the host answered and what it wrote, and the shadow check replays it. What a call leaves in the store is compared like its output.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 100,000,000 instructions.
  • Already built: a component that passes and uses at most 0.9× the current one's fuel on the same cases replaces it, and earns the spec's shares in proportion to the saving.
  • Found an input where the current component disagrees with the spec? Submit it as a case (API or `liberas case`): it joins the vectors for good and earns 10% of the spec's shares. A component that then passes replaces the broken one for 25%.