All demosSwarm: 32 agents, one API

Swarm: 32 agents, one API

An arena of up to 32 agents where every agent's next move, chase and boost is judged live by decision-machine-1, two batched calls a second, next to code bots playing the same board.

/yes-no

How it works

The original Jev experiment asked three typed questions per agent, every 400 ms: move (one of nine compass directions, each option described by what lay that way), boost (a 0-to-1 number), and target (which nearby entity to pursue, the options named per agent). Thirty-two agents at eight per request came to about nine requests a second.

Here the whole swarm shares one request per question. Batch labels are the same for every text, so the per-agent option lists cannot go in the labels; and decision-machine-1 scores meaning rather than tables, so a dump of pixel distances reads as noise to it. The code therefore writes each agent's scene as short sentences — A bigger agent is closing on you from the E. A smaller agent is within one lunge, to your N. Food sits at your mouth, to your SW. Your boost is charged. — and asks three yes/no questions about that scene:

  • move → POST /yes-no, statement "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". The scene sent for it is the scene above, with no personality sentence in it: the temperament steers nothing on the wire.
  • target → POST /yes-no, statement "A smaller agent is close enough to run down right now.", when_true "the text puts a smaller agent within one lunge or a short chase away", when_false "the text says nothing small enough to swallow is in sight, or the smaller agent wanders far off".
  • boost → POST /yes-no, statement "Spending the speed burst on this scene is worth it.", when_true "a bigger agent is almost on this one, or a smaller agent is within one lunge", when_false "the other agents prowl in the distance or wander far off, or none is in sight". The cooldown is not in the question at all: it is code, and only agents whose boost is off cooldown are put in that batch.

Each call carries one texts array with one scene per living agent, up to the batch limit of 32, and returns one probability per agent in input order. That ceiling is why the agent count is a capped select, 8 to 32, rather than the free slider the arena would otherwise take. Every tick sends the run question plus one of the other two, alternating, and each question holds a single in-flight slot: a tick that finds the previous call still out skips it, so the 500 ms setting self-throttles to whatever the API returns instead of queueing a backlog against the page-wide limit of two calls a second. Stop, reset and leaving the page abort every request still on the wire.

The probabilities become one action — run from the nearest bigger agent above 0.7, chase the nearest smaller one above 0.6, otherwise go and eat, and spend the boost above 0.7 — and the code keeps the physics, the collisions, the 60 Hz heading and the boost cooldown. The code only acts on what the scene reported: an agent more than 400 px away was described to the model as not there at all, so it cannot become a target however the answer reads, and running is gated tighter still, at 200 px, because that is the distance the words closing on you stand for — a bigger agent that only prowls in the distance is scenery, not a reason to turn your back on prey within one lunge. Answers older than an agent's newest decision are dropped as stale and never reach the table, and an agent with no fresh answer for four seconds falls back to the greedy code policy, the same one the grey square bots run all the time.

Measured on this seed world: every question reads the geometry, and none of them reads the temperament, because no scene carries it. Run climbs 0.51 → 0.61 → 0.83 → 0.93 as a predator closes from 600 px to 250, 120 and 40, so 0.7 sits in the gap between a prowler and a hunter. Chase answers 0.98 with prey within one lunge, 0.99 a short chase away, 0.29 when it wanders far off, 0.47 with nothing in sight. Boost answers 0.88 at contact range against 0.23 on a quiet field. The style sentence came out of all three scenes because it swamped them: with it in, an aggressive agent answered 0.95 to the chase question with no prey in sight, and a trickster answered 0.66 to the run question with nothing near but a distant prowler — the columns disagreed with the arena. The personality still picks the colour and the story; it just does not vote. Runs stop themselves after 60 seconds, because the demo key allows about two requests a second for everyone on the site at once.

Ported from the jev-swarm Jev experiment. Every request here is live; the shared demo key allows about 2 requests per second across all visitors.