Skip to contents

A society is the static apparatus an interaction simulation runs on: the agent_population() (its actors), an edge list (who may see whom), an optional set of measurement functions, and an initially empty shared transcript that step_interaction() grows one round at a time. It holds no results until you step it.

Usage

society(population, network = NULL, measures = NULL)

# S3 method for class 'society'
print(x, ...)

Arguments

population

An agent_population().

network

Who may interact with whom. NULL (default) means fully connected. Otherwise a two-column edge list (a data.frame or matrix) of agent ids or integer indices, or an igraph graph (its edge list is read via igraph::as_edgelist() when the package is installed).

measures

Optional named list of function(agent) -> value, applied by collect_measures().

x

A society.

...

Ignored.

Value

An object of class society: a list with population, edges (a tibble from, to), measures, history (a tibble turn, step, speaker, text), and step (the round counter, 0L initially).

Details

The network constrains co-presence, not the engine. An edge between two agents records that they are connected; exposure_matrix() reads the edges as "who could see whom". The current stepping rule keeps the transcript fully shared (every speaker sees the whole history) while still recording the connectivity, so the exposure structure is available for analysis even before a stricter visibility rule is added.

Examples

if (FALSE) { # \dontrun{
cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b")
pop <- agent_population(c("A.", "B.", "C."), config = cfg)
soc <- society(pop, network = data.frame(from = c("p1"), to = c("p2")))
soc <- step_interaction(soc, prompt = "Introduce yourself in one line.")
collect_measures(soc)
} # }