Skip to content

Commit 31ffea5

Browse files
committed
docs: refactor installation documentation and add optional dependencies guide
refactor installation.mdx to use reusable component for optional dependencies and update overview to mention NodeJS API support. Add AgentRun console link to navigation. The changes include importing PartPipDeps component in installation and quickstart docs, updating SDK description to include NodeJS API, and adding console link to docusaurus config. 重构安装文档并添加可选依赖指南 将 installation.mdx 重构为使用可重用组件来展示可选依赖项, 并更新概述以提及 NodeJS API 支持。向导航中添加 AgentRun 控制台链接。 这些更改包括在安装和快速入门文档中导入 PartPipDeps 组件, 更新 SDK 描述以包含 NodeJS API,以及向 docusaurus 配置中添加控制台链接。 Change-Id: If20540668d74e3ecbe6684f33992f24bd13b21cf Signed-off-by: OhYee <oyohyee@oyohyee.com>
1 parent 97450fa commit 31ffea5

File tree

5 files changed

+39
-27
lines changed

5 files changed

+39
-27
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
AgentRun SDK 采用模块化设计,将不同的功能特性作为可选依赖项提供。这样可以避免安装不必要的依赖包,减小环境体积。根据您的实际需求,可以选择安装以下可选依赖:
2+
3+
- **`server`**: 依赖用于启用 HTTP 服务器功能。如果您需要使用 AgentRunServer 将 Agent 封装为 HTTP API,需要安装此依赖。该依赖包含 FastAPI 和 Uvicorn 等 Web 框架组件。
4+
- **`playwright`**: 依赖用于支持浏览器沙箱功能。当您需要让 Agent 进行网页自动化操作时,需要安装此依赖。安装后还需要运行 Playwright 的初始化命令来下载浏览器驱动。
5+
- **`mcp`**: 依赖用于支持 MCP(Model Context Protocol)工具集。如果您的 Agent 需要调用基于 MCP 协议的工具服务,需要安装此依赖。
6+
- 框架集成依赖: 包括 **`langchain`****`agentscope`****`google-adk`****`crewai`****`pydantic-ai`** 等。这些依赖分别对应不同的 AI 开发框架。如果您使用某个框架进行 Agent 开发,需要安装对应的集成依赖。
7+
8+
安装可选依赖时,在包名后用方括号指定依赖项名称,多个依赖项之间用逗号分隔。例如,如果您需要使用 AgentScope 框架,同时需要浏览器沙箱和 MCP 工具支持,可以执行:
9+
10+
```bash
11+
pip install agentrun-sdk[playwright,mcp,agentscope]
12+
```
13+
14+
对于使用 LangChain 框架并需要 HTTP 服务器功能的场景:
15+
16+
```bash
17+
pip install agentrun-sdk[server,langchain]
18+
```
19+
20+
如果您不确定需要哪些依赖,可以先安装基础版本,在遇到功能缺失时再按需补充安装。

docs/tutorial/installation.mdx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ sidebar_position: 1
44

55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
7-
import PartialEnv from '../_partial/_config.mdx';
7+
import PartialEnv from '@site/docs/_partial/_config.mdx';
8+
import PartPipDeps from '@site/docs/_partial/_pip_optional_dependencies.mdx';
89

910
# 安装与配置
1011

@@ -38,26 +39,8 @@ pip install agentrun-sdk -i http://mirrors.aliyun.com/pypi/simple/
3839
:::
3940

4041
:::note 安装可选依赖
41-
AgentRun SDK 采用模块化设计,将不同的功能特性作为可选依赖项提供。这样可以避免安装不必要的依赖包,减小环境体积。根据您的实际需求,可以选择安装以下可选依赖:
4242

43-
- **`server`**: 依赖用于启用 HTTP 服务器功能。如果您需要使用 AgentRunServer 将 Agent 封装为 HTTP API,需要安装此依赖。该依赖包含 FastAPI 和 Uvicorn 等 Web 框架组件。
44-
- **`playwright`**: 依赖用于支持浏览器沙箱功能。当您需要让 Agent 进行网页自动化操作时,需要安装此依赖。安装后还需要运行 Playwright 的初始化命令来下载浏览器驱动。
45-
- **`mcp`**: 依赖用于支持 MCP(Model Context Protocol)工具集。如果您的 Agent 需要调用基于 MCP 协议的工具服务,需要安装此依赖。
46-
- 框架集成依赖: 包括 **`langchain`****`agentscope`****`google-adk`****`crewai`****`pydantic-ai`** 等。这些依赖分别对应不同的 AI 开发框架。如果您使用某个框架进行 Agent 开发,需要安装对应的集成依赖。
47-
48-
安装可选依赖时,在包名后用方括号指定依赖项名称,多个依赖项之间用逗号分隔。例如,如果您需要使用 AgentScope 框架,同时需要浏览器沙箱和 MCP 工具支持,可以执行:
49-
50-
```bash
51-
pip install agentrun-sdk[playwright,mcp,agentscope]
52-
```
53-
54-
对于使用 LangChain 框架并需要 HTTP 服务器功能的场景:
55-
56-
```bash
57-
pip install agentrun-sdk[server,langchain]
58-
```
59-
60-
如果您不确定需要哪些依赖,可以先安装基础版本,在遇到功能缺失时再按需补充安装。
43+
<PartPipDeps />
6144
:::
6245

6346
</TabItem><TabItem value="nodejs" label="NodeJS" attributes={{ className: 'nodejs-icon' }}>

docs/tutorial/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_position: 0
88

99
AgentRun 是以高代码为核心,开放生态、灵活组装的一站式 Agentic AI 基础设施平台,为企业级 Agentic 应用提供开发、部署与运维全生命周期管理。平台基于 Serverless 架构提供强隔离的运行时与沙箱环境,深度集成开源生态,为用户提供模型高可用和数据不出域能力。
1010

11-
AgentRun Python SDK 是平台的官方客户端库,提供了完整的 Python API 来管理和调用 AgentRun 服务。通过这个 SDK,开发者可以在本地开发环境中编写、测试 Agent 应用,并无缝部署到云端运行。
11+
AgentRun SDK 是平台的官方客户端库,提供了完整的 Python/NodeJS API 来管理和调用 AgentRun 服务。通过这个 SDK,开发者可以在本地开发环境中编写、测试 Agent 应用,并无缝部署到云端运行。
1212

1313
<img src="https://img.alicdn.com/imgextra/i1/O1CN01J7XpwI26ehfoQ0mF8_!!6000000007687-2-tps-4016-2216.png" />
1414

docs/tutorial/quickstart/manual.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ import PartModel from '@site/docs/_partial/_create_model_service.mdx';
88
import PartSandbox from '@site/docs/_partial/_create_sandbox_browser.mdx';
99
import PartInstallS from '@site/docs/_partial/_install_s.mdx';
1010
import PartRole from '@site/docs/_partial/_role.mdx';
11+
import PartPipDeps from '@site/docs/_partial/_pip_optional_dependencies.mdx';
1112

1213
# 从零创建 Agent
1314

1415
本教程是一个端到端的实践指南,将引导您手动创建并部署一个完整的 Agent 应用。
1516

17+
完成该实践后,您将获得一个拥有 **主动搜索能力** 的 Agent,能够根据实际情况在 **浏览器沙箱中** 使用 js 脚本预处理内容 **降低 token 消耗**
18+
稍加改造便可成为您的 “舆情分析专家”、“新知识学习小帮手”。
19+
1620
## 准备工作
1721

1822
### 开发环境准备
@@ -98,8 +102,6 @@ node -v
98102

99103
</TabItem></Tabs>
100104

101-
至此,您已经配置好了开发环境
102-
103105
### 依赖安装
104106

105107
为了后续的代码可以正确执行,我们需要进行依赖安装
@@ -114,6 +116,8 @@ agentrun-sdk[server,langchain]==0.0.9
114116

115117
:::note
116118
由于是基于 langchain 完成代码开发,并且会使用 AgentRun Server 启动 http server,因此增加了可选依赖的安装
119+
120+
<PartPipDeps />
117121
:::
118122

119123
:::warning
@@ -674,7 +678,6 @@ Health: http://127.0.0.1:${PORT}/health
674678
});
675679
```
676680
677-
678681
写入上述文件后,您的目录应该为如下形式
679682
680683
```
@@ -869,7 +872,6 @@ data: {"type":"RUN_FINISHED","threadId":"3fcd6aed-bbbb-4cbd-b14c-f43a25f02e27","
869872
870873
</details>
871874
872-
873875
:::warning
874876
Sandbox 的生命周期与业务密切相关,因此我们未对 Sandbox 的生命周期进行管理。
875877
@@ -912,6 +914,7 @@ Sandbox 的生命周期与业务密切相关,因此我们未对 Sandbox 的生
912914
对于 `s.yaml` 中,存在 `vars.role` 字段,该字段需要填写您的 RAM 角色,用来获取执行期间的临时阿里云 ACCESS_KEY
913915
914916
快速创建 RAM 角色可以参考:
917+
915918
> <PartRole />
916919
917920
<Tabs groupId="language" queryString><TabItem value="python" label="Python" default attributes={{ className: 'python-icon' }}>
@@ -963,7 +966,7 @@ resources:
963966

964967
# 环境变量
965968
environmentVariables:
966-
# highlight-next-line
969+
# highlight-next-line
967970
PYTHONPATH: /code/python:/opt/python:/code:/code/python
968971

969972
MODEL_SERVICE: '${vars.model_service}'
@@ -1043,7 +1046,6 @@ resources:
10431046
- name: prod
10441047
version: LATEST
10451048
description: '生产环境端点'
1046-
10471049
```
10481050
10491051
此时,执行 `s build` 则会自动拉取函数计算使用的运行镜像,并在其中安装依赖,依赖会被安装到 `node_modules` 目录。

docusaurus.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ const config: Config = {
9999
// label: 'NodeJS SDK',
100100
// },
101101

102+
{
103+
href: 'https://functionai.console.aliyun.com/cn-hangzhou/agent/explore',
104+
label: 'AgentRun 控制台',
105+
position: 'right',
106+
// className: 'header-github-link',
107+
},
108+
102109
{
103110
href: 'https://github.com/Serverless-Devs/agentrun-sdk-python',
104111
label: 'Python SDK',

0 commit comments

Comments
 (0)