All demosAgent Swarm

Agent Swarm

Hungry agents. One arena. Lots of tiny decisions.

Examples are free. Bring a key for your own inputs. Get a free key

Performance & cost

This session

Ready to run
Delivery time · median
—
Live model compute
—
Live input tokens
0
Est. cost · USD
$0.00

Bypass examples to measure live inference. Uses your quota.

Measurement details · 0 successful requests
Successful requests
0

Run an example for free to see its measurements.

Model compute is the average per measured request. Delivery time is the median browser time for successful requests, including queue, network, and retries. Cached delivery speed is not inference speed. Model compute can exceed browser time when one request processes many inputs.

Tokens come from response headers. Inference costs use $0.04 per million input tokens, before plan credits. The estimate includes live and recorded tokens at the same rate; cached examples are not charged again. Missing usage is unavailable or a partial total (≥). Demo resets keep these totals; reload to start a new session.

Try it

Run the swarm and watch what each agent does.

Build with the SDKTypeScript · Python · dm1

One request from this demo. Copy it into your app.

Uses your MS_API_KEY and quota. Keep the key on your server.

Install · set your key
npm install @cloudraker/milliseconds
export MS_API_KEY="your-api-key"
example.ts
import { DecisionMachine } from "@cloudraker/milliseconds";

// Run on your server; reads MS_API_KEY from the environment.
const dm = new DecisionMachine();

const { result, usage } = await dm.yesNo(
  [
    "You are the biggest thing in sight. A smaller agent wanders far off, to your SE. Food sits at your mouth, to your NW. Your boost is charged.",
    "You are the biggest thing in sight. You see nothing small enough to swallow. Food sits at your mouth, to your SW. Your boost is charged.",
    "A bigger agent prowls in the distance, to your N. You see nothing small enough to swallow. Food sits at your mouth, to your E. Your boost is charged.",
    "A bigger agent prowls in the distance, to your W. You see nothing small enough to swallow. Food sits at your mouth, to your SW. Your boost is charged.",
    "A bigger agent prowls in the distance, to your E. You see nothing small enough to swallow. Food sits at your mouth, to your W. Your boost is charged.",
    "A bigger agent prowls in the distance, to your W. You see nothing small enough to swallow. Food sits at your mouth, to your SE. Your boost is charged.",
    "A bigger agent prowls in the distance, to your NW. You see nothing small enough to swallow. Food sits at your mouth, to your S. Your boost is charged.",
    "You are the biggest thing in sight. A smaller agent wanders far off, to your E. Food sits at your mouth, to your E. Your boost is charged."
  ],
  "This agent should break off and run.",
  {
    "when_true": "a bigger agent is closing on this one or almost on it",
    "when_false": "this one is the biggest thing in sight, or the bigger agent only prowls in the distance"
  }
).withUsage();

console.log(result);
console.log({ inputTokens: usage.inputTokens, modelMs: usage.inferenceMs });

Under the hood How it works & limitations

API calls/yes-no

How it works

Each agent’s surroundings are described in text. Batched model checks assess danger, nearby prey and whether a boost is useful. Local code handles movement, collisions and cooldowns.

Demo scope

The arena is simulated. Personality labels identify agents but do not affect the model’s decisions. If an answer becomes stale, local movement rules keep the simulation running.

Inspired by the work of dabit3.