π OpenHands: AI-Driven Development
refactor: re-organize different runtime implementations into an impl folder (#4346)
Xingyao Wang2d5b360505d8
diff --git a/docs/modules/usage/architecture/runtime.md b/docs/modules/usage/architecture/runtime.mdindex 98e3d11da8..8747f7c590 100644--- a/docs/modules/usage/architecture/runtime.md+++ b/docs/modules/usage/architecture/runtime.md@@ -21,7 +21,7 @@ The OpenHands Runtime system uses a client-server architecture implemented withgraph TDA[User-provided Custom Docker Image] --> B[OpenHands Backend]B -->|Builds| C[OH Runtime Image]- C -->|Launches| D[Runtime Client]+ C -->|Launches| D[Action Executor]D -->|Initializes| E[Browser]D -->|Initializes| F[Bash Shell]D -->|Initializes| G[Plugins]@@ -49,10 +49,10 @@ graph TD1. User Input: The user provides a custom base Docker image2. Image Building: OpenHands builds a new Docker image (the "OH runtime image") based on the user-provided image. This new image includes OpenHands-specific code, primarily the "runtime client"3. Container Launch: When OpenHands starts, it launches a Docker container using the OH runtime image-4. Client Initialization: The runtime client initializes inside the container, setting up necessary components like a bash shell and loading any specified plugins-5. Communication: The OpenHands backend (`runtime.py`) communicates with the runtime client over RESTful API, sending actions and receiving observations+4. Action Execution Server Initialization: The action execution server initializes an `ActionExecutor` inside the container, setting up necessary components like a bash shell and loading any specified plugins+5. Communication: The OpenHands backend (`openhands/runtime/impl/eventstream/eventstream_runtime.py`) communicates with the action execution server over RESTful API, sending actions and receiving observations6. Action Execution: The runtime client receives actions from the backend, executes them in the sandboxed environment, and sends back observations-7. Observation Return: The client sends execution results back to the OpenHands backend as observations+7. Observation Return: The action execution server sends execution results back to the OpenHands backend as observationsThe role of the client:diff --git a/evaluation/agent_bench/run_infer.py b/evaluation/agent_bench/run_infer.pyindex b851f86fa4..f0ea180f4b 100644--- a/evaluation/agent_bench/run_infer.py+++ b/evaluation/agent_bench/run_infer.py@@ -32,7 +32,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import AgentFinishAction, CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimedef get_config(diff --git a/evaluation/aider_bench/run_infer.py b/evaluation/aider_bench/run_infer.pyindex 98e8f20888..c59de4f441 100644--- a/evaluation/aider_bench/run_infer.py+++ b/evaluation/aider_bench/run_infer.py@@ -32,7 +32,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtime# Configure visibility of unit tests to the Agent.USE_UNIT_TESTS = os.environ.get('USE_UNIT_TESTS', 'false').lower() == 'true'diff --git a/evaluation/biocoder/run_infer.py b/evaluation/biocoder/run_infer.pyindex 3574089291..9dcff6d6ef 100644--- a/evaluation/biocoder/run_infer.py+++ b/evaluation/biocoder/run_infer.py@@ -29,7 +29,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeAGENT_CLS_TO_FAKE_USER_RESPONSE_FN = {'CodeActAgent': functools.partial(diff --git a/evaluation/bird/run_infer.py b/evaluation/bird/run_infer.pyindex aae58cc7d5..0fba8c5c64 100644--- a/evaluation/bird/run_infer.py+++ b/evaluation/bird/run_infer.py@@ -32,7 +32,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimedef codeact_user_response(state: State) -> str:diff --git a/evaluation/gaia/run_infer.py b/evaluation/gaia/run_infer.pyindex 9f6f3884f5..f5794d3ad3 100644--- a/evaluation/gaia/run_infer.py+++ b/evaluation/gaia/run_infer.py@@ -28,7 +28,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import AgentFinishAction, CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeDATASET_CACHE_DIR = os.path.join(os.path.dirname(__file__), 'data')diff --git a/evaluation/humanevalfix/run_infer.py b/evaluation/humanevalfix/run_infer.pyindex 002fdd1e42..9b0abbc298 100644--- a/evaluation/humanevalfix/run_infer.py+++ b/evaluation/humanevalfix/run_infer.py@@ -37,7 +37,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeIMPORT_HELPER = {'python': [diff --git a/evaluation/integration_tests/run_infer.py b/evaluation/integration_tests/run_infer.pyindex 2c918b2ed8..ab631ab397 100644--- a/evaluation/integration_tests/run_infer.py+++ b/evaluation/integration_tests/run_infer.py@@ -24,7 +24,7 @@ from openhands.core.config import (from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import MessageAction-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeFAKE_RESPONSES = {'CodeActAgent': codeact_user_response,diff --git a/evaluation/integration_tests/tests/base.py b/evaluation/integration_tests/tests/base.pyindex ac53cfcb91..bc98b884d2 100644--- a/evaluation/integration_tests/tests/base.py+++ b/evaluation/integration_tests/tests/base.py@@ -3,7 +3,7 @@ from abc import ABC, abstractmethodfrom pydantic import BaseModelfrom openhands.events.event import Event-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimeclass TestResult(BaseModel):diff --git a/evaluation/integration_tests/tests/t01_fix_simple_typo.py b/evaluation/integration_tests/tests/t01_fix_simple_typo.pyindex ef9fe2edd0..4cfa331df1 100644--- a/evaluation/integration_tests/tests/t01_fix_simple_typo.py+++ b/evaluation/integration_tests/tests/t01_fix_simple_typo.py@@ -4,7 +4,7 @@ import tempfilefrom evaluation.integration_tests.tests.base import BaseIntegrationTest, TestResultfrom openhands.events.action import CmdRunActionfrom openhands.events.event import Event-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimeclass Test(BaseIntegrationTest):diff --git a/evaluation/integration_tests/tests/t02_add_bash_hello.py b/evaluation/integration_tests/tests/t02_add_bash_hello.pyindex 5ac031e887..ac82e89bac 100644--- a/evaluation/integration_tests/tests/t02_add_bash_hello.py+++ b/evaluation/integration_tests/tests/t02_add_bash_hello.py@@ -2,7 +2,7 @@ from evaluation.integration_tests.tests.base import BaseIntegrationTest, TestResfrom evaluation.utils.shared import assert_and_raisefrom openhands.events.action import CmdRunActionfrom openhands.events.event import Event-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimeclass Test(BaseIntegrationTest):diff --git a/evaluation/integration_tests/tests/t03_jupyter_write_file.py b/evaluation/integration_tests/tests/t03_jupyter_write_file.pyindex 8e48106632..e1ed6c27c4 100644--- a/evaluation/integration_tests/tests/t03_jupyter_write_file.py+++ b/evaluation/integration_tests/tests/t03_jupyter_write_file.py@@ -2,7 +2,7 @@ from evaluation.integration_tests.tests.base import BaseIntegrationTest, TestResfrom evaluation.utils.shared import assert_and_raisefrom openhands.events.action import CmdRunActionfrom openhands.events.event import Event-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimeclass Test(BaseIntegrationTest):diff --git a/evaluation/integration_tests/tests/t04_git_staging.py b/evaluation/integration_tests/tests/t04_git_staging.pyindex 32638a289e..aadb861203 100644--- a/evaluation/integration_tests/tests/t04_git_staging.py+++ b/evaluation/integration_tests/tests/t04_git_staging.py@@ -2,7 +2,7 @@ from evaluation.integration_tests.tests.base import BaseIntegrationTest, TestResfrom evaluation.utils.shared import assert_and_raisefrom openhands.events.action import CmdRunActionfrom openhands.events.event import Event-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimeclass Test(BaseIntegrationTest):diff --git a/evaluation/integration_tests/tests/t05_simple_browsing.py b/evaluation/integration_tests/tests/t05_simple_browsing.pyindex 8462de9c38..8f08cb4e72 100644--- a/evaluation/integration_tests/tests/t05_simple_browsing.py+++ b/evaluation/integration_tests/tests/t05_simple_browsing.py@@ -6,7 +6,7 @@ from evaluation.utils.shared import assert_and_raisefrom openhands.events.action import AgentFinishAction, CmdRunAction, MessageActionfrom openhands.events.event import Eventfrom openhands.events.observation import AgentDelegateObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeHTML_FILE = """<!DOCTYPE html>diff --git a/evaluation/logic_reasoning/run_infer.py b/evaluation/logic_reasoning/run_infer.pyindex 7fa6a5bb50..b07af7b08c 100644--- a/evaluation/logic_reasoning/run_infer.py+++ b/evaluation/logic_reasoning/run_infer.py@@ -29,7 +29,7 @@ from openhands.events.action import (MessageAction,)from openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeAGENT_CLS_TO_FAKE_USER_RESPONSE_FN = {'CodeActAgent': codeact_user_response,diff --git a/evaluation/miniwob/run_infer.py b/evaluation/miniwob/run_infer.pyindex 1df7dac028..ccd36f2d38 100644--- a/evaluation/miniwob/run_infer.py+++ b/evaluation/miniwob/run_infer.py@@ -30,11 +30,11 @@ from openhands.events.action import (MessageAction,)from openhands.events.observation import CmdOutputObservation+from openhands.runtime.base import Runtimefrom openhands.runtime.browser.browser_env import (BROWSER_EVAL_GET_GOAL_ACTION,BROWSER_EVAL_GET_REWARDS_ACTION,)-from openhands.runtime.runtime import RuntimeSUPPORTED_AGENT_CLS = {'BrowsingAgent'}diff --git a/evaluation/mint/run_infer.py b/evaluation/mint/run_infer.pyindex 481336d59d..80127420a4 100644--- a/evaluation/mint/run_infer.py+++ b/evaluation/mint/run_infer.py@@ -32,7 +32,7 @@ from openhands.events.action import (MessageAction,)from openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimedef codeact_user_response_mint(state: State, task: Task, task_config: dict[str, int]):diff --git a/evaluation/ml_bench/run_infer.py b/evaluation/ml_bench/run_infer.pyindex 671c6350a4..0f1ba0ab95 100644--- a/evaluation/ml_bench/run_infer.py+++ b/evaluation/ml_bench/run_infer.py@@ -41,7 +41,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimeconfig = load_app_config()diff --git a/evaluation/swe_bench/run_infer.py b/evaluation/swe_bench/run_infer.pyindex e0539143de..18b7daac01 100644--- a/evaluation/swe_bench/run_infer.py+++ b/evaluation/swe_bench/run_infer.py@@ -33,7 +33,7 @@ from openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation, ErrorObservationfrom openhands.events.serialization.event import event_to_dict-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimefrom openhands.runtime.utils.shutdown_listener import sleep_if_should_continueUSE_HINT_TEXT = os.environ.get('USE_HINT_TEXT', 'false').lower() == 'true'diff --git a/evaluation/toolqa/run_infer.py b/evaluation/toolqa/run_infer.pyindex 8b3ebdc58b..85f565120a 100644--- a/evaluation/toolqa/run_infer.py+++ b/evaluation/toolqa/run_infer.py@@ -25,7 +25,7 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.main import create_runtime, run_controllerfrom openhands.events.action import CmdRunAction, MessageActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import RuntimeAGENT_CLS_TO_FAKE_USER_RESPONSE_FN = {'CodeActAgent': codeact_user_response,diff --git a/evaluation/webarena/run_infer.py b/evaluation/webarena/run_infer.pyindex 26637e00be..2291aa08c8 100644--- a/evaluation/webarena/run_infer.py+++ b/evaluation/webarena/run_infer.py@@ -30,11 +30,11 @@ from openhands.events.action import (MessageAction,)from openhands.events.observation import CmdOutputObservation+from openhands.runtime.base import Runtimefrom openhands.runtime.browser.browser_env import (BROWSER_EVAL_GET_GOAL_ACTION,BROWSER_EVAL_GET_REWARDS_ACTION,)-from openhands.runtime.runtime import RuntimeSUPPORTED_AGENT_CLS = {'BrowsingAgent'}diff --git a/openhands/core/cli.py b/openhands/core/cli.pyindex b87674e751..73b11f30e8 100644--- a/openhands/core/cli.py+++ b/openhands/core/cli.py@@ -30,7 +30,7 @@ from openhands.events.observation import ()from openhands.llm.llm import LLMfrom openhands.runtime import get_runtime_cls-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimefrom openhands.storage import get_file_storediff --git a/openhands/core/main.py b/openhands/core/main.pyindex 0ebcde8527..3934349f0c 100644--- a/openhands/core/main.py+++ b/openhands/core/main.py@@ -26,7 +26,7 @@ from openhands.events.observation import AgentStateChangedObservationfrom openhands.events.serialization.event import event_to_trajectoryfrom openhands.llm.llm import LLMfrom openhands.runtime import get_runtime_cls-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimefrom openhands.storage import get_file_storediff --git a/openhands/runtime/README.md b/openhands/runtime/README.mdindex 72c18f7896..ca084706fb 100644--- a/openhands/runtime/README.md+++ b/openhands/runtime/README.md@@ -7,9 +7,9 @@ You can learn more about how the runtime works in the [EventStream Runtime](http## Main Components-### 1. runtime.py+### 1. impl/*runtime.py-The `runtime.py` file defines the `Runtime` class, which serves as the primary interface for agent interactions with the external environment. It handles various operations including:+The `impl/*runtime.py` file defines the `Runtime` class, which serves as the primary [interface](./base.py) for agent interactions with the external environment. It handles various operations including:- Bash sandbox execution- Browser interactions@@ -23,11 +23,11 @@ Key features of the `Runtime` class:- Action execution methods for different types of actions (run, read, write, browse, etc.)- Abstract methods for file operations (to be implemented by subclasses)-### 2. client/client.py+### 2. action_execution_server.py-The `client.py` file contains the `RuntimeClient` class, which is responsible for executing actions received from the OpenHands backend and producing observations. This client runs inside a Docker sandbox.+The `action_executor_server.py` file contains the `ActionExecutor` class, which is responsible for executing actions received from the OpenHands backend and producing observations. This client runs inside a Docker sandbox.-Key features of the `RuntimeClient` class:+Key features of the `ActionExecutor` class:- Initialization of user environment and bash shell- Plugin management and initialization- Execution of various action types (bash commands, IPython cells, file operations, browsing)@@ -59,7 +59,7 @@ Key features of the `RuntimeClient` class:- Plugins like Jupyter and AgentSkills are initialized and integrated into the runtime.6. **Sandbox Environment**:- - The `RuntimeClient` sets up a sandboxed environment inside a Docker container.+ - The `ActionExecutor` sets up a sandboxed environment inside a Docker container.- User environment and bash shell are initialized.- Actions received from the OpenHands backend are executed in this sandboxed environment.@@ -96,7 +96,7 @@ This is the default runtime used within OpenHands.The Remote Runtime is designed for execution in a remote environment:-- Connects to a remote server running the RuntimeClient+- Connects to a remote server running the ActionExecutor- Executes actions by sending requests to the remote client- Supports distributed execution and cloud-based deployments- Ideal for production environments, scalability, and scenarios where local resource constraints are a concerndiff --git a/openhands/runtime/__init__.py b/openhands/runtime/__init__.pyindex df73be9d83..f06121bb2a 100644--- a/openhands/runtime/__init__.py+++ b/openhands/runtime/__init__.py@@ -1,24 +1,26 @@from openhands.core.logger import openhands_logger as logger-from openhands.runtime.e2b.sandbox import E2BBox+from openhands.runtime.impl.e2b.sandbox import E2BBoxdef get_runtime_cls(name: str):# Local imports to avoid circular importsif name == 'eventstream':- from openhands.runtime.client.runtime import EventStreamRuntime+ from openhands.runtime.impl.eventstream.eventstream_runtime import (+ EventStreamRuntime,+ )return EventStreamRuntimeelif name == 'e2b':- from openhands.runtime.e2b.runtime import E2BRuntime+ from openhands.runtime.impl.e2b.e2b_runtime import E2BRuntimereturn E2BRuntimeelif name == 'remote':- from openhands.runtime.remote.runtime import RemoteRuntime+ from openhands.runtime.impl.remote.remote_runtime import RemoteRuntimereturn RemoteRuntimeelif name == 'modal':logger.info('Using ModalRuntime')- from openhands.runtime.modal.runtime import ModalRuntime+ from openhands.runtime.impl.modal.modal_runtime import ModalRuntimereturn ModalRuntimeelse:diff --git a/openhands/runtime/client/client.py b/openhands/runtime/action_execution_server.pysimilarity index 99%rename from openhands/runtime/client/client.pyrename to openhands/runtime/action_execution_server.pyindex 89fd230652..719d206e5a 100644--- a/openhands/runtime/client/client.py+++ b/openhands/runtime/action_execution_server.py@@ -78,8 +78,8 @@ def verify_api_key(api_key: str = Depends(api_key_header)):return api_key-class RuntimeClient:- """RuntimeClient is running inside docker sandbox.+class ActionExecutor:+ """ActionExecutor is running inside docker sandbox.It is responsible for executing actions received from OpenHands backend and producing observations."""@@ -629,12 +629,12 @@ if __name__ == '__main__':raise ValueError(f'Plugin {plugin} not found')plugins_to_load.append(ALL_PLUGINS[plugin]()) # type: ignore- client: RuntimeClient | None = None+ client: ActionExecutor | None = None@asynccontextmanagerasync def lifespan(app: FastAPI):global client- client = RuntimeClient(+ client = ActionExecutor(plugins_to_load,work_dir=args.working_dir,username=args.username,diff --git a/openhands/runtime/runtime.py b/openhands/runtime/base.pysimilarity index 100%rename from openhands/runtime/runtime.pyrename to openhands/runtime/base.pydiff --git a/openhands/runtime/e2b/README.md b/openhands/runtime/impl/e2b/README.mdsimilarity index 100%rename from openhands/runtime/e2b/README.mdrename to openhands/runtime/impl/e2b/README.mddiff --git a/openhands/runtime/e2b/runtime.py b/openhands/runtime/impl/e2b/e2b_runtime.pysimilarity index 93%rename from openhands/runtime/e2b/runtime.pyrename to openhands/runtime/impl/e2b/e2b_runtime.pyindex d2988895ba..b5233574f0 100644--- a/openhands/runtime/e2b/runtime.py+++ b/openhands/runtime/impl/e2b/e2b_runtime.py@@ -12,10 +12,10 @@ from openhands.events.observation import (Observation,)from openhands.events.stream import EventStream-from openhands.runtime.e2b.filestore import E2BFileStore-from openhands.runtime.e2b.sandbox import E2BSandbox+from openhands.runtime.base import Runtime+from openhands.runtime.impl.e2b.filestore import E2BFileStore+from openhands.runtime.impl.e2b.sandbox import E2BSandboxfrom openhands.runtime.plugins import PluginRequirement-from openhands.runtime.runtime import Runtimefrom openhands.runtime.utils.files import insert_lines, read_linesdiff --git a/openhands/runtime/e2b/filestore.py b/openhands/runtime/impl/e2b/filestore.pysimilarity index 100%rename from openhands/runtime/e2b/filestore.pyrename to openhands/runtime/impl/e2b/filestore.pydiff --git a/openhands/runtime/e2b/sandbox.py b/openhands/runtime/impl/e2b/sandbox.pysimilarity index 99%rename from openhands/runtime/e2b/sandbox.pyrename to openhands/runtime/impl/e2b/sandbox.pyindex a8f4c6de98..044a45d8ee 100644--- a/openhands/runtime/e2b/sandbox.py+++ b/openhands/runtime/impl/e2b/sandbox.py@@ -7,7 +7,6 @@ from e2b import Sandbox as E2BSandboxfrom e2b.sandbox.exception import (TimeoutException,)-from openhands.core.config import SandboxConfigfrom openhands.core.logger import openhands_logger as loggerdiff --git a/openhands/runtime/client/runtime.py b/openhands/runtime/impl/eventstream/eventstream_runtime.pysimilarity index 99%rename from openhands/runtime/client/runtime.pyrename to openhands/runtime/impl/eventstream/eventstream_runtime.pyindex 61d9a7a490..358e3c0907 100644--- a/openhands/runtime/client/runtime.py+++ b/openhands/runtime/impl/eventstream/eventstream_runtime.py@@ -31,9 +31,9 @@ from openhands.events.observation import ()from openhands.events.serialization import event_to_dict, observation_from_dictfrom openhands.events.serialization.action import ACTION_TYPE_TO_CLASS+from openhands.runtime.base import Runtimefrom openhands.runtime.builder import DockerRuntimeBuilderfrom openhands.runtime.plugins import PluginRequirement-from openhands.runtime.runtime import Runtimefrom openhands.runtime.utils import find_available_tcp_portfrom openhands.runtime.utils.request import send_request_with_retryfrom openhands.runtime.utils.runtime_build import build_runtime_image@@ -304,7 +304,7 @@ class EventStreamRuntime(Runtime):command=(f'/openhands/micromamba/bin/micromamba run -n openhands 'f'poetry run '- f'python -u -m openhands.runtime.client.client {self._container_port} '+ f'python -u -m openhands.runtime.action_execution_server {self._container_port} 'f'--working-dir "{sandbox_workspace_dir}" 'f'{plugin_arg}'f'--username {"openhands" if self.config.run_as_openhands else "root"} 'diff --git a/openhands/runtime/modal/runtime.py b/openhands/runtime/impl/modal/modal_runtime.pysimilarity index 100%rename from openhands/runtime/modal/runtime.pyrename to openhands/runtime/impl/modal/modal_runtime.pydiff --git a/openhands/runtime/remote/runtime.py b/openhands/runtime/impl/remote/remote_runtime.pysimilarity index 99%rename from openhands/runtime/remote/runtime.pyrename to openhands/runtime/impl/remote/remote_runtime.pyindex 39134f5094..40779f2abd 100644--- a/openhands/runtime/remote/runtime.py+++ b/openhands/runtime/impl/remote/remote_runtime.py@@ -28,9 +28,9 @@ from openhands.events.observation import ()from openhands.events.serialization import event_to_dict, observation_from_dictfrom openhands.events.serialization.action import ACTION_TYPE_TO_CLASS+from openhands.runtime.base import Runtimefrom openhands.runtime.builder.remote import RemoteRuntimeBuilderfrom openhands.runtime.plugins import PluginRequirement-from openhands.runtime.runtime import Runtimefrom openhands.runtime.utils.request import (is_404_error,is_503_error,@@ -212,7 +212,7 @@ class RemoteRuntime(Runtime):'command': (f'/openhands/micromamba/bin/micromamba run -n openhands ''poetry run '- f'python -u -m openhands.runtime.client.client {self.port} '+ f'python -u -m openhands.runtime.action_execution_server {self.port} 'f'--working-dir {self.config.workspace_mount_path_in_sandbox} 'f'{plugin_arg}'f'--username {"openhands" if self.config.run_as_openhands else "root"} 'diff --git a/openhands/server/listen.py b/openhands/server/listen.pyindex 34ac732f57..a082031205 100644--- a/openhands/server/listen.py+++ b/openhands/server/listen.py@@ -54,7 +54,7 @@ from openhands.events.observation import ()from openhands.events.serialization import event_to_dictfrom openhands.llm import bedrock-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimefrom openhands.server.auth import get_sid_from_token, sign_tokenfrom openhands.server.session import SessionManagerdiff --git a/openhands/server/session/agent_session.py b/openhands/server/session/agent_session.pyindex bbb568ee48..c408cfd921 100644--- a/openhands/server/session/agent_session.py+++ b/openhands/server/session/agent_session.py@@ -11,7 +11,7 @@ from openhands.events.action.agent import ChangeAgentStateActionfrom openhands.events.event import EventSourcefrom openhands.events.stream import EventStreamfrom openhands.runtime import get_runtime_cls-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimefrom openhands.security import SecurityAnalyzer, optionsfrom openhands.storage.files import FileStorefrom openhands.utils.async_utils import call_sync_from_asyncdiff --git a/openhands/server/session/conversation.py b/openhands/server/session/conversation.pyindex dc2ca833ff..a15ec22f32 100644--- a/openhands/server/session/conversation.py+++ b/openhands/server/session/conversation.py@@ -1,7 +1,7 @@from openhands.core.config import AppConfigfrom openhands.events.stream import EventStreamfrom openhands.runtime import get_runtime_cls-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtimefrom openhands.security import SecurityAnalyzer, optionsfrom openhands.storage.files import FileStorediff --git a/tests/runtime/conftest.py b/tests/runtime/conftest.pyindex a20795d18d..7affbfc040 100644--- a/tests/runtime/conftest.py+++ b/tests/runtime/conftest.py@@ -11,10 +11,10 @@ from pytest import TempPathFactoryfrom openhands.core.config import load_app_configfrom openhands.core.logger import openhands_logger as loggerfrom openhands.events import EventStream-from openhands.runtime.client.runtime import EventStreamRuntime+from openhands.runtime.base import Runtime+from openhands.runtime.impl.eventstream.eventstream_runtime import EventStreamRuntime+from openhands.runtime.impl.remote.remote_runtime import RemoteRuntimefrom openhands.runtime.plugins import AgentSkillsRequirement, JupyterRequirement-from openhands.runtime.remote.runtime import RemoteRuntime-from openhands.runtime.runtime import Runtimefrom openhands.storage import get_file_storeTEST_IN_CI = os.getenv('TEST_IN_CI', 'False').lower() in ['true', '1', 'yes']diff --git a/tests/runtime/test_bash.py b/tests/runtime/test_bash.pyindex b11e8093b1..cfe480102d 100644--- a/tests/runtime/test_bash.py+++ b/tests/runtime/test_bash.py@@ -1,4 +1,4 @@-"""Bash-related tests for the EventStreamRuntime, which connects to the RuntimeClient running in the sandbox."""+"""Bash-related tests for the EventStreamRuntime, which connects to the ActionExecutor running in the sandbox."""import os@@ -13,7 +13,7 @@ from conftest import (from openhands.core.logger import openhands_logger as loggerfrom openhands.events.action import CmdRunActionfrom openhands.events.observation import CmdOutputObservation-from openhands.runtime.runtime import Runtime+from openhands.runtime.base import Runtime# ============================================================================================================================# Bash-specific testsdiff --git a/tests/runtime/test_browsing.py b/tests/runtime/test_browsing.pyindex 1d3a42131b..264d7c4803 100644--- a/tests/runtime/test_browsing.py+++ b/tests/runtime/test_browsing.py@@ -1,4 +1,4 @@-"""Browsing-related tests for the EventStreamRuntime, which connects to the RuntimeClient running in the sandbox."""+"""Browsing-related tests for the EventStreamRuntime, which connects to the ActionExecutor running in the sandbox."""import jsondiff --git a/tests/runtime/test_env_vars.py b/tests/runtime/test_env_vars.pyindex 70740c96a2..79773457a5 100644--- a/tests/runtime/test_env_vars.py+++ b/tests/runtime/test_env_vars.py@@ -1,4 +1,4 @@-"""Env vars related tests for the EventStreamRuntime, which connects to the RuntimeClient running in the sandbox."""+"""Env vars related tests for the EventStreamRuntime, which connects to the ActionExecutor running in the sandbox."""import osfrom unittest.mock import patchdiff --git a/tests/runtime/test_images.py b/tests/runtime/test_images.pyindex 5ef099f47c..e5f3ded04a 100644--- a/tests/runtime/test_images.py+++ b/tests/runtime/test_images.py@@ -1,4 +1,4 @@-"""Image-related tests for the EventStreamRuntime, which connects to the RuntimeClient running in the sandbox."""+"""Image-related tests for the EventStreamRuntime, which connects to the ActionExecutor running in the sandbox."""import pytestfrom conftest import _close_test_runtime, _load_runtimediff --git a/tests/runtime/test_ipython.py b/tests/runtime/test_ipython.pyindex 0d13fda2c3..c16baa7b0e 100644--- a/tests/runtime/test_ipython.py+++ b/tests/runtime/test_ipython.py@@ -1,4 +1,4 @@-"""Test the EventStreamRuntime, which connects to the RuntimeClient running in the sandbox."""+"""Test the EventStreamRuntime, which connects to the ActionExecutor running in the sandbox."""import pytestfrom conftest import (