Assemble a list of Agents from several kinds of input, the way an
agent-based study defines its actors. agent_population() accepts
several input forms and returns one strict output: whatever you pass,
you get back a flat list of constructed agents with stable ids.
Usage
agent_population(personas, n = NULL, config = NULL)
# S3 method for class 'agent_population'
print(x, ...)Arguments
- personas
Pre-built agents, a
persona_set, a character vector of briefs, or a single persona (frame or string) to replicate.- n
Number of copies when
personasis a single persona; ignored otherwise.- config
An
LLMR::llm_config()used to build agents. Required unlesspersonasis already a list of Agents.- x
An
agent_population.- ...
Ignored.
Value
An object of class agent_population: a list with agents (a list
of Agents), ids (their agent ids), and n (the count).
Details
personas may be:
a list of pre-built Agents, used as is (no
configneeded);a
persona_variants()result (apersona_set), one agent per row, each built from that row'spersona_frame();a character vector of persona briefs, one agent each;
a single
persona_frame()or string withn > 1, replicated intonagents namedp1 ... pn.
A population is scaffolding, not a sample: it inherits every limit of the
personas it is built from. Pair it with persona_audit() before reading any
result as if it spoke for the people the briefs sketch.
Examples
if (FALSE) { # \dontrun{
cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b")
pop <- agent_population(
c("A cautious retiree.", "A risk-tolerant founder."), config = cfg)
pop
} # }