diff --git a/modal/sandbox.py b/modal/sandbox.py index 197f3d172..fea25e987 100644 --- a/modal/sandbox.py +++ b/modal/sandbox.py @@ -27,6 +27,7 @@ from .mount import _Mount from .network_file_system import _NetworkFileSystem, network_file_system_mount_protos from .object import _get_environment_name, _Object +from .proxy import _Proxy from .scheduler_placement import SchedulerPlacement from .secret import _Secret from .stream_type import StreamType @@ -72,6 +73,7 @@ def _new( pty_info: Optional[api_pb2.PTYInfo] = None, encrypted_ports: Sequence[int] = [], unencrypted_ports: Sequence[int] = [], + proxy: Optional[_Proxy] = None, _experimental_scheduler_placement: Optional[SchedulerPlacement] = None, ) -> "_Sandbox": """mdmd:hidden""" @@ -165,6 +167,7 @@ async def _load(self: _Sandbox, resolver: Resolver, _existing_object_id: Optiona worker_id=config.get("worker_id"), open_ports=api_pb2.PortSpecs(ports=open_ports), network_access=network_access, + proxy_id=(proxy.object_id if proxy else None), ) # Note - `resolver.app_id` will be `None` for app-less sandboxes diff --git a/modal_proto/api.proto b/modal_proto/api.proto index 9f247233d..17de79a37 100644 --- a/modal_proto/api.proto +++ b/modal_proto/api.proto @@ -2082,6 +2082,8 @@ message Sandbox { // Network access configuration beyond simple allow/block. NetworkAccess network_access = 22; + + optional string proxy_id = 23; } message SandboxCreateRequest {