Skip to content

Commit 5cbeab1

Browse files
committed
refine(docs): update docs
1 parent 05a0b57 commit 5cbeab1

26 files changed

+430
-233
lines changed

docs/content/1.introduction/1.overview.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ seo:
99
effortlessly with Docus.
1010
---
1111

12-
欢迎使用火山引擎智能体框架 **VeADK(Volcengine Agent Development Kit)**,是由[火山引擎](https://www.volcengine.com/)推出的为 Agent 智能体的应用构建提供开发、部署、观测、评测等全流程云原生解决方案。
12+
火山引擎智能体框架 **VeADK(Volcengine Agent Development Kit)**,是由[火山引擎](https://www.volcengine.com/)推出的为 Agent 智能体的应用构建提供开发、部署、观测、评测等全流程云原生解决方案。
1313

14-
相较于现有的智能体开发框架,具备与火山引擎产品体系深度融合的优势,帮助开发者更高效地构建企业级 AI 智能体应用。
14+
相较于现有的智能体开发框架,VeADK 具备与火山引擎产品体系深度融合的优势,帮助开发者更高效地构建企业级 AI 智能体应用。
1515

16-
## 特性
16+
## 核心能力
1717

1818
- **生态兼容**:与 Google ADK 完全兼容
19-
- **快速部署**本地项目部署到云端的时延在分钟级别,并提供镜像部署、代码部署等多种部署形式
20-
- **一证通行**:基于火山引擎AK/SK进行企业级统一密钥管理
19+
- **快速部署**本地项目分钟级部署云端,提供代码打包、镜像构建等多种部署形式
20+
- **一证通行**:基于火山引擎AK/SK进行企业级统一身份和密钥管理
2121

22-
## 核心能力
22+
## 特性
2323

2424
### 更快速的企业级部署
2525

docs/content/1.introduction/2.installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 安装
3-
description: VeADK安装方式
3+
description: VeADK 安装方式
44
navigation:
55
icon: i-lucide-download
66
---
@@ -21,19 +21,19 @@ pip install veadk-python==0.2.7
2121

2222
:::
2323

24-
<!-- 如果您使用知识库、长期记忆等进阶功能,请进一步安装 `veadk-python` 中的扩展包:
24+
如果您使用知识库、长期记忆等进阶功能,请进一步安装 `veadk-python` 中的扩展包:
2525

2626
```bash [Terminal]
2727
pip install veadk-python[extensions]
28-
``` -->
28+
```
2929

3030
## 从源码构建
3131

3232
::steps
3333

3434
### 下载源码至本地
3535

36-
将VeADK的代码包从Github下载到本地
36+
将 VeADK 的代码包从 Github 下载到本地
3737

3838
```bash [Terminal]
3939
git clone https://github.com/volcengine/veadk-python.git

docs/content/1.introduction/3.quickstart.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,58 @@ import asyncio
1919
from veadk import Agent
2020

2121
agent = Agent()
22-
asyncio.run(agent.run("Hello world!"))
22+
response = asyncio.run(agent.run("Hello world!"))
23+
24+
print(response)
2325
```
2426

2527
### 执行
2628

27-
您需要通过环境变量方式,来设置能够调用大模型的 API Key 或者其它身份验证信息。
29+
您需要通过环境变量方式,来设置能够调用大模型的 API Key 或者其它身份验证信息。例如,通过火山引擎方舟大模型平台的API Key:
2830

2931
```bash [Terminal]
30-
# 通过 API Key
3132
MODEL_AGENT_API_KEY=... python agent.py
33+
```
34+
35+
或者通过火山引擎 AK/SK:
3236

33-
# 通过火山引擎 AK/SK
37+
```bash [Terminal]
3438
VOLCENGINE_ACCESS_KEY=... VOLCENGINE_SECRET_KEY=... python agent.py
3539
```
3640

41+
::warning
42+
通过火山引擎 AK/SK 来运行智能体时,将会自动从您的方舟平台获取 API Key,这要求您在方舟平台至少已经创建一个 API Key。[了解如何创建方舟大模型平台API Key](https://www.volcengine.com/docs/82379/1361424)
43+
::
44+
45+
### 进阶
46+
47+
您也可以在项目根目录下创建一个 `config.yaml` 来填入相关配置。
48+
49+
::tip
50+
VeADK 可以自动将您根目录下的 `config.yaml` 文件根据层次使用下划线铺平,转为大写后设置为环境变量,详见[这里](../configurations/system)
51+
::
52+
53+
::code-tree{default-value="app/config.yaml"}
54+
55+
```yaml [app/config.yaml]
56+
volcengine:
57+
access_key:
58+
secret_key:
59+
```
60+
61+
```python [app/agent.py]
62+
import asyncio
63+
64+
from veadk import Agent
65+
66+
agent = Agent()
67+
response = asyncio.run(agent.run("Hello world!"))
68+
69+
print(response)
70+
```
71+
72+
::
73+
74+
完整的配置项可以参考[这里](../configurations/envs)
75+
3776
::

docs/content/1.introduction/4.troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Troubleshooting
33
description: 安装、运行以及使用中的各类常见问题汇总
44
navigation:
5-
icon: i-lucide-wrench
5+
icon: i-lucide-file-question-mark
66
---
77

88
## 安装

docs/content/2.configurations/1.system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 配置管理系统
33
description: 实现自动身份管理、云上资源设施管理等
44
navigation:
5-
icon: i-lucide-heading-1
5+
icon: i-lucide-settings
66
---
77

88
VeADK 内置了一套配置管理系统,您能够通过定义一个 `config.yaml` 文件来管理您的各项配置。文件中的配置项将会在运行时被自动加载为对应的环境变量。

docs/content/2.configurations/2.envs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 环境变量
33
description: 更安全、更快捷的配置入口
44
navigation:
5-
icon: i-lucide-heading-1
5+
icon: i-lucide-settings
66
---
77

88
## 火山引擎生态

docs/content/2.configurations/3.consts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 系统默认值
33
description: VeADK 内置常量值
44
navigation:
5-
icon: i-lucide-heading-1
5+
icon: i-lucide-settings
66
---
77

88
VeADK 中的内置常量值如下:

docs/content/3.agent/1.agent.md

Lines changed: 167 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
---
2-
title: LLM Agent
3-
description: 基于 LLM 的自主决策 Agent
2+
title: Agent
3+
description: VeADK 中提供了多种类型的智能体来承载不同的任务需求
44
navigation:
5-
icon: i-lucide-heading-1
5+
icon: i-lucide-lightbulb
66
---
77

8-
## 定义方法
8+
VeADK 中提供了多种类型的智能体来满足应用场景需要,提供可控要求下的自主决策。其中:
9+
10+
- **自主决策 Agent:** 可以根据不同场景,由 LLM 自主决定调用哪些子智能体或工具
11+
- **工作流 Agent:** 根据不同智能体类别,采用硬编码模式来提供确定性的子智能体执行顺序
12+
13+
## 自主决策 Agent
14+
15+
### 使用示例
916

1017
```python [agent.py]
18+
import asyncio
19+
1120
from veadk import Agent
21+
from veadk.tools.demo_tools import get_city_weather
22+
23+
agent = Agent(tools=[get_city_weather])
1224

13-
agent = Agent()
25+
response = asyncio.run(agent.run("北京天气怎么样?"))
26+
27+
print(response) # 北京天气晴朗,气温25°C。
1428
```
1529

16-
## 选项
30+
### 选项
1731

1832
::field-group
1933
::field{name="name" type="string"}
@@ -48,19 +62,162 @@ agent = Agent()
4862
模型请求的额外配置
4963
::
5064

51-
::field{name="tools" type="list[ToolUnion]"}
65+
::field{name="tools" type="list[ToolUnion] | None"}
5266
提供给智能体的工具列表
5367
::
5468

55-
::field{name="sub_agents" type="list[BaseAgent]"}
69+
::field{name="sub_agents" type="list[BaseAgent] | None"}
5670
提供给该智能体的子智能体列表
5771
::
5872

59-
::field{name="knowledgebase" type="KnowledgeBase | null"}
73+
::field{name="knowledgebase" type="KnowledgeBase | None"}
6074
提供给智能体的知识库
6175
::
6276

63-
::field{name="long_term_memory" type="LongTermMemory | null"}
77+
::field{name="short_term_memory" type="ShortTermMemory | None"}
78+
智能体的单会话上下文
79+
::
80+
81+
::field{name="long_term_memory" type="LongTermMemory | None"}
6482
智能体的跨会话长期记忆(同一用户范围内)
6583
::
6684
::
85+
86+
::note
87+
更多兼容字段请参考 [Google ADK LLM Agent 定义](https://github.com/google/adk-python/blob/main/src/google/adk/agents/llm_agent.py)
88+
::
89+
90+
## 工作流 Agent
91+
92+
### 定义方法
93+
94+
下面提供了不同类型工作流智能体的定义方法:
95+
96+
#### 顺序类 `SequentialAgent`
97+
98+
#### 循环类 `LoopAgent`
99+
100+
```python [loop_agent.py]
101+
102+
```
103+
104+
#### 并行类 `ParallelAgent`
105+
106+
```python [parallel_agent.py]
107+
108+
```
109+
110+
### 选项
111+
112+
工作流 Agent 采用统一的参数:
113+
114+
::field-group
115+
::field{name="name" type="string"}
116+
智能体的名称
117+
::
118+
119+
::field{name="description" type="string"}
120+
默认为 `DEFAULT_DESCRIPTION` - 智能体的描述,在 A2A 场景下会有帮助
121+
::
122+
123+
::field{name="instruction" type="string"}
124+
默认为 `DEFAULT_INSTRUCTION` - 智能体的指令,例如函数调用的原则
125+
::
126+
127+
::field{name="sub_agents" type="list[BaseAgent]"}
128+
默认为 `[]` - 提供给该智能体的子智能体列表
129+
::
130+
131+
::field{name="tracers" type="list[BaseTracer]"}
132+
默认为 `[]` - 提供给该智能体的 tracer
133+
::
134+
::
135+
136+
::note
137+
更多兼容字段请参考 [Google ADK Agents 定义](https://github.com/google/adk-python/blob/main/src/google/adk/agents/)
138+
::
139+
140+
## 多智能体协作
141+
142+
使用 VeADK 可以构建多 Agent 协作, 主 Agent 通过 `sub_agents` 机制协调多个子 Agent 完成复杂任务。
143+
144+
### 自主决策 Agent
145+
146+
利用能够自主决策的 Agent 来定义一个生活提醒智能体,分别定义了三个智能体:
147+
148+
- `weather_reporter`:负责通过 `get_city_weather` 工具来获取指定城市的天气信息
149+
- `suggester`:根据天气情况给出穿衣建议
150+
- `planner`:作为“调度员”,先调用 `weather_reporter` 获取天气,再调用 `suggester` 获取建议,最后将结果整合返回给用户。
151+
152+
```python [agent.py]
153+
import asyncio
154+
155+
from veadk import Agent, Runner
156+
from veadk.tools.demo_tools import get_city_weather
157+
158+
weather_reporter = Agent(
159+
name="weather_reporter",
160+
description="A weather reporter agent to report the weather.",
161+
tools=[get_city_weather],
162+
)
163+
164+
suggester = Agent(
165+
name="suggester",
166+
description="A suggester agent that can give some clothing suggestions according to a city's weather.",
167+
)
168+
169+
planner_agent = Agent(
170+
name="planner",
171+
description="A planner that can generate a suggestion according to a city's weather.",
172+
instruction="Invoke weather reporter agent first to get the weather, then invoke suggester agent to get the suggestion. Return the final response to user.",
173+
sub_agents=[weather_reporter, suggester],
174+
)
175+
176+
runner = Runner(planner_agent)
177+
response = asyncio.run(runner.run("北京穿衣建议"))
178+
179+
print(response)
180+
# Based on the weather in Beijing today - Sunny with a temperature of 25°C, here are some clothing suggestions for you:
181+
182+
# It's a comfortable and warm day. You can choose light and breathable clothes. For example, a short - sleeved T - shirt or a thin shirt paired with casual pants or a skirt would be great. Since it's sunny, don't forget to wear a hat and sunglasses to protect yourself from the sun. Also, you can carry a light jacket in case the temperature drops in the evening, but it might not be necessary. Enjoy your day in Beijing!
183+
```
184+
185+
### `SequentialAgent`
186+
187+
```python [sequential_agent.py]
188+
import asyncio
189+
190+
from veadk import Agent, Runner
191+
from veadk.agents.sequential_agent import SequentialAgent
192+
193+
greeting_agent = Agent(
194+
name="greeting_agent",
195+
description="A friendly agent that greets the user.",
196+
instruction="Greet the user warmly.",
197+
)
198+
199+
goodbye_agent = Agent(
200+
name="goodbye_agent",
201+
description="A polite agent that says goodbye to the user.",
202+
instruction="Say goodbye to the user politely.",
203+
)
204+
205+
root_agent = SequentialAgent(sub_agents=[greeting_agent, goodbye_agent])
206+
207+
runner = Runner(root_agent)
208+
response = asyncio.run(runner.run("你好"))
209+
210+
print(response)
211+
```
212+
213+
### `LoopAgent`
214+
215+
```python [loop_agent.py]
216+
217+
```
218+
219+
### `ParallelAgent`
220+
221+
```python [parallel_agent.py]
222+
223+
```

0 commit comments

Comments
 (0)