Skip to content

Resolve PR 2910: optional Vertex AI bundle#3776

Open
neubig wants to merge 7 commits into
mainfrom
fix/pr-2910-vertex-conflicts
Open

Resolve PR 2910: optional Vertex AI bundle#3776
neubig wants to merge 7 commits into
mainfrom
fix/pr-2910-vertex-conflicts

Conversation

@neubig

@neubig neubig commented Jun 17, 2026

Copy link
Copy Markdown
Member

HUMAN:

Requested follow-up for #2910: fix merge conflicts, reflect worthwhile review comments, and open a replacement PR if the original fork branch cannot be updated.


AGENT:

Why

Replacement for #2910 because I could not push to the original fork branch (trustle:adam/install-aiplatform-for-vertex-ai; GitHub returned 403). This carries forward the Vertex AI optional-extra work from #2910, merged with current main.

Summary

  • Resolved the conflict against current main in the shared LLM transport path.
  • Kept google-cloud-aiplatform as the openhands-sdk[vertex] optional extra and preserved the lean default agent-server build with Vertex as an opt-in bundle.
  • Reflected useful review feedback by shortening the PyInstaller spec comment, replacing repeated list concatenation with extend(), and regenerating uv.lock from current main so the unrelated pypdf/lxml downgrade concern is gone.

Issue Number

Related PR: #2910

Fixes #3785

How to Test

Commands run locally:

uv lock --check
uv run ruff check openhands-sdk/openhands/sdk/llm/llm.py openhands-sdk/openhands/sdk/llm/utils/vertex_preflight.py tests/sdk/llm/test_vertex_preflight.py
uv run ruff format --check openhands-sdk/openhands/sdk/llm/llm.py openhands-sdk/openhands/sdk/llm/utils/vertex_preflight.py tests/sdk/llm/test_vertex_preflight.py
uv run pytest tests/sdk/llm/test_vertex_preflight.py tests/sdk/llm/test_llm.py::test_openhands_provider_translates_only_for_litellm

Result: all commands passed. The pytest run collected 4 tests and all 4 passed.

Video/Screenshots

Not applicable; this is dependency/transport/build configuration work with no UI surface.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

The GitHub connector could not create the PR (Resource not accessible by integration), so the PR was opened with the authenticated gh CLI. I also commented on #2910 with a link to this replacement.


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:c78b23b-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-c78b23b-python \
  ghcr.io/openhands/agent-server:c78b23b-python

All tags pushed for this build

ghcr.io/openhands/agent-server:c78b23b-golang-amd64
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-golang-amd64
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-golang-amd64
ghcr.io/openhands/agent-server:c78b23b-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:c78b23b-golang-arm64
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-golang-arm64
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-golang-arm64
ghcr.io/openhands/agent-server:c78b23b-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:c78b23b-java-amd64
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-java-amd64
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-java-amd64
ghcr.io/openhands/agent-server:c78b23b-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:c78b23b-java-arm64
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-java-arm64
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-java-arm64
ghcr.io/openhands/agent-server:c78b23b-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:c78b23b-python-amd64
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-python-amd64
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-python-amd64
ghcr.io/openhands/agent-server:c78b23b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:c78b23b-python-arm64
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-python-arm64
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-python-arm64
ghcr.io/openhands/agent-server:c78b23b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:c78b23b-golang
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-golang
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-golang
ghcr.io/openhands/agent-server:c78b23b-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:c78b23b-java
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-java
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-java
ghcr.io/openhands/agent-server:c78b23b-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:c78b23b-python
ghcr.io/openhands/agent-server:c78b23b40ec24e1dab732a8a7fc91d3e8f087304-python
ghcr.io/openhands/agent-server:fix-pr-2910-vertex-conflicts-python
ghcr.io/openhands/agent-server:c78b23b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim

About Multi-Architecture Support

  • Each variant tag (e.g., c78b23b-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., c78b23b-python-amd64) are also available if needed

abguymon and others added 6 commits May 6, 2026 11:25
Adds google-cloud-aiplatform as a required dep so LiteLLM's
vertex_ai_partner_models handler can route to Vertex AI Model Garden
MaaS endpoints (MiniMax, Qwen, Kimi, etc.). Without it, requests like
vertex_ai/minimaxai/minimax-m2-maas, vertex_ai/qwen/qwen3-coder-*-maas,
vertex_ai/moonshotai/kimi-k2-thinking-maas fail with:

    litellm.BadRequestError: Vertex_aiException BadRequestError -
    vertexai import failed please run
    `pip install -U "google-cloud-aiplatform>=1.38"`.
    Got error: No module named 'vertexai'

Changes:
- openhands-sdk/pyproject.toml: add "google-cloud-aiplatform>=1.38"
- uv.lock: regenerated (+7 transitive packages)
- agent-server.spec: collect vertexai/google.cloud.aiplatform/google.api_core
  submodules as hidden imports (the vertexai import is deferred inside
  litellm function bodies, so PyInstaller static analysis misses it),
  pin google.rpc.status_pb2 (dynamic gRPC proto stub), and copy package
  metadata.

Supersedes #2373 (closed without merging) and lands the spec-side
changes needed for the bundled binary to actually work at runtime.
Addresses review feedback on #2910. Mirrors the existing `boto3` extra
pattern so the base `openhands-sdk` install stays lean (the Vertex SDK
adds ~80 MiB to site-packages and ~62 MiB to the PyInstaller binary).

- pyproject.toml: move `google-cloud-aiplatform` from base deps into
  `[project.optional-dependencies]` as `vertex`.
- llm.py / vertex_preflight.py: when the inferred provider is
  `vertex_ai` and `vertexai` is not importable, raise a friendly
  `LLMBadRequestError` with an install hint
  (`pip install "openhands-sdk[vertex]"`) instead of letting LiteLLM
  crash with a low-level `ModuleNotFoundError`.
- agent-server.spec: skip the Vertex `collect_all` block (and the
  `google.rpc.status_pb2` pin) when `vertexai` is not installed, so
  local PyInstaller builds without the extra still succeed.
- docker/Dockerfile: add `--extra vertex` to both `uv sync` calls so
  the published agent-server binary continues to bundle the Vertex SDK
  by default.
- tests: cover the preflight raise/no-op paths.
- uv.lock: regenerated.
Per follow-up review on #2910: don't bundle the Vertex SDK in the
default agent-server image — it's a ~62 MiB / ~72% size hit for
provider-specific support that most users won't need.

- Dockerfile: drop `--extra vertex` from both `uv sync` invocations,
  so the published image stays as lean as it was on `main`.
- agent-server.spec: rewrite the header comment to make the new
  policy explicit (off by default; opt in with
  `uv sync ... --extra vertex` before running pyinstaller). The
  `if _VERTEX_AVAILABLE:` guard already added in the previous commit
  is what makes the default build succeed without the extra
  installed; keep it as the supported opt-in path for downstream
  builds (e.g. fork-specific images) that do want Vertex bundled.
Closes the gap left by the previous commit: with the default Docker
build now lean, there was no way to opt back into a Vertex-bundled
binary without forking the Dockerfile. Adds `ENABLE_VERTEX` (default
0) so downstream builds can do:

    docker build --build-arg ENABLE_VERTEX=1 ...

ARG declared globally and re-imported into both the `builder` and
`binary-builder` stages, with a small inline shell conditional that
appends `--extra vertex` to each `uv sync` call. The PyInstaller
spec already auto-detects an installed `vertexai` and bundles
accordingly, so no further wiring is needed.

Spec header comment updated to point at this build arg as the
canonical opt-in path.
# Conflicts:
#	openhands-agent-server/openhands/agent_server/agent-server.spec
#	uv.lock
# Conflicts:
#	openhands-sdk/openhands/sdk/llm/llm.py
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result:PASSED

Action log

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/llm
   llm.py95611987%568, 584, 623–624, 629, 715, 731, 898, 932–933, 936–940, 942, 950–952, 956, 973–974, 978, 980–981, 983–985, 1115, 1238, 1431, 1440–1442, 1541, 1552, 1593, 1605–1607, 1610–1613, 1619, 1677, 1688, 1736, 1749–1751, 1754–1757, 1763, 1860, 1862, 1864, 1890, 1892, 1901–1902, 1955, 2018–2023, 2093, 2235–2236, 2577–2578, 2587, 2605, 2632–2633, 2635, 2637, 2639, 2647, 2650, 2652, 2654, 2665–2666, 2674, 2677, 2680–2681, 2692–2694, 2698, 2702–2703, 2708, 2718, 2723, 2787, 2789, 2791–2794, 2796–2799, 2804–2807, 2822, 2833, 2890, 2892
openhands-sdk/openhands/sdk/llm/utils
   vertex_preflight.py12191%23
TOTAL32257676179% 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track PR #3776: Optional Vertex AI bundle

2 participants