Skip to main content

Two ways to create an AgentGraph:

  • Option 1: Create an AgentGraph from a csv or json file, which contains the agent profiles.
  • Option 2: Create an empty AgentGraph and 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 SocialAgent by agent_id.
  • Parameters:
    • agent_id: The agent_id of the SocialAgent to get.
  • Returns:
    • SocialAgent: The SocialAgent with the given agent_id.
  • Example:

2. agent_graph.get_all_agents()

  • Description: Get all SocialAgent in the AgentGraph.
  • Parameters:
    • None
  • Returns:
    • list[tuple[int, SocialAgent]]: A list of tuples, each containing an agent_id and the corresponding SocialAgent.
  • Example:

3. agent_graph.get_num_nodes()

  • Description: Get the number of SocialAgent in the AgentGraph.
  • Parameters:
    • None
  • Returns:
    • int: The number of SocialAgent in the AgentGraph.
  • Example: