Skip to content

Populations

A population is a contiguous share of a campaign's agents, run together. It has:

  • an AsyncFlow engine of its own, on which every task tool of its agents runs, so every simulation is an AsyncFlow task with RHAPSODY's records;
  • a Flowgentic agent host, which starts its agents in batches, caps how many are live at once, and resumes those that suspended once their tasks end;
  • a runner for the agents' kind: Flowgentic's LoopRunner for tool-calling agents, AUTONMI's own for scripted ones (see Agent definitions);
  • a fleet of model replicas, with this population's share of each replica's admission caps (see Services);
  • the campaign's store, and a client of one of the tool services.

The campaign makes CampaignConfig.populations of them and runs each as one node of the mini-app's graph. PopulationConfig (CampaignConfig.population) sets how each runs; the campaign fills in share, host and gpus per population, and under Dragon backend and otel. Each field's contract is in the API reference.

Where it runs

runtime="local" (default) runtime="dragon"
The population an AsyncFlow block, in the mini-app's process an AsyncFlow function task that RHAPSODY's native backend starts as a Dragon process of its own
Its engine RHAPSODY's Concurrent backend: a thread pool of workers, an executor, or one process pool per GPU RHAPSODY's native Dragon backend, with workers pool workers
The store a dictionary in the process RaDEX, opened by its spec
Its tool service a thread, on queue.Queues a Dragon process, on Dragon queues
Flowgentic's export otel/, shared by every population otel/p<index>/, one per population, merged by the assembly

Locally, PopulationConfig.executor names a factory, "module:function" of workers, that returns the simulations' executor: "autonmi.pools:spawn_pool" gives spawned processes that see no GPU, for simulations that must not share the agents' process. Under Dragon executor and reuse_event_loop are not used, and the campaign warns.

Which settings apply where

Most of PopulationConfig applies to both runtimes and both kinds of agent. These do not:

Settings Where they apply
executor, reuse_event_loop locally only
host, node_samplers, otel under Dragon; the campaign sets host and otel
gpus both; under Dragon a population of tool-calling agents takes one GPU, and scripted agents may take several of their node's
retries, max_retries scripted agents only; a population of tool-calling agents warns about max_retries and does not use it
stub_replicas without model only
reply_reserve with token admission only (cap_tokens above 0)

The agent host

Setting Default What it does
max_live None: every agent agents live at once, suspended ones included
stagger_batch, stagger_interval_s 100, 0.5 s the first wave of agents, up to max_live, starts in batches, one batch per interval; later agents start as places free up
gc_threshold 100,000 the collector's first threshold (Flowgentic's Collector)

An agent that suspends while its task runs keeps only its id and its tasks' futures in the population: its state is in the store, and the host resumes it when every task it named has ended. It still counts toward max_live.

What a population writes

Once every agent has ended, the population writes into the run directory, where p<index> is p and its index in three digits (p000, p001, ...):

  • app/agents-p<index>.jsonl: one row per agent, the application's fields and AUTONMI's;
  • populations/p<index>/population.json: its stats: agents by how they ended, the host's states and loop lag, the runner's counts, its tasks, its fleet calls, model outages, tasks lost to dead workers, the node it ran on;
  • populations/p<index>/rhapsody/: its engine's RHAPSODY checkpoint.

The run directory lists every file.

Telemetry per population

With rhapsody_telemetry=True (the default) each population's engine has RHAPSODY's telemetry and a part of the run's MiniApp. rhapsody_telemetry=False runs without them, to measure what they cost: no checkpoint and no part, and the run's checks leave the population's tasks out.

Under Dragon, RHAPSODY's telemetry starts a sampler on every node for each backend. node_samplers decides it for the populations: None (the default) samples on one node and not across nodes, where every population would sample every node and the mini-app's engine already does.

Caveats

  • A population cannot resume elsewhere: if its process dies, the run fails.
  • Under Dragon each population is a process of its own; locally every population shares the mini-app's process and its event loop.
  • reuse_event_loop (one event loop per worker thread) needs a RHAPSODY whose Concurrent backend takes it; with another, the population raises TypeError as it starts.