run_simulation

readSince v1.0

Run the simulation and read back the COMPUTED time series for a scenario. Unlike get_time_series (which returns only stored input cells — manual entry or live data), this evaluates the Rhai property formulas and act scripts on demand and returns the resulting per-agent, per-property, per-timestep values, each with its simulated time, plus formula diagnostics. This is the only way to read formula-driven results via the API: they are computed on the fly and never persisted. scenario_id is required; parameter_set_id defaults to the scenario's twin's default parameter set. Use agent_instance_id, property_id, min_timestep, and max_timestep to scope large series. Check the diagnostics field (formula/act-script compile and runtime errors, cycles, unresolved dependencies) when results look wrong or empty.

What-if overrides (per run, never persisted). To try custom inputs without changing the saved scenario, pass either or both of:

  • parameter_overrides — an array of {agent_instance_id, property_id, value} that replace individual agent baseline values (e.g. a different starting capital, price, or rate).
  • time_series_overrides — an array of {agent_instance_id, property_id, values, start_timestep?} that replace a property's entire trajectory over the run. values is one entry per timestep, starting at start_timestep (default 0); later timesteps carry the last value forward.

Both are layered on top of the resolved parameter_set_id and apply to that single run only — they are computed against a throwaway copy of the model, so nothing is written back. property_id accepts a property name or its ID. This is the right way to run user-entered values: there is no need to call set_parameter_value or update_agent first, and the base scenario is left untouched. Overrides that reference an unknown agent or property are skipped.

Example Request

{"scenario_id": "scenario-uuid", "agent_instance_id": "brewery-uuid", "property_id": "revenue_this_tick", "parameter_overrides": [{"agent_instance_id": "policy-uuid", "property_id": "selling_price", "value": "400"}]}

Example Response

{"scenario_id": "scenario-uuid", "parameter_set_id": "default", "total_count": 24, "returned_count": 24, "rows": [{"agent_instance_id": "agent-uuid", "property_id": "prop-uuid", "timestep_index": 0, "time": 1.0, "value": 600000.0}], "diagnostics": []}