diff --git a/lazyllm/tools/agent/toolsManager.py b/lazyllm/tools/agent/toolsManager.py index d79c7b542..fb1a00e7f 100644 --- a/lazyllm/tools/agent/toolsManager.py +++ b/lazyllm/tools/agent/toolsManager.py @@ -52,7 +52,7 @@ def _check_return_type_is_the_same(doc_type_hints, func_type_hints) -> None: # ---------------------------------------------------------------------------- # class ModuleTool(ModuleBase, metaclass=LazyLLMRegisterMetaClass): - def __init__(self, verbose: bool = False, return_trace: bool = True, execute_in_sandbox: bool = True): + def __init__(self, verbose: bool = False, return_trace: bool = False, execute_in_sandbox: bool = True): super().__init__(return_trace=return_trace) self._verbose = verbose func = getattr(self.apply, '__func__', self.apply) diff --git a/lazyllm/tools/sandbox/dummy_sandbox.py b/lazyllm/tools/sandbox/dummy_sandbox.py index 96fed6698..9e1582c0a 100644 --- a/lazyllm/tools/sandbox/dummy_sandbox.py +++ b/lazyllm/tools/sandbox/dummy_sandbox.py @@ -14,7 +14,7 @@ class DummySandbox(LazyLLMSandboxBase): SUPPORTED_LANGUAGES: List[str] = ['python'] - def __init__(self, timeout: int = 30, return_trace: bool = True, project_dir: Optional[str] = None, + def __init__(self, timeout: int = 30, return_trace: bool = False, project_dir: Optional[str] = None, return_sandbox_result: bool = False): super().__init__(return_trace=return_trace, project_dir=project_dir, return_sandbox_result=return_sandbox_result) @@ -96,10 +96,7 @@ def _execute(self, code: str, language: str, context: dict, script_path = os.path.join(temp_dir, '_script.py') with open(script_path, 'w', encoding='utf-8') as f: f.write(code) - env = os.environ.copy() - env['HOME'] = temp_dir - env['PYTHONPATH'] = temp_dir - proc_result = self._run_in_subprocess(script_path, cwd=temp_dir, env=env) + proc_result = self._run_in_subprocess(script_path, cwd=temp_dir) return _SandboxResult( success=(proc_result['returncode'] == 0), stdout=proc_result['stdout'], diff --git a/lazyllm/tools/sandbox/sandbox_base.py b/lazyllm/tools/sandbox/sandbox_base.py index 8315175cf..1714492d9 100644 --- a/lazyllm/tools/sandbox/sandbox_base.py +++ b/lazyllm/tools/sandbox/sandbox_base.py @@ -39,7 +39,7 @@ def to_dict(self) -> dict: class LazyLLMSandboxBase(ModuleBase, metaclass=LazyLLMRegisterMetaClass): SUPPORTED_LANGUAGES: List[str] = [] - def __init__(self, output_dir_path: Optional[str] = None, return_trace: bool = True, + def __init__(self, output_dir_path: Optional[str] = None, return_trace: bool = False, project_dir: Optional[str] = None, return_sandbox_result: bool = False): super().__init__(return_trace=return_trace) self._output_dir_path = output_dir_path or os.getcwd() diff --git a/lazyllm/tools/sandbox/sandbox_fusion.py b/lazyllm/tools/sandbox/sandbox_fusion.py index 10b633fda..28088f2c6 100644 --- a/lazyllm/tools/sandbox/sandbox_fusion.py +++ b/lazyllm/tools/sandbox/sandbox_fusion.py @@ -19,7 +19,7 @@ class SandboxFusion(LazyLLMSandboxBase): def __init__(self, base_url: str = config['sandbox_fusion_base_url'], compile_timeout: int = 10, run_timeout: int = 10, memory_limit_mb: int = -1, project_dir: str = None, - return_sandbox_result: bool = False, return_trace: bool = True): + return_sandbox_result: bool = False, return_trace: bool = False): super().__init__(return_trace=return_trace, project_dir=project_dir, return_sandbox_result=return_sandbox_result) self._base_url = base_url self._compile_timeout = compile_timeout