1414)
1515from rlm .environments .local_repl import LocalREPL
1616
17+
18+ def __getattr__ (name : str ) -> Any :
19+ # Lazy-load environments with optional dependencies so that the package
20+ # imports cleanly even when those extras aren't installed.
21+ if name == "IPythonREPL" :
22+ from rlm .environments .ipython_repl import IPythonREPL
23+
24+ return IPythonREPL
25+ raise AttributeError (f"module { __name__ !r} has no attribute { name !r} " )
26+
27+
1728__all__ = [
1829 "BaseEnv" ,
30+ "IPythonREPL" ,
1931 "LocalREPL" ,
2032 "RESERVED_TOOL_NAMES" ,
2133 "SupportsCustomTools" ,
3143
3244
3345def get_environment (
34- environment : Literal ["local" , "modal" , "docker" , "daytona" , "prime" , "e2b" ],
46+ environment : Literal ["local" , "ipython" , " modal" , "docker" , "daytona" , "prime" , "e2b" ],
3547 environment_kwargs : dict [str , Any ],
3648) -> BaseEnv :
3749 """
3850 Routes a specific environment and the args (as a dict) to the appropriate environment if supported.
39- Currently supported environments: ['local', 'modal', 'docker', 'daytona', 'prime', 'e2b']
51+ Currently supported environments: ['local', 'ipython', ' modal', 'docker', 'daytona', 'prime', 'e2b']
4052 """
4153 if environment == "local" :
4254 return LocalREPL (** environment_kwargs )
55+ elif environment == "ipython" :
56+ from rlm .environments .ipython_repl import IPythonREPL
57+
58+ return IPythonREPL (** environment_kwargs )
4359 elif environment == "modal" :
4460 from rlm .environments .modal_repl import ModalREPL
4561
@@ -62,5 +78,5 @@ def get_environment(
6278 return E2BREPL (** environment_kwargs )
6379 else :
6480 raise ValueError (
65- f"Unknown environment: { environment } . Supported: ['local', 'modal', 'docker', 'daytona', 'prime', 'e2b']"
81+ f"Unknown environment: { environment } . Supported: ['local', 'ipython', ' modal', 'docker', 'daytona', 'prime', 'e2b']"
6682 )
0 commit comments