Skip to content

Commit 9e6b4f9

Browse files
feat: add VeADK Studio features (#18)
* chore: update version to 0.1.0 * fix: add inmemory exporter when already defined * feat: add veadk studio * fix typos in studio doc
1 parent 0a25612 commit 9e6b4f9

File tree

474 files changed

+1068
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

474 files changed

+1068
-871
lines changed

docs/docs/.vuepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default defineUserConfig({
1313

1414
navbar: ['/', '/introduction'],
1515

16-
sidebar: ['introduction', 'installation', 'get-started', 'agent', 'memory', 'knowledgebase', 'tracing', 'evaluation', 'deploy', 'cli']
16+
sidebar: ['introduction', 'installation', 'get-started', 'agent', 'memory', 'knowledgebase', 'tracing', 'evaluation', 'deploy', 'cli', 'veadk-studio']
1717
}),
1818

1919
bundler: viteBundler(),
122 KB
Loading
592 KB
Loading
296 KB
Loading
143 KB
Loading
460 KB
Loading
196 KB
Loading
246 KB
Loading

docs/docs/veadk-studio.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# VeADK Studio
2+
3+
VeADK Studio是我们提供的一站式Agent开发平台,提供本地Agent优化、观测等功能。
4+
5+
![VeADK Studio主页](/images/studio-index.png)
6+
7+
## 前置准备
8+
9+
你需要在你的Agent项目中准备一个`agent.py`文件,导出`agent``short_term_memory`两个全局变量:
10+
11+
```python
12+
agent = ...
13+
14+
short_term_memory = ...
15+
```
16+
17+
## 启动
18+
19+
在你准备好的Agent项目目录下执行以下命令:
20+
21+
```bash
22+
veadk-studio
23+
```
24+
25+
Studio将会自动加载你的`agent.py`文件,启动一个本地服务器。注意,服务地址与端口必须固定为`127.0.0.1:8000`
26+
27+
访问`http://127.0.0.1:8000`即可打开Studio:
28+
29+
![VeADK Studio主页](/images/studio-index.png)
30+
31+
## 功能介绍
32+
33+
VeADK Studio的主页包括两个入口:
34+
35+
- **Local agent**:你的本地Agent项目
36+
- **Remote agent**:连接一个已经部署到VeFaaS的Agent(即将上线)
37+
38+
点击Local agent后,即可体验本地优化观测等各项功能:
39+
40+
![VeADK Studio智能体页面](/images/studio-chat.png)
41+
42+
### 交互
43+
44+
Studio中采用流式(SSE通信)与你定义的Agent进行交互,期间会自动加载短期与长期记忆。
45+
46+
只要服务端保持连接,历史会话便不会消失。
47+
48+
### 工具调用
49+
50+
当发生工具调用时,可显示工具的状态和输入输出。
51+
52+
![VeADK Studio智能体页面](/images/studio-tool.png)
53+
54+
### Prompt优化
55+
56+
VeADK通过AgentPilot提供Prompt优化功能,你可以在Studio中对Prompt进行优化与替换。
57+
58+
![VeADK Studio智能体页面](/images/studio-refine-prompt.png)
59+
60+
### 调用追踪
61+
62+
本地可查看调用链与具体的事件信息、Tracing Span的属性信息等。
63+
64+
![VeADK Studio智能体页面](/images/studio-tracing.png)
65+
66+
### 效果评估
67+
68+
VeADK通过DeepEval提供效果评估功能,你可以在Studio中对Agent的效果进行评估(例如输入输出情况)。
69+
70+
![VeADK Studio智能体页面](/images/studio-evaluation.png)
71+
72+
在生成评估结果后,评估器输出的评估Reason可作为进一步Prompt优化的Feedback反馈:
73+
74+
![VeADK Studio智能体页面](/images/studio-eval-to-refine.png)
75+
76+
### 云端部署
77+
78+
该功能即将上线。

veadk/cli/main.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
import os
1919
import shutil
2020
import sys
21+
from importlib.util import module_from_spec, spec_from_file_location
2122
from pathlib import Path
2223

2324
import typer
2425
import uvicorn
2526

27+
from veadk.cli.studio.fast_api import get_fast_api_app
2628
from veadk.utils.logger import get_logger
2729
from veadk.version import VERSION
2830

@@ -153,9 +155,31 @@ def studio(
153155
):
154156
path = Path(path).resolve()
155157

156-
from veadk.cli.studio.fast_api import get_fast_api_app
158+
agent_py_path = os.path.join(path, "agent.py")
159+
if not os.path.exists(agent_py_path):
160+
raise FileNotFoundError(f"agent.py not found in {path}")
157161

158-
app = get_fast_api_app(agents_dir=str(path))
162+
spec = spec_from_file_location("agent", agent_py_path)
163+
if spec is None:
164+
raise ImportError(f"Could not load spec for agent from {agent_py_path}")
165+
166+
module = module_from_spec(spec)
167+
168+
try:
169+
spec.loader.exec_module(module)
170+
except Exception as e:
171+
raise ImportError(f"Failed to execute agent.py: {e}")
172+
173+
agent = None
174+
short_term_memory = None
175+
try:
176+
agent = module.agent
177+
short_term_memory = module.short_term_memory
178+
except AttributeError as e:
179+
missing = str(e).split("'")[1] if "'" in str(e) else "unknown"
180+
raise AttributeError(f"agent.py is missing required variable: {missing}")
181+
182+
app = get_fast_api_app(agent, short_term_memory)
159183

160184
uvicorn.run(
161185
app,

0 commit comments

Comments
 (0)