OpenHands with OpenVINO Model Server#

Description#

OpenHands is an open-source software engineering agent that can reason over multi-step tasks, write code, run commands in isolated sandboxes, and inspect the results. This demo configures OpenHands to use a model served by OpenVINO Model Server through the OpenAI-compatible REST API.


Setup#

Prerequisites#

Requirements:

  • Linux host with x86_64 architecture

  • Docker Engine and the Docker Compose v2 plugin

  • Enough RAM or GPU memory for the chosen model, plus disk space for the model and container images. The default 27B model requires substantially more memory than smaller models.

  • Access to ghcr.io to download the OpenHands Agent Canvas image

  • An Intel GPU supported by OpenVINO for the optional GPU deployment

  • A Hugging Face token in HF_TOKEN when the selected model requires authentication

Clone the repository and enter the demo directory:

git clone https://github.com/openvinotoolkit/model_server.git
cd model_server/demos/integration_with_OpenHands

Step 1: Start OVMS and OpenHands#

Compose starts both services, and OVMS downloads the default model, OpenVINO/Qwen3.8-27B-int8-ov, into a local cache.

The model cache defaults to ${HOME}/ovms-openhands/models. To use another location, export MODEL_CACHE_DIR before running the following commands. Set the host user and group IDs and create the cache directory so OVMS can write to it:

export HOST_UID="$(id -u)"
export HOST_GID="$(id -g)"
mkdir -p "${MODEL_CACHE_DIR:-${HOME}/ovms-openhands/models}"

NOTE: Other OpenVINO text-generation models from the OpenVINO model collection can also be used. If the default model does not fit in available memory, try a smaller model such as OpenVINO/gpt-oss-20b-int4-ov or OpenVINO/Qwen3-8b-int8-ov. Set its Hugging Face ID before starting Compose:

export MODEL_ID="OpenVINO/gpt-oss-20b-int4-ov"

For gated models, set HF_TOKEN in your shell before starting Compose. The token is passed to the OVMS container; avoid putting it in the Compose file or shell history.

Select the Compose profile based on whether a render device is present, then start the services. The GPU profile passes /dev/dri to OVMS; the CPU profile does not:

export COMPOSE_PROFILES="$(if ls /dev/dri/render* >/dev/null 2>&1; then printf gpu; else printf cpu; fi)"
export GPU_DEVICE_GID="$(stat -c '%g' /dev/dri/render* 2>/dev/null | head -n 1)"
docker compose -f compose.yaml up -d

OVMS selects a target device from those available inside its container. To select a device explicitly, export TARGET_DEVICE (for example, CPU or GPU) before starting Compose. Unset it to let OVMS choose automatically. A render device does not necessarily mean that a supported Intel GPU is available.

The default published ports are 8000 for OVMS and 3000 for OpenHands. To change them, export OVMS_REST_PORT and OPENHANDS_PORT before starting Compose. MODEL_CACHE_DIR changes the cache location and OVMS_IMAGE overrides the default openvino/model_server:weekly image. OpenHands starts while OVMS downloads and loads the model.

Step 2: Verify OVMS#

Check that the model is available:

curl http://localhost:${OVMS_REST_PORT:-8000}/v1/config

The response should contain "model_status": "AVAILABLE". Send a request through the same OpenAI-compatible endpoint used by OpenHands:

curl -X POST http://localhost:${OVMS_REST_PORT:-8000}/v3/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ovms-model",
    "messages": [{"role": "user", "content": "Say this is a test"}],
    "max_tokens": 10
  }'

The served model name is always ovms-model, including when MODEL_ID is changed.

Step 3: Start an OpenHands Task#

Open http://localhost:3000/canvas, or use the configured OPENHANDS_PORT. OpenHands Agent Canvas 1.46.0 stores its settings and conversations in a Docker volume. Settings from the previous 0.59 demo are not imported, and the existing .openhands directory is left unchanged.

On the welcome screen, select Skip for now:

OpenHands welcome screen

On the main screen, select Set up LLM:

OpenHands main screen before LLM setup

Select Add LLM Profile, then Advanced, and enter:

  • Profile Name: ovms-model

  • Custom Model: openai/ovms-model

  • Base URL: http://ovms-llm:8000/v3

  • API Key: unused

  • Native tool calling: enabled

OpenHands LLM profile setup

Save and select the profile before starting a task. Existing profiles are preserved; update any profile that uses a previous model name. The backend must be able to reach the base URL; localhost inside the OpenHands container does not refer to OVMS.

Create a task such as:

Create a Python function that calculates the factorial of a number and run a test.

Completed OpenHands factorial task

OpenHands should write the implementation and execute the test inside the Agent Canvas container. Choose a model that supports tool calling. Conversations share the container environment; this deployment does not create a separate sandbox container for each conversation. Do not mount sensitive host directories into it.

If the UI or backend does not start, inspect its logs:

docker compose -f compose.yaml logs openhands

The OVMS base URL is an internal Docker network address. Use http://localhost:8000/v3 only for clients running directly on the host.

To confirm that requests reach OVMS, run:

docker compose -f compose.yaml logs -f

Container Management#

Use the Compose configuration for routine operations:

docker compose -f compose.yaml ps
docker compose -f compose.yaml logs -f
docker compose -f compose.yaml restart
docker compose -f compose.yaml down

These commands use COMPOSE_PROFILES from the startup steps; set it again in a new shell. To switch profiles, run down with the current profile before starting the other one; this preserves the model cache and OpenHands data. After changing the model, device, image, or ports, run up -d again to recreate the affected containers. The old generated docker-compose.yml, if present, is not used by these commands.

References#