2020 SandboxClient ,
2121)
2222
23+ from rlm .constants .repl import APT_PACKAGES , PIP_PACKAGES
2324from rlm .core .comms_utils import LMRequest , send_lm_request , send_lm_request_batched
2425from rlm .core .types import REPLResult , RLMChatCompletion
2526from rlm .environments .base_env import IsolatedEnv
@@ -328,11 +329,13 @@ def setup(self):
328329 # Wait for sandbox to be ready
329330 self .client .wait_for_creation (self .sandbox_id , max_attempts = self .timeout_minutes * 60 )
330331
331- # Install dependencies for the broker
332- self .client .execute_command (
333- self .sandbox_id ,
334- "pip install flask requests dill" ,
335- )
332+ # Install apt dependencies
333+ apt_cmd = "apt-get update && apt-get install -y " + " " .join (APT_PACKAGES )
334+ self .client .execute_command (self .sandbox_id , apt_cmd )
335+
336+ # Install pip dependencies
337+ pip_cmd = "pip install " + " " .join (f'"{ pkg } "' for pkg in PIP_PACKAGES )
338+ self .client .execute_command (self .sandbox_id , pip_cmd )
336339
337340 # Write the broker script to the sandbox.
338341 # Unlike Modal's sandbox.exec() which accepts separate args, Prime's
@@ -410,6 +413,7 @@ def _poll_broker(self):
410413 # Get pending requests
411414 resp = requests .get (
412415 f"{ self .broker_url } /pending" ,
416+ timeout = 10 ,
413417 )
414418 pending = resp .json ().get ("pending" , [])
415419
@@ -424,6 +428,7 @@ def _poll_broker(self):
424428 requests .post (
425429 f"{ self .broker_url } /respond" ,
426430 json = {"id" : request_id , "response" : response },
431+ timeout = 10 ,
427432 )
428433
429434 except requests .exceptions .RequestException :
0 commit comments