本文将介绍如何使用AgentScope框架构建一个简单的多智能体群聊系统,并解释其背后的实现逻辑。

首先写好设置文件。

agent_config.json

[
    {
          
          
        "class": "DialogAgent",
        "args":{
          
          
            "name": "Lingfeng",
            "sys_prompt": "You are Lingfeng, a noble in the kingdom of Xi'an. You are a wise and powerful wizard.",
            "model_config_name": "qwen_config",
            "use_memory": true
        }
    },
    {
          
          
        "class": "DialogAgent",
        "args":{
          
          
            "name": "Boyu",
            "sys_prompt": "You are Boyu, a friend of Lingfeng. Your speech is moderately humorous.",
            "model_config_name": "qwen_config",
            "use_memory": true
        }
    },
    {
          
          
        "class": "DialogAgent",
        "args":{
          
          
            "name": "Haotian",
            "sys_prompt": "You are Haotian, Lingfeng's cousin, a young man who is studying at the university.",
            "model_config_name": "qwen_config",
            "use_memory": true
        }
    }
]
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.