The Social Agent is the main class for creating social agents in the simulation. In this section, we will introduce how to create a SocialAgent
.
SocialAgent
classChatAgent
. It can perform actions on social media (e.g., posting), use external tools (such as Google Search), and has features like user information and a memory module.
When initializing a SocialAgent
, you can configure the following core parameters:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
agent_id | int | ✔ | - | The unique ID of the agent, used as the primary key to distinguish different agents. Each SocialAgent must have a unique agent_id . |
user_info | UserInfo | ✔ | - | A dataclass containing the agent’s user registration info. For more details, see UserInfo. |
user_info_template | TextPrompt | ✗ | None | A text template that describes the agent when deciding what action to take. If None , a default prompt template will be selected based on recsys_type in UserInfo . |
agent_graph | AgentGraph | ✔ | - | The AgentGraph instance that the SocialAgent belongs to. |
model | BaseModelBackend or List[BaseModelBackend] or ModelManager or None | ✗ | None | The llm model(s) to be used for the agent’s actions. If None , the gpt-4o-mini model will be used. |
available_actions | list[ActionType] or None | ✗ | None | List of allowed actions in the social platform. For more details, see Actions Module. If None , all actions are enabled by default. |
tools | List[Union[FunctionTool, Callable]] or None | ✗ | None | External tools the agent can use, such as a get_weather function, a Toolkit , or an MCPToolkit from CAMEL. If set to None , the agent will not be able to use any external tools. |
single_iteration | bool | ✗ | True | Whether the agent performs only a single round of reasoning when taking an LLM action. If False , the agent may continue acting based on the outcome of previous actions or tool calls. |
interview_record | bool | ✗ | False | Whether to record the interview prompt and result in the agent’s memory. |
model
and the tools
parameter, see Models Module and Toolkits Module.
UserInfo
classuser_name
, name
, and description
must not be empty. The profile
field is a dictionary whose keys must match those specified in user_info_template
.
user_info_template
and corresponding UserInfo.profile
class: