def run_code(
        self,
        scripts: List[str],
        languages: Optional[List[str]] = None,
        timeout: Optional[int] = None,
        request_timeout: Optional[int] = None,
    ) -> List:
        """
        Execute multiple scripts using MorphCloud via the router.

        Args:
            scripts: List of code scripts to execute.
            languages: List of programming languages for each script. If None, defaults to Python for all scripts.
            timeout: Execution timeout in seconds. If None, uses the instance timeout.
            request_timeout: HTTP request timeout in seconds. If None, uses the instance request_timeout.

        Returns:
            List of execution results with text and exception_str properties.
        """

        actual_timeout = timeout if timeout is not None else self.timeout
        actual_request_timeout = request_timeout if request_timeout is not None else self.request_timeout

        # Default to Python for all scripts if languages is not provided
        if languages is None:
            languages = ["python"] * len(scripts)

        payload = {
            "scripts": scripts,
            "languages": languages,
            "timeout": actual_timeout,
            "request_timeout": actual_request_timeout,
        }

        try:
            endpoint = f"http://{self.router_url}/execute_batch"
            response = requests.post(endpoint, json=payload, timeout=actual_request_timeout)

            if response.status_code != 200:
                error = f"Request to MorphCloud router failed with status code: {response.status_code}"
                print(error)

                results = []
                for _ in scripts:
                    results.append(type("obj", (object,), {"text": None, "exception_str": error}))
                return results

            response_data = response.json()
            results = []

            for item in response_data:
                # Log the response data to see what we're getting
                # print(f"RoutedMorphSandbox: Got response item: {item}")
                result = type(
                    "obj",
                    (object,),
                    {
                        "text": item.get("text"),
                        "exception_str": item.get("exception_str"),
                    },
                )
                results.append(result)

            return results

        except Exception as e:
            error = f"Error communicating with MorphCloud router: {str(e)}"
            print(error)

            results = []
            for _ in scripts:
                results.append(type("obj", (object,), {"text": None, "exception_str": error}))
            return results

        Execute multiple scripts using MorphCloud via the router.

        Args:
            scripts: List of code scripts to execute.
            languages: List of programming languages for each script. If None, defaults to Python for all scripts.
            timeout: Execution timeout in seconds. If None, uses the instance timeout.
            request_timeout: HTTP request timeout in seconds. If None, uses the instance request_timeout.

        Returns:
            List of execution results with text and exception_str properties.
        
src/open_r1/utils/routed_morph.py