agentsociety.configs.exp¶
Module Contents¶
Classes¶
Defines the types of workflow steps in the simulation. |
|
Configuration for filtering agents. |
|
Represents a step in the workflow process. |
|
Main configuration for the experiment. |
Data¶
API¶
- agentsociety.configs.exp.__all__¶
[‘WorkflowStepConfig’, ‘EnvironmentConfig’, ‘ExpConfig’, ‘WorkflowType’, ‘AgentFilterConfig’]
- class agentsociety.configs.exp.WorkflowType¶
-
Defines the types of workflow steps in the simulation.
Description:
Enumerates different types of workflow steps that can be executed during simulation.
Types:
STEP: Execute on a step-by-step unit.RUN: Execute on a daily unit (day-based execution).INTERVIEW: Sends an interview message to the specified agent.SURVEY: Sends a questionnaire to the specified agent.ENVIRONMENT_INTERVENE: Changes the environment variables (global prompt).UPDATE_STATE_INTERVENE: Directly updates the state information of the specified agent.MESSAGE_INTERVENE: Influences the agent’s behavior and state by sending a message.NEXT_ROUND: Proceed to the next round of the simulation —— reset agents but keep the memory.DELETE_AGENT: Delete the specified agents.SAVE_CONTEXT: Save the context of the specified agents.INTERVENE: Represents other intervention methods driven by code.FUNCTION: Represents function-based intervention methods.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- STEP¶
‘step’
- RUN¶
‘run’
- INTERVIEW¶
‘interview’
- SURVEY¶
‘survey’
- UPDATE_STATE_INTERVENE¶
‘update_state’
- MESSAGE_INTERVENE¶
‘message’
- DELETE_AGENT¶
‘delete_agent’
- ENVIRONMENT_INTERVENE¶
‘environment’
- NEXT_ROUND¶
‘next_round’
- SAVE_CONTEXT¶
‘save_context’
- INTERVENE¶
‘other’
- FUNCTION¶
‘function’
- class agentsociety.configs.exp.AgentFilterConfig¶
Bases:
pydantic.BaseModelConfiguration for filtering agents.
- agent_class: Optional[Union[tuple[type[agentsociety.agent.Agent]], list[str]]]¶
None
The class of the agent to filter
- validate_func()¶
- class agentsociety.configs.exp.WorkflowStepConfig¶
Bases:
pydantic.BaseModelRepresents a step in the workflow process.
- model_config¶
‘ConfigDict(…)’
- type: agentsociety.configs.exp.WorkflowType¶
‘Field(…)’
The type of the workflow step
- func: Optional[Union[collections.abc.Callable, str]]¶
None
The function that extracts the metric - used for [FUNCTION] type
- ticks_per_step: int¶
300
Number of ticks per step - used for [RUN, STEP] type. For example, if it is 300, then the step will run 300 ticks in the environment.
- target_agent: Optional[Union[list[int], agentsociety.configs.exp.AgentFilterConfig]]¶
None
List specifying the agents targeted by this step - used for [INTERVIEW, SURVEY, UPDATE_STATE_INTERVENE, MESSAGE_INTERVENE, DELETE_AGENT, SAVE_CONTEXT] type
- interview_message: Optional[str]¶
None
Optional message used for interviews during this step - used for [INTERVIEW] type
- survey: Optional[agentsociety.survey.Survey]¶
None
Optional survey instance associated with this step - used for [SURVEY] type
- key: Optional[str]¶
None
Optional key identifier for the step - used for [ENVIRONMENT_INTERVENE, UPDATE_STATE_INTERVENE, SAVE_CONTEXT] type
- value: Optional[Any]¶
None
Optional value associated with the step - used for [ENVIRONMENT_INTERVENE, UPDATE_STATE_INTERVENE] type
- intervene_message: Optional[str]¶
None
Optional message used for interventions - used for [MESSAGE_INTERVENE] type
- serialize_func(func, info)¶
- validate_func()¶
- class agentsociety.configs.exp.ExpConfig¶
Bases:
pydantic.BaseModelMain configuration for the experiment.
- model_config¶
‘ConfigDict(…)’
- workflow: List[agentsociety.configs.exp.WorkflowStepConfig]¶
‘Field(…)’
List of workflow steps
- environment: agentsociety.environment.EnvironmentConfig¶
None
Environment configuration
- serialize_id(id, info)¶