目录
搭建复杂游戏应用
多智能体应用
- 解谜小说游戏应用
- 利用文字和图片 多模态丰富体验
- 通过对话,线索进行斗智斗勇
- 编剧助手
- 零代码开发,根据自己想象力创造游戏
快速回顾多智能体应用
- 在Multi-Agent应用中,开发分为两个部分
- 构建Agent间通信 · 实现Agent内逻辑
- AgentScope中,信息的载体被统一抽象成“消息(message)"
- 不同信息的传递方式
复杂应用搭建教学
- 0代码搭建自定义《谜馔》游戏
- 狼人杀实现的深入探究
0代码实现《谜馔》
- 架构简介 – 谜馔
- 架构简介 – 谜馔
- 核心组件详解
- NPC智能体(Customer)
- 基于 Stateful agent
- 根据状态调整 prompting&记忆
- 其他feature:
- 根据好感度调整记忆
- 以npc在游戏中的视 角生成故事
- 完成任务后自动调整 人物背景
- 用户智能体
- 基于 User agent
- 作为玩家的proxy
- 其他feature:
- 和大模型配合生成菜品
- 让大模型检查输入,确 保玩家输入不会偏离游 戏主题太远
- 任务完成监测
- NPC智能体(Customer)
- 核心组件详解
customer.py
class Customer (StateAgent, DialogAgent) :
def __ init __ (self, game_config: dict, ** kwargs: Any) :
# register states with the handlers, so that self. reply ( ... ) # can automatically switch answer-generation functions self.register_state( state=CustomerConv.OPENING, handler=self ._ opening_chat,)
self.register_state(state=CustomerConv.
AFTER_MEAL_CHAT, handler=self ._ main_plot_chat,
def _opening_chat(self, x: dict) -> dict:
def _main_plot_chat(self, x: dict) - dict:
def _relation_to_clues () :
# 根据角色好感动控制agent记忆中、对话中的线索
def generate_pov_story( ... ):
# 根据剧情 + 玩家游戏过程,生成一段故事
def refine_background(self) :
# 完成一个剧情后自动调整角色背景,为下一剧情做准备
用户智能体
class RuledUser (AgentBase) :
def __ init __ ( ... ):
def reply ( ... ) :
content = get_player_input ( ... ) # 规范化用户输入
ruler_res = self. is_content_valid(content)
def cook () :
# 玩家做菜功能
def success_detector(condition, announcement) :
# 动态监测发言是否满足通关条件
- APP分支下进行魔改开发
- 需要配置剧情和角色
实现狼人杀
- 通过json控制Agent参数配置
- 为每个角色分配变量
- 采用message-hub实现群聊