mirror of
https://github.com/agentuniverse-ai/agentUniverse.git
synced 2026-02-09 01:59:19 +08:00
3.8 KiB
3.8 KiB
背景
对于使用agentUniverse包版本小于等于0.0.13的用户,我们鼓励您将包版本升级到0.0.14。
0.0.14版本的agentUniverse在原有框架功能基础上做了架构升级,增加了智能体模版、工作模式等新智能体构建范式,并提供了新的aU示例工程examples以及升级后的标准应用工程结构。
本篇文章为迁移指南,帮助用户更快捷的完成aU版本升级工作。
新标准应用工程结构
0.0.14版本,我们推荐的标准应用工程结构如下,每个层级包目录具体含义请参见标准应用工程结构说明:
/
├── bootstrap/
│ ├── intelligence/
│ │ └── server_application.py
│ ├── platform/
│ │ └── product_application.py
├── intelligence/
│ ├── agentic/
│ │ ├── agent
│ │ │ └── agent_instance
│ │ │ └── agent_template
│ │ ├── knowledge
│ │ │ └── store/
│ │ │ └── rag_router/
│ │ │ └── doc_processor/
│ │ ├── llm
│ │ ├── prompt
│ │ ├── memory
│ │ ├── tool
│ │ └── work_pattern
│ ├── service/
│ │ └── agent_service
│ │ └── classic_service
│ ├── dal/
│ ├── integration/
│ ├── utils/
│ └── test/
├── platform/
├── config
├── pyproject.toml
└── other project files...
我们考虑到新老工程目录结构迁移存在一定成本,提供了便捷的迁移脚本,方便您参考使用au_dir_structure_updater。
脚本使用步骤:
- 将脚本文件移动到您的应用根目录下,例如您的应用根目录为sample_standard_app,则将au_dir_structure_updater.py文件移动到sample_standard_app下。
- 启动脚本文件,脚本文件会创建新目录结构dir(create_directory_structure方法)。
- 之后根据脚本文件中配置的migration_rules(您可自定义添加或删除migration_rules),迁移老工程文件到新目录结构(migrate_files方法)。
- 迁移过程会同时更新新yaml文件中的metadata路径,以及各python文件中的import package路径。
- 更改config.toml中的包扫描路径,参考sample_config中的CORE_PACKAGE。
- 运行本地测试文件,校验智能体是否运行成功。
智能体模版
0.0.14版本中我们推荐您使用智能体模版功能替代原aU中的planner计划组件,智能体模版具体原理参见文档:agentTemplate。
当智能体执行流程存在很强的复用性,我们可以将其从agent的execute方法中抽象出来,封装成标准的智能体模版,方便后续的复用与共享。
当前0.0.14版本agentUniverse沉淀了如PeerAgentTemplate/RagAgentTemplate/ReActAgentTemplate等多种智能体模版,您只需要配置化即可实现开箱即用。
使用智能体模版构建智能体可参见文档:沉淀与使用智能体模版。
工作模式
aU中的工作模式为智能体模版再上一层级抽象,具体原理档参见文档:workPattern,agentUniverse中内置的工作模式为PeerWorkPattern。