3030from concordia .typing import entity_component
3131from concordia .typing import prefab as prefab_lib
3232from concordia .typing import simulation as simulation_lib
33+ from concordia .utils import structured_logging
3334import numpy as np
3435
3536
@@ -241,7 +242,7 @@ def play(
241242 raw_log : list [Mapping [str , Any ]] | None = None ,
242243 checkpoint_path : str | None = None ,
243244 verbose : bool = False ,
244- ) -> str :
245+ ) -> structured_logging . SimulationLog :
245246 """Run the simulation.
246247
247248 Args:
@@ -255,7 +256,8 @@ def play(
255256 verbose: Whether to print verbose output.
256257
257258 Returns:
258- JSON string of the raw simulation log.
259+ SimulationLog object with structured data. Use .to_html() for HTML output
260+ or .to_json() for JSON serialization.
259261 """
260262
261263 logging .info ("[QuestionnaireSimulation] Starting simulation." )
@@ -301,7 +303,7 @@ def play(
301303 finally :
302304 self ._engine .shutdown ()
303305 logging .info ("[QuestionnaireSimulation] Simulation finished." )
304- return json . dumps (raw_log , indent = 2 )
306+ return structured_logging . SimulationLog . from_raw_log (raw_log )
305307
306308 def save_checkpoint (self , step : int , checkpoint_path : str ):
307309 """Saves the state of all entities at the current step."""
0 commit comments