Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:OpenHands OpenHands DaytonaRuntime Start Action Server

From Leeroopedia
Knowledge Sources
Domains Cloud_Infrastructure, Runtime_Management
Last Updated 2026-02-11 21:00 GMT

Overview

Concrete tool for starting the action execution server inside a Daytona sandbox, provided by the OpenHands third-party runtime layer.

Description

DaytonaRuntime._start_action_execution_server launches the HTTP action server as a background process inside the Daytona sandbox. It constructs the startup command using the shared utility get_action_execution_server_startup_command() from openhands.runtime.utils.command, which generates the correct invocation including the server port, working directory, plugin list, and user context. The method then executes this command inside the sandbox via the Daytona SDK's process execution API.

The action server runs as a persistent background process within the sandbox container. Once started, the orchestrator communicates with it via HTTP to execute actions, transfer files, and check health. The _wait_until_alive() method (called subsequently during connect()) polls the server's /alive endpoint to confirm it is ready to accept requests.

Note: E2B does not use this method. E2BRuntime bypasses the action server entirely and instead uses the E2B SDK's native execution API (E2BBox.execute) for command execution. Modal and Runloop runtimes implement their own versions of this method, each using their respective SDK's process execution capabilities to launch the same action server command.

Usage

This method is called internally during DaytonaRuntime.connect(), after the sandbox has been created by _create_sandbox() and before _wait_until_alive() is invoked. It is not intended to be called directly by external code.

Code Reference

Source Location

  • Repository: OpenHands
  • File: third_party/runtime/impl/daytona/daytona_runtime.py
  • Lines: L146-174

Signature

def _start_action_execution_server(self) -> None:

Import

from third_party.runtime.impl.daytona.daytona_runtime import DaytonaRuntime

# The startup command utility used internally:
from openhands.runtime.utils.command import get_action_execution_server_startup_command

I/O Contract

Inputs

Name Type Required Description
self DaytonaRuntime Yes A DaytonaRuntime instance with a created sandbox (i.e., _create_sandbox() has already been called)

Outputs

Name Type Description
None None The method returns None. On success, the action execution server is running as a background process inside the sandbox. On failure, an exception is raised.

Usage Examples

Basic Usage

# This method is called internally during connect().
# Typical usage is indirect:

from third_party.runtime.impl.daytona.daytona_runtime import DaytonaRuntime

runtime = DaytonaRuntime(
    config=openhands_config,
    event_stream=event_stream,
    sid="session-003",
)

# connect() calls _create_sandbox(), then _start_action_execution_server(),
# then _wait_until_alive() in sequence:
await runtime.connect()

Understanding the Startup Command

from openhands.runtime.utils.command import get_action_execution_server_startup_command

# The utility generates the full command line:
cmd = get_action_execution_server_startup_command(
    server_port=8000,
    working_dir="/workspace",
    plugins=runtime.plugins,
    is_root=True,
    extra_env_vars=runtime.env_vars,
)
# cmd is a string like:
# "python -m openhands.runtime.action_execution_server --port 8000 ..."

Related Pages

Implements Principle

Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment