Skip to content

Commit 3b864c8

Browse files
authored
docs: update serverless deployment docs (#248)
1 parent c707b68 commit 3b864c8

File tree

7 files changed

+111
-4
lines changed

7 files changed

+111
-4
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,22 @@ agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-ba
421421

422422
---
423423

424+
#### Serverless Sandbox Deployment
425+
426+
AgentScope Runtime also supports serverless deployment, which is suitable for running sandboxes in a serverless environment,
427+
[Alibaba Cloud Function Compute (FC)](https://help.aliyun.com/zh/functioncompute/fc/) or [Alibaba Cloud AgentRun](https://docs.agent.run/).
428+
429+
First, please refer to the [documentation](https://runtime.agentscope.io/en/sandbox/advanced.html#optional-function-compute-fc-settings) to configure the serverless environment variables.
430+
Make `CONTAINER_DEPLOYMENT` to `fc` or `agentrun` to enable serverless deployment.
431+
432+
Then, start a sandbox server, use the `--config` option to specify a serverless environment setup:
433+
434+
```bash
435+
# This command will load the settings defined in the `custom.env` file
436+
runtime-sandbox-server --config fc.env
437+
```
438+
After the server starts, you can access the sandbox server at baseurl `http://localhost:8000` and invoke sandbox tools described above.
439+
424440
## 📚 Cookbook
425441

426442
- **[📖 Cookbook](https://runtime.agentscope.io/en/intro.html)**: Comprehensive tutorials
@@ -471,6 +487,40 @@ response = client.responses.create(
471487
print(response)
472488
```
473489
490+
Besides, `DeployManager` also supports serverless deployments, such as deploying your agent app
491+
to [ModelStudio](https://bailian.console.aliyun.com/?admin=1&tab=doc#/doc/?type=app&url=2983030)
492+
or [AgentRun](https://docs.agent.run/).
493+
494+
```python
495+
from agentscope_runtime.engine.deployers import ModelStudioDeployManager
496+
# Create deployment manager
497+
deployer = ModelstudioDeployManager(
498+
oss_config=OSSConfig(
499+
access_key_id=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_ID"),
500+
access_key_secret=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
501+
),
502+
modelstudio_config=ModelstudioConfig(
503+
workspace_id=os.environ.get("MODELSTUDIO_WORKSPACE_ID"),
504+
access_key_id=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_ID"),
505+
access_key_secret=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
506+
dashscope_api_key=os.environ.get("DASHSCOPE_API_KEY"),
507+
),
508+
)
509+
510+
# Deploy to ModelStudio
511+
result = await app.deploy(
512+
deployer,
513+
deploy_name="agent-app-example",
514+
telemetry_enabled=True,
515+
requirements=["agentscope", "fastapi", "uvicorn"],
516+
environment={
517+
"PYTHONPATH": "/app",
518+
"DASHSCOPE_API_KEY": os.environ.get("DASHSCOPE_API_KEY"),
519+
},
520+
)
521+
```
522+
523+
For more advanced serverless deployment guides, please refer to the [documentation](https://runtime.agentscope.io/en/advanced_deployment.html#method-4-modelstudio-deployment).
474524
475525
---
476526

README_zh.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,22 @@ export RUNTIME_SANDBOX_IMAGE_TAG="preview"
422422
agentscope-registry.ap-southeast-1.cr.aliyuncs.com/myteam/runtime-sandbox-base:preview
423423
```
424424

425+
---
426+
427+
#### Serverless 沙箱部署
428+
429+
AgentScope Runtime 同样支持 serverless 部署,适用于在无服务器环境中运行沙箱,例如 [阿里云函数计算(FC)](https://help.aliyun.com/zh/functioncompute/fc/)[阿里云 AgentRun](https://docs.agent.run/)
430+
431+
首先,请参考[文档](https://runtime.agentscope.io/zh/sandbox/advanced.html#optional-function-compute-fc-settings)配置 serverless 环境变量。
432+
`CONTAINER_DEPLOYMENT` 设置为 `fc``agentrun` 以启用 serverless 部署。
425433

434+
然后,启动沙箱服务器,使用 `--config` 选项指定 serverless 环境配置:
435+
436+
```bash
437+
# 此命令将加载 `fc.env` 文件中定义的设置
438+
runtime-sandbox-server --config fc.env
439+
```
440+
服务器启动后,您可以通过URL `http://localhost:8000` 访问沙箱服务器,并调用上述描述的沙箱工具。
426441

427442
---
428443

@@ -477,6 +492,41 @@ response = client.responses.create(
477492
print(response)
478493
```
479494

495+
此外,`DeployManager` 也支持 Serverless 部署,例如将您的 agent 应用部署到
496+
[ModelStudio](https://bailian.console.aliyun.com/?admin=1&tab=doc#/doc/?type=app&url=2983030)
497+
[AgentRun](https://docs.agent.run/)
498+
499+
```python
500+
from agentscope_runtime.engine.deployers import ModelStudioDeployManager
501+
# 创建部署管理器
502+
deployer = ModelstudioDeployManager(
503+
oss_config=OSSConfig(
504+
access_key_id=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_ID"),
505+
access_key_secret=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
506+
),
507+
modelstudio_config=ModelstudioConfig(
508+
workspace_id=os.environ.get("MODELSTUDIO_WORKSPACE_ID"),
509+
access_key_id=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_ID"),
510+
access_key_secret=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
511+
dashscope_api_key=os.environ.get("DASHSCOPE_API_KEY"),
512+
),
513+
)
514+
515+
# 部署到 ModelStudio
516+
result = await app.deploy(
517+
deployer,
518+
deploy_name="agent-app-example",
519+
telemetry_enabled=True,
520+
requirements=["agentscope", "fastapi", "uvicorn"],
521+
environment={
522+
"PYTHONPATH": "/app",
523+
"DASHSCOPE_API_KEY": os.environ.get("DASHSCOPE_API_KEY"),
524+
},
525+
)
526+
```
527+
528+
有关更高级的 serverless 部署指南,请参考[文档](https://runtime.agentscope.io/zh/advanced_deployment.html#method-4-modelstudio-deployment)
529+
480530
---
481531

482532
## 🤝 贡献

cookbook/en/advanced_deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ if __name__ == "__main__":
478478
- Can be scaled with `kubectl scale deployment`
479479

480480

481-
## Method 4: ModelStudio Deployment
481+
## Method 4: Serverless Deployment: ModelStudio
482482

483483
**Best for**: Alibaba Cloud users requiring managed cloud deployment with built-in monitoring, scaling, and integration with Alibaba Cloud ecosystem.
484484

@@ -561,7 +561,7 @@ if __name__ == "__main__":
561561
- Built-in monitoring and auto-scaling
562562
- Integrated with DashScope LLM services
563563

564-
## Method 5: AgentRun Deployment
564+
## Method 5: Serverless Deployment: AgentRun
565565

566566
**Best For**: Alibaba Cloud users who need to deploy agents to AgentRun service with automated build, upload, and deployment workflows.
567567

cookbook/en/agent_app.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,6 @@ await app.deploy(LocalDeployManager(host="0.0.0.0", port=8091))
510510
```
511511

512512
See {doc}`advanced_deployment` for additional deployers (Kubernetes, ModelStudio, AgentRun, etc.) and more configuration tips.
513+
514+
AgentScope Runtime provides serverless deployment options, including deploying agents to ModelStudio(FC) and AgentRun.
515+
See {doc}`advanced_deployment` for more configuration details about ModelStudio and AgentRun.

cookbook/zh/advanced_deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ if __name__ == "__main__":
473473
- 可使用 `kubectl scale deployment` 进行扩展
474474

475475

476-
## 方法4:ModelStudio部署
476+
## 方法4:Serverless部署:ModelStudio
477477

478478
**最适合**:阿里云用户,需要托管云部署,具有内置监控、扩展和与阿里云生态系统集成。
479479

@@ -556,7 +556,7 @@ if __name__ == "__main__":
556556
- 内置监控和自动扩展
557557
- 与 DashScope LLM 服务集成
558558

559-
## 方法5:AgentRun 部署
559+
## 方法5:Serverless部署:AgentRun
560560

561561
**最适合**:阿里云用户,需要将智能体部署到 AgentRun 服务,实现自动化的构建、上传和部署流程。
562562

cookbook/zh/agent_app.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,6 @@ await app.deploy(LocalDeployManager(host="0.0.0.0", port=8091))
516516
```
517517

518518
更多部署选项和详细说明,请参考 {doc}`advanced_deployment` 文档。
519+
520+
AgentScope Runtime 提供了Serverless的部署方案,您可以将您的Agent部署到 ModelStudio(FC) 或 AgentRun 上。
521+
参考 {doc}`advanced_deployment` 文档,查看ModelStudio和AgentRun部署部分获取更多配置详情.

examples/deployments/agentrun_deploy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,3 +521,4 @@ After successful deployment:
521521

522522
This example provides a complete workflow for deploying AgentScope Runtime agents to Alibaba Cloud AgentRun with serverless, production-ready configurations.
523523

524+

0 commit comments

Comments
 (0)