agentsociety.simulation.agentsociety

A clear version of the simulation.

Module Contents

Classes

AgentSociety

Factory class for creating simulation engines based on configuration type.

Data

API

agentsociety.simulation.agentsociety.__all__

[‘AgentSociety’]

class agentsociety.simulation.agentsociety.AgentSociety(config: Union[agentsociety.configs.Config, agentsociety.configs.IndividualConfig], tenant_id: str = '')

Factory class for creating simulation engines based on configuration type.

  • Description:

    • A factory class that creates and returns the appropriate engine instance based on the configuration type provided.

    • Returns SimulationEngine for Config type

    • Returns TaskSolverEngine for SolverConfig type

Initialization

Initialize AgentSociety factory class.

  • Description:

    • This constructor is kept for backward compatibility but is deprecated.

    • Use AgentSociety.create() static method instead.

  • Args:

    • config (Union[Config, IndividualConfig]): The configuration object.

    • tenant_id (str, optional): The tenant ID. Defaults to “”.

static create(config: Union[agentsociety.configs.Config, agentsociety.configs.IndividualConfig], tenant_id: str = '') Union[agentsociety.simulation.simulationengine.SimulationEngine, agentsociety.simulation.individualengine.IndividualEngine]

Create and return the appropriate engine instance based on configuration type.

  • Description:

    • Factory method that creates the appropriate engine instance based on the configuration type provided.

    • For Config type: returns SimulationEngine instance

    • For IndividualConfig type: returns IndividualEngine instance

  • Args:

    • config (Union[Config, IndividualConfig]): The configuration object that determines which engine to create.

    • tenant_id (str, optional): The tenant ID for the engine. Defaults to “”.

  • Returns:

    • Union[SimulationEngine, IndividualEngine]: The appropriate engine instance based on the configuration type.

  • Raises:

    • ValueError: If the configuration type is not supported.

__getattr__(name)

Delegate attribute access to the underlying engine instance.

  • Description:

    • Delegates any attribute access to the underlying engine instance for backward compatibility.

  • Args:

    • name (str): The name of the attribute to access.

  • Returns:

    • The attribute value from the underlying engine.