Two ways to create an AgentGraph:
- Option 1: Create an
AgentGraphfrom acsvorjsonfile, which contains the agent profiles. - Option 2: Create an empty
AgentGraphand add each customized agent.
Option 1: Create an AgentGraph from the agent profile files
We support initializing the AgentGraph using a file that stores agent profiles. In addition, you need to specify the LLM model used by all agents and the set of available social actions.
The parameters for these two functions are as follows:
Example of initializing an AgentGraph from a profile file
- Twitter user profile style
- Reddit user profile style
Option 2: Create an empty AgentGraph and customize each agent
Step 1: Create an empty AgentGraph
Step 2: Add each customized agent to the AgentGraph
You can initialize some social agents and add them to the AgentGraph.
For more details on how to customize the SocialAgent class, see Social Agent Module.
Other Methods of AgentGraph
1. agent_graph.get_agent(agent_id)
- Description: Get an
SocialAgentbyagent_id. - Parameters:
agent_id: Theagent_idof theSocialAgentto get.
- Returns:
SocialAgent: TheSocialAgentwith the givenagent_id.
- Example:
2. agent_graph.get_all_agents()
- Description: Get all
SocialAgentin theAgentGraph. - Parameters:
- None
- Returns:
- list[tuple[int, SocialAgent]]: A list of tuples, each containing an
agent_idand the correspondingSocialAgent.
- list[tuple[int, SocialAgent]]: A list of tuples, each containing an
- Example:
3. agent_graph.get_num_nodes()
- Description: Get the number of
SocialAgentin theAgentGraph. - Parameters:
- None
- Returns:
- int: The number of
SocialAgentin theAgentGraph.
- int: The number of
- Example: