% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/multiagent.R
\name{run_multiagent_rem}
\alias{run_multiagent_rem}
\title{Run a multi-agent REM-LLM conflict simulation}
\usage{
run_multiagent_rem(
  edgelist,
  rem_fit,
  cfg,
  n_ticks,
  lambda = NULL,
  base_riskset = NULL,
  cold_start = FALSE,
  seed = 8214L,
  checkpoint_path = NULL,
  covariates = NULL
)
}
\arguments{
\item{edgelist}{Prepared edgelist -- used to infer the node set and
optionally as the seed event.}

\item{rem_fit}{Fitted \code{coxph} object (from \code{\link[=fit_rem]{fit_rem()}}).}

\item{cfg}{A single \code{\link[=rem_cfg]{rem_cfg()}} shared across all agents.
Sender identity is injected dynamically at each query.}

\item{n_ticks}{Number of simulation ticks.}

\item{lambda}{Mean events per tick (Poisson rate). Estimated from
\code{edgelist} inter-event times if \code{NULL}.}

\item{base_riskset}{Precomputed base risk set. Built from \code{edgelist} if
\code{NULL}.}

\item{cold_start}{If \code{TRUE}, begin with a uniform hazard surface rather
than seeding from the first empirical event. Cold-start runs have a burn-in
period before endogenous structure accumulates.}

\item{seed}{RNG seed.}

\item{checkpoint_path}{File path for incremental saves every 10 ticks.
\code{NULL} disables checkpointing. Existing checkpoint is resumed automatically.}

\item{covariates}{Optional exogenous covariate list from \code{\link[=rem_covariates]{rem_covariates()}}.
Passed to \code{\link[=fit_rem]{fit_rem()}} when computing the hazard surface.}
}
\value{
A named list:
\describe{
\item{\code{sequence}}{Data frame of generated events (time, sender, receiver,
eveid).}
\item{\code{sender_probs}}{\code{n_ticks} x \code{N} matrix of activation probabilities
\eqn{p_i(t)} at each tick.}
\item{\code{n_events_per_tick}}{Integer vector of \eqn{K_t} values.}
}
}
\description{
At each tick, the REM hazard surface determines who acts (sender activation),
and individual LLM agents decide against whom (receiver selection). The two
components are complementary: the REM enforces endogenous structure; the LLM
contributes identity-conditioned content.
}
\examples{
\dontrun{
data(edgelist)
el  <- prepare_edgelist(edgelist)
fit <- fit_rem(el[1:200, ],
  survival::Surv(time1, occurred) ~ Repetition + Recencylog +
    survival::strata(time2),
  n_nonevents = 50L, method = "cox")
cfg <- rem_cfg(
  provider    = llm_provider_openai(),
  context     = "Conflict events between states.",
  action_verb = "attacked",
  actor_noun  = "Country"
)
sim <- run_multiagent_rem(el[1:200, ], fit, cfg, n_ticks = 5L)
head(sim$sequence)
}
}
