Skip to content

Commit ceba67d

Browse files
[feat/docs] Add zh-cn docs for veadk-python (#1)
* feat: add docs * fix: add feat/docs to auto deploy workflow * fix: correct typos in workflow file * chore: remove github pages deploy deps * fix: fix doc pages bugs * fix: fix doc pages bugs * fix: fix doc pages bugs * fix: fix doc pages bugs * fix: add permissions to deploy-docs * fix: add static base for Github Pages static resource
1 parent bec1650 commit ceba67d

File tree

16 files changed

+5165
-0
lines changed

16 files changed

+5165
-0
lines changed

.github/workflows/deploy-docs.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- feat/docs
8+
paths:
9+
- 'docs/**'
10+
- '.github/workflows/deploy-docs.yaml'
11+
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
jobs:
20+
deploy:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '22'
30+
31+
- name: Install dependencies
32+
run: |
33+
cd docs
34+
npm install
35+
36+
- name: Build documentation
37+
run: |
38+
cd docs
39+
npm run docs:build
40+
41+
- name: Upload artifact for GitHub Pages
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/docs/.vuepress/dist
45+
46+
- name: Deploy to GitHub Pages
47+
id: deploy
48+
uses: actions/deploy-pages@v4

docs/docs/.vuepress/config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { viteBundler } from '@vuepress/bundler-vite'
2+
import { defaultTheme } from '@vuepress/theme-default'
3+
import { defineUserConfig } from 'vuepress'
4+
5+
export default defineUserConfig({
6+
lang: 'en-US',
7+
8+
title: 'Volcengine Agent Development Kit',
9+
description: '火山引擎智能体开发框架',
10+
11+
theme: defaultTheme({
12+
logo: '/images/VEADK.png',
13+
14+
navbar: ['/', '/introduction'],
15+
16+
sidebar: ['introduction', 'installation', 'get-started', 'agent', 'memory', 'knowledgebase', 'tracing', 'evaluation', 'deploy', 'cli']
17+
}),
18+
19+
bundler: viteBundler(),
20+
21+
base: '/veadk-python/', // GitHub Pages required
22+
})
105 KB
Loading

docs/docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
home: true
3+
title: VeADK
4+
heroImage: /images/VEADK.png
5+
actions:
6+
- text: 使用文档
7+
link: /introduction.html
8+
type: primary
9+
10+
- text: Github
11+
link: https://github.com/volcengine/veadk-python
12+
type: secondary
13+
14+
features:
15+
- title: 更丰富的内置工具
16+
details: Builtin工具,例如侧重头条、抖音搜索的web_search等;MCP工具,例如飞书Lark、PromptPilot等
17+
- title: 更灵活的功能扩展
18+
details: 提供Agent各类组件的基础实现,通过插件方式灵活扩展
19+
- title: 更完备的数据管理
20+
details: 运行时数据无缝衔接APMPlus、Cozeloop;运行时数据无痛落地为测试数据集文件,可直接在Cozeloop中进行测试
21+
- title: 更强大的知识管理
22+
details: 知识库支持火山引擎各类现有数据库,例如关系型数据库、键值数据库等
23+
- title: 更科学的结果评测
24+
details: 提供不确定性Tools(例如搜索类)场景下的测评解决方案,弥补传统仅根据输入输出进行评测而导致评测结果不符合预期的问题
25+
- title: 更友好的最佳实践
26+
details: 贴近实际工业场景的Samples,例如各类数据库、数据湖读写
27+
28+
footer: Apache 2.0 Licensed | Copyright © 2025-present Beijing Volcano Engine Technology Co., Ltd.
29+
---

docs/docs/agent.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# 智能体
2+
3+
## 属性
4+
5+
Agent中主要包括如下属性:
6+
7+
| 属性 | 类型 | 说明 |
8+
| --- | --- | --- |
9+
| name | str | Agent的名称,即标识符 |
10+
| description | str | Agent的描述,后续会被构建为系统提示词的一部分;也被用来在A2A协议中进行Agent挑选 |
11+
| instruction | str | Agent中内置模型的系统提示词 |
12+
| tools | list | Function call中的工具列表,既可以是本地工具,也可以是MCP工具 |
13+
| sub_agents | list | 子Agent列表,用于多Agent之间交互 |
14+
| long_term_memory | Vector database | 长期记忆,后端通常为一个向量数据库(Vector database),能够检索 |
15+
| knowledgebase | Vector database | 知识库,后端通常为一个向量数据库(Vector database),能够检索 |
16+
| tracers | list | 追踪器列表,能够定义不同的追踪方式,并在Agent执行完毕后对整体Tracing信息保存至本地 |
17+
18+
## 运行
19+
20+
在生产环境中,我们推荐您使用`Runner`来进行多租户服务:
21+
22+
```python
23+
from veadk import Agent, Runner
24+
from veadk.memory.short_term_memory import ShortTermMemory
25+
26+
# Define runner config
27+
APP_NAME = ""
28+
USER_ID = ""
29+
SESSION_ID = ""
30+
31+
agent = Agent()
32+
runner = Runner(agent=agent, short_term_memory=ShortTermMemory())
33+
response = await runner.run(messages=prompt, session_id=session_id)
34+
```

docs/docs/cli.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 命令行工具Vego
2+
3+
## 提示词优化
4+
5+
主要用来优化系统提示词(System prompt)。
6+
7+
```bash
8+
vego prompt
9+
```
10+
11+
## 一键上云部署
12+
13+
可直接将本地项目部署到火山引擎FaaS平台上:
14+
15+
```bash
16+
vego deploy
17+
```

docs/docs/deploy.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# 部署上云
2+
3+
## Cloud Agent Engine
4+
5+
通过定义一个云引擎,能够将本地Agent工程直接部署至VeFaaS中,并自动启动一个A2A Server。
6+
7+
```python
8+
engine = CloudAgentEngine()
9+
cloud_app = engine.deploy(path=..., name=...)
10+
```
11+
12+
## Cloud App
13+
14+
部署完成后,将返回一个`CloudApp`实例,代表云应用,主要功能包括:
15+
16+
- 发起一个远程会话创建请求
17+
- 发起一个Agent执行任务/对话任务
18+
19+
```python
20+
# 创建远程会话
21+
cloud_app.create_session(user_id=..., session_id=...)
22+
23+
# 发起任务
24+
cloud_app.invoke(user_id=..., session_id=..., message=...)
25+
```

docs/docs/evaluation.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# 评测
2+
3+
VeADK构建一套完整的自动化Evaluation流程,主要能力包括:
4+
5+
- 运行时数据采集:通过collect_runtime_data开启
6+
- 测试集文件生成:开启后自动dump到本地
7+
- 评测:通过不同的evaluator或adk eval命令进行测试
8+
- 反馈优化:自动根据评测结果(score reason等属性)优化prompts
9+
10+
## 运行时数据采集
11+
12+
```python
13+
from veadk.evaluation import EvalSetRecorder
14+
15+
# 在希望进行数据dump处初始化一个EvalSetRecorder
16+
eval_set_recorder = EvalSetRecorder(session_service, eval_set_id)
17+
18+
# dump数据,为Json格式
19+
dump_path = await eval_set_recorder.dump(app_name, user_id, session_id)
20+
```
21+
22+
## 评测集文件
23+
24+
评测集文件格式兼容Google Evaluation,详见[评测集文件格式](https://google.github.io/adk-docs/evaluate/#how-evaluation-works-with-the-adk)
25+
26+
评测集本地保存过程中,均考虑当前会话。下面是一些概念对齐:
27+
28+
- `test_case`:所有对话轮次
29+
- `invocation`:一轮对话
30+
31+
## 评测器
32+
33+
当前VeADK支持Deepeval评测器,通过如下方式定义:
34+
35+
```python
36+
from veadk.evaluation.deepeval_evaluator import DeepevalEvaluator
37+
38+
# 当然,你还可以传入`judge_model`等相关信息
39+
evaluator = DeepevalEvaluator()
40+
```
41+
42+
## 评测方法
43+
44+
启动标准的评测接口:
45+
46+
```python
47+
await evaluator.eval(eval_set_file_path=dump_path, metrics=metrics)
48+
```
49+
50+
其中,输入:
51+
52+
- `eval_set_file_path`:评测集文件路径
53+
- `metrics`:评测指标
54+
55+
不同的评测指标在不同测试框架中可能不同。
56+
57+
## 数据上报
58+
59+
评测结果可以自动上报至火山引擎的VMP平台,只需要在定义评估器的时候传入Prometheus pushgateway的相关参数:
60+
61+
```python
62+
from veadk.evaluation.utils.prometheus import PrometheusPushgatewayConfig
63+
64+
# 可以自动从环境变量中读取相关配置
65+
prometheus_config = PrometheusPushgatewayConfig()
66+
67+
# 传入到评估器中
68+
evaluator = DeepevalEvaluator(
69+
...,
70+
prometheus_config=prometheus_config,
71+
)
72+
```

docs/docs/get-started.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# 快速开始
2+
3+
## 最简Agent
4+
5+
当你设置完环境变量后,你可以创建一个最简单的聊天智能体:
6+
7+
```python
8+
from veadk import Agent
9+
10+
agent = Agent()
11+
```
12+
13+
由于某些操作是异步的,因此Agent的运行需要在异步环境中进行:
14+
15+
::: warning
16+
我们在`Agent`类中提供的`run`方法仅为了本地测试和开发使用,由于该函数位于一个异步与同步函数共存的运行环境,可能会产生不可预知的异常。
17+
18+
因此不建议在生产环境中使用。
19+
:::
20+
21+
```python
22+
import asyncio
23+
24+
prompt = "Hello!"
25+
res = asyncio.run(agent.run(prompt))
26+
```
27+
28+
## 工具调用
29+
30+
你可以给Agent传入`tools`参数,指定想要调用的工具:
31+
32+
```python
33+
from veadk import Agent
34+
35+
agent = Agent(
36+
tools=[...] # fill with tools
37+
)
38+
```
39+
40+
### 内置工具
41+
42+
VeADK中集成了多个火山引擎提供的工具:
43+
44+
- Web search
45+
- Web scraper 邀测,代码见MCP server
46+
- Vesearch
47+
- Lark
48+
49+
此外,还提供多种沙箱工具:
50+
51+
- Computer sandbox
52+
- Code sandbox
53+
- Mobile sandbox
54+
55+
### MCP工具
56+
57+
采用如下方式定义一个MCP工具:
58+
59+
```python
60+
# 以飞书Lark MCP工具为例
61+
lark_tools = MCPToolset(
62+
connection_params=StdioServerParameters(
63+
command="npx",
64+
args=[...],
65+
errlog=None,
66+
),
67+
)
68+
```
69+
70+
### 系统工具
71+
72+
- `load_knowledgebase`:检索知识库工具,在你给Agent传入`knowledgebase`参数后,将会自动挂载`load_knowledgebase_tool`工具,Agent将在运行时自主决定何时查询知识库;
73+
- `load_memory`:检索长期记忆工具,在你给Agent传入`memory`参数后,将会自动挂载`load_memory_tool`工具,Agent将在运行时自主决定何时查询长期记忆。

0 commit comments

Comments
 (0)