Skip to content

fix(sdk): resolve structured builtin tool specs remotely - #4691

Merged
malhotra5 merged 1 commit into
mainfrom
fix/remote-structured-finish-tool
Aug 28, 2026
Merged

malhotra5 merged 1 commit into
mainfrom
fix/remote-structured-finish-tool

Conversation

@malhotra5

@malhotra5 malhotra5 commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

HUMAN:


AGENT:
This PR was created by an AI agent (OpenHands) on behalf of the user.

Why

Automation preset runs can send an explicit structured FinishTool spec through a remote conversation. The client-side preset helper registers FinishTool locally, but the serialized tool spec is resolved in the agent-server process. If that server process has not registered the SDK built-in in the global tool registry, remote initialization fails with ToolDefinition 'FinishTool' is not registered.

Summary

  • Fall back to SDK built-in tool classes when resolving explicit Tool(...) specs that are not present in the process-local registry.
  • Add a regression test proving structured FinishTool specs resolve without a registry entry.
  • Make two existing SDK tests robust to environment/order-sensitive behavior discovered during the full SDK run.

Issue Number

N/A

How to Test

Commands run locally:

uv run pytest tests/sdk/tool/test_response_schema.py tests/sdk/tool/test_registry.py tests/tools/test_preset_default.py -q
uv run pytest tests/sdk/conversation/test_local_conversation_mcp.py -q
uv run pytest tests/sdk/conversation/test_utility_llm_span_metadata.py -q
uv run pytest $(cat /tmp/sdk-tail-files.txt) -q
uv run pre-commit run --files openhands-sdk/openhands/sdk/tool/registry.py tests/sdk/tool/test_response_schema.py tests/sdk/conversation/test_local_conversation_mcp.py tests/sdk/conversation/test_utility_llm_span_metadata.py

Results:

  • Response schema / registry / preset tests: 42 passed.
  • MCP conversation tests: 4 passed.
  • Utility LLM span metadata tests: 4 passed.
  • SDK tail from tests/sdk/conversation/test_utility_llm_span_metadata.py onward: 3928 passed, 7 skipped, 10 xfailed.
  • Pre-commit passed for all changed files.

A full uv run pytest tests/sdk -q was also started after the MCP fix. It progressed past the original MCP failure and later exposed the utility span metadata order-sensitivity fixed in this PR.

Video/Screenshots

N/A — backend SDK behavior covered by unit tests.

Design Doc

N/A

Type

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

Notes

Structured response note: the fallback does not switch FinishTool back to unstructured mode. Remote conversations already serialize response_schema on the explicit Tool(name="FinishTool", ...) spec; this change only lets the server resolve that built-in spec before applying the schema.
Opened as draft because the PR template requires the human-only HUMAN section to be filled by a human before marking ready for review.

@malhotra5 can click here to continue refining the PR


🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)

• 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:da3389c-python

Run

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

All tags pushed for this build

ghcr.io/openhands/agent-server:da3389c-golang-amd64
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-golang-amd64
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-golang-amd64
ghcr.io/openhands/agent-server:da3389c-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:da3389c-golang-arm64
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-golang-arm64
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-golang-arm64
ghcr.io/openhands/agent-server:da3389c-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:da3389c-java-amd64
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-java-amd64
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-java-amd64
ghcr.io/openhands/agent-server:da3389c-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:da3389c-java-arm64
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-java-arm64
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-java-arm64
ghcr.io/openhands/agent-server:da3389c-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:da3389c-python-amd64
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-python-amd64
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-python-amd64
ghcr.io/openhands/agent-server:da3389c-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:da3389c-python-arm64
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-python-arm64
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-python-arm64
ghcr.io/openhands/agent-server:da3389c-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:da3389c-golang
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-golang
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-golang
ghcr.io/openhands/agent-server:da3389c-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:da3389c-java
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-java
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-java
ghcr.io/openhands/agent-server:da3389c-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:da3389c-python
ghcr.io/openhands/agent-server:da3389c8b4864316152f06fef6fbe193ffd95492-python
ghcr.io/openhands/agent-server:fix-remote-structured-finish-tool-python
ghcr.io/openhands/agent-server:da3389c-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim

About Multi-Architecture Support

  • Each variant tag (e.g., da3389c-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., da3389c-python-amd64) are also available if needed

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

Copy link
Copy Markdown
Contributor

Python API breakage checks — ✅ PASSED

Result: ✅ PASSED

Action log

@github-actions

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/tool
   registry.py107793%39, 59–60, 71, 84, 118, 160
TOTAL410581150672% 

@malhotra5
malhotra5 marked this pull request as ready for review August 28, 2026 03:33
@malhotra5
malhotra5 merged commit e38e02b into main Aug 28, 2026
41 checks passed
@malhotra5
malhotra5 deleted the fix/remote-structured-finish-tool branch August 28, 2026 03:33
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.

3 participants