44This module defines the high-level API for sandbox resources.
55"""
66
7- from typing import List , Literal , Optional , overload , TYPE_CHECKING , Union
7+ from typing import (
8+ Any ,
9+ Dict ,
10+ List ,
11+ Literal ,
12+ Optional ,
13+ overload ,
14+ TYPE_CHECKING ,
15+ Union ,
16+ )
817
918from agentrun .sandbox .model import TemplateType
1019from agentrun .utils .config import Config
1726 from agentrun .sandbox .model import (
1827 ListSandboxesInput ,
1928 ListSandboxesOutput ,
29+ NASConfig ,
30+ OSSMountConfig ,
2031 PageableInput ,
32+ PolarFsConfig ,
2133 TemplateInput ,
2234 )
2335 from agentrun .sandbox .template import Template
@@ -32,23 +44,29 @@ class Sandbox(BaseModel):
3244 _template_type : Optional [TemplateType ]
3345
3446 created_at : Optional [str ] = None
35- """沙箱创建时间"""
47+ """沙箱创建时间 / Sandbox creation time"""
48+ ended_at : Optional [str ] = None
49+ """沙箱结束时间 / Sandbox end time"""
3650 last_updated_at : Optional [str ] = None
37- """最后更新时间"""
51+ """最后更新时间 / Last updated time"""
52+ metadata : Optional [Dict [str , Any ]] = None
53+ """元数据 / Metadata"""
3854 sandbox_arn : Optional [str ] = None
39- """沙箱全局唯一资源名称"""
55+ """沙箱全局唯一资源名称 / Sandbox ARN """
4056 sandbox_id : Optional [str ] = None
41- """沙箱 ID"""
57+ """沙箱 ID / Sandbox ID"""
58+ sandbox_idle_ttlin_seconds : Optional [int ] = None
59+ """沙箱空闲 TTL(秒) / Sandbox Idle TTL (seconds)"""
4260 sandbox_idle_timeout_seconds : Optional [int ] = None
43- """沙箱空闲超时时间(秒)"""
61+ """沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds) """
4462 status : Optional [str ] = None
45- """沙箱状态"""
63+ """沙箱状态 / Sandbox status """
4664 template_id : Optional [str ] = None
47- """模板 ID"""
65+ """模板 ID / Template ID """
4866 template_name : Optional [str ] = None
49- """模板名称"""
67+ """模板名称 / Template name """
5068 _config : Optional [Config ] = None
51- """配置对象,用于子类的 data_api 初始化"""
69+ """配置对象,用于子类的 data_api 初始化 / Config object for data_api initialization """
5270
5371 @classmethod
5472 def __get_client (cls ):
@@ -64,6 +82,9 @@ async def create_async(
6482 template_type : Literal [TemplateType .CODE_INTERPRETER ],
6583 template_name : Optional [str ] = None ,
6684 sandbox_idle_timeout_seconds : Optional [int ] = 600 ,
85+ nas_config : Optional ["NASConfig" ] = None ,
86+ oss_mount_config : Optional ["OSSMountConfig" ] = None ,
87+ polar_fs_config : Optional ["PolarFsConfig" ] = None ,
6788 config : Optional [Config ] = None ,
6889 ) -> "CodeInterpreterSandbox" :
6990 ...
@@ -75,6 +96,9 @@ async def create_async(
7596 template_type : Literal [TemplateType .BROWSER ],
7697 template_name : Optional [str ] = None ,
7798 sandbox_idle_timeout_seconds : Optional [int ] = 600 ,
99+ nas_config : Optional ["NASConfig" ] = None ,
100+ oss_mount_config : Optional ["OSSMountConfig" ] = None ,
101+ polar_fs_config : Optional ["PolarFsConfig" ] = None ,
78102 config : Optional [Config ] = None ,
79103 ) -> "BrowserSandbox" :
80104 ...
@@ -86,6 +110,9 @@ async def create_async(
86110 template_type : Literal [TemplateType .AIO ],
87111 template_name : Optional [str ] = None ,
88112 sandbox_idle_timeout_seconds : Optional [int ] = 600 ,
113+ nas_config : Optional ["NASConfig" ] = None ,
114+ oss_mount_config : Optional ["OSSMountConfig" ] = None ,
115+ polar_fs_config : Optional ["PolarFsConfig" ] = None ,
89116 config : Optional [Config ] = None ,
90117 ) -> "AioSandbox" :
91118 ...
@@ -96,6 +123,9 @@ async def create_async(
96123 template_type : TemplateType ,
97124 template_name : Optional [str ] = None ,
98125 sandbox_idle_timeout_seconds : Optional [int ] = 600 ,
126+ nas_config : Optional ["NASConfig" ] = None ,
127+ oss_mount_config : Optional ["OSSMountConfig" ] = None ,
128+ polar_fs_config : Optional ["PolarFsConfig" ] = None ,
99129 config : Optional [Config ] = None ,
100130 ) -> Union ["CodeInterpreterSandbox" , "BrowserSandbox" , "AioSandbox" ]:
101131
@@ -123,6 +153,9 @@ async def create_async(
123153 base_sandbox = await cls .__get_client ().create_sandbox_async (
124154 template_name = template_name ,
125155 sandbox_idle_timeout_seconds = sandbox_idle_timeout_seconds ,
156+ nas_config = nas_config ,
157+ oss_mount_config = oss_mount_config ,
158+ polar_fs_config = polar_fs_config ,
126159 )
127160
128161 # 根据 template 类型转换为对应的子类实例
0 commit comments