Files
agentUniverse/docs/guidebook/zh/开始使用/6.aU新老工程迁移指南.md

67 lines
3.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 背景
对于使用agentUniverse包版本小于等于0.0.13的用户我们鼓励您将包版本升级到0.0.14。
0.0.14版本的agentUniverse在原有框架功能基础上做了架构升级增加了智能体模版、工作模式等新智能体构建范式并提供了新的aU示例工程[examples](../../../../examples)以及升级后的标准应用工程结构。
本篇文章为迁移指南帮助用户更快捷的完成aU版本升级工作。
## 新标准应用工程结构
0.0.14版本,我们推荐的标准应用工程结构如下,每个层级包目录具体含义请参见[标准应用工程结构说明](1.标准应用工程结构说明.md):
```
/
├── 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](../../../../au_dir_structure_updater.py)。
脚本使用步骤:
1. 将脚本文件移动到您的应用根目录下例如您的应用根目录为sample_standard_app则将au_dir_structure_updater.py文件移动到sample_standard_app下。
2. 启动脚本文件脚本文件会创建新目录结构dircreate_directory_structure方法
3. 之后根据脚本文件中配置的migration_rules您可自定义添加或删除migration_rules迁移老工程文件到新目录结构migrate_files方法
4. 迁移过程会同时更新新yaml文件中的metadata路径以及各python文件中的import package路径。
5. 更改config.toml中的包扫描路径参考[sample_config](../../../../examples/sample_standard_app/config/config.toml)中的CORE_PACKAGE。
6. 运行本地测试文件,校验智能体是否运行成功。
## 智能体模版
0.0.14版本中我们推荐您使用智能体模版功能替代原aU中的planner计划组件智能体模版具体原理参见文档[agentTemplate](../../zh/In-Depth_Guides/原理介绍/智能体/智能体模版.md)。
当智能体执行流程存在很强的复用性我们可以将其从agent的execute方法中抽象出来封装成标准的智能体模版方便后续的复用与共享。
当前0.0.14版本agentUniverse沉淀了如[PeerAgentTemplate](../../../../agentuniverse/agent/template/peer_agent_template.py)/[RagAgentTemplate](../../../../agentuniverse/agent/template/rag_agent_template.py)/[ReActAgentTemplate](../../../../agentuniverse/agent/template/react_agent_template.py)等多种智能体模版,您只需要配置化即可实现开箱即用。
使用智能体模版构建智能体可参见文档:[沉淀与使用智能体模版](../开始使用/5.沉淀与使用智能体模版.md)。
## 工作模式
aU中的工作模式为智能体模版再上一层级抽象具体原理档参见文档[workPattern](../../zh/In-Depth_Guides/原理介绍/工作模式/工作模式.md)agentUniverse中内置的工作模式为[PeerWorkPattern](../../../../agentuniverse/agent/work_pattern/peer_work_pattern.py)。