Skip to content

Comments

feat(preset): model-aware default tools for GPT-5 (apply_patch over file_editor)#1281

Closed
enyst wants to merge 5 commits intomainfrom
feat/model-aware-default-tools-gpt5-v2
Closed

feat(preset): model-aware default tools for GPT-5 (apply_patch over file_editor)#1281
enyst wants to merge 5 commits intomainfrom
feat/model-aware-default-tools-gpt5-v2

Conversation

@enyst
Copy link
Collaborator

@enyst enyst commented Nov 29, 2025

This PR contains the model-aware default-tool mapping and wiring split out from #1166 as requested.

Summary

  • Add get_default_tools_for_model() to sdk.llm.utils.model_features for model-specific default tools
    • update tools preset default to take a model_name
    • select apply_patch over file_editor for GPT-5 family
    • select file_editor for all other LLMs
  • Add tests to verify GPT-5 mapping and browser flag behavior

Notes

  • Uses simple substring match for 'gpt-5' family mapping
  • No change for non-GPT-5 models (file_editor remains the default)

Related PR: #1166

Co-authored-by: openhands openhands@all-hands.dev

@enyst can click here to continue refining the PR


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.12-nodejs22 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:2c3f345-python

Run

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

All tags pushed for this build

ghcr.io/openhands/agent-server:2c3f345-golang-amd64
ghcr.io/openhands/agent-server:2c3f345-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:2c3f345-golang-arm64
ghcr.io/openhands/agent-server:2c3f345-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:2c3f345-java-amd64
ghcr.io/openhands/agent-server:2c3f345-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:2c3f345-java-arm64
ghcr.io/openhands/agent-server:2c3f345-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:2c3f345-python-amd64
ghcr.io/openhands/agent-server:2c3f345-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:2c3f345-python-arm64
ghcr.io/openhands/agent-server:2c3f345-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:2c3f345-golang
ghcr.io/openhands/agent-server:2c3f345-java
ghcr.io/openhands/agent-server:2c3f345-python

About Multi-Architecture Support

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2025

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/llm/utils
   model_features.py54394%32, 192, 211
openhands-tools/openhands/tools/preset
   default.py46295%64, 72
TOTAL13555627053% 

@OpenHands OpenHands deleted a comment from openhands-ai bot Nov 30, 2025
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Dec 16, 2025

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

@enyst
Copy link
Collaborator Author

enyst commented Dec 20, 2025

@OpenHands Understand this PR. Then look at Gemini tools PR here: #1199

The difference in how it handles the preset is that the Gemini PR defines and adds a preset for Gemini, but it doesn't set it as default for Gemini, I think. Verify what I just said. I see it defines a get_gemini_agent and the user can use that, or use the default agent, just fine. So it's an option, not a replacement of default for Gemini models.

Then let's do something similar in a new PR, for GPT-5, as an alternative approach to this one. Don't mess with this PR, just make a new branch from main for the alternative. We already have apply_patch, we need some wiring.

@openhands-ai
Copy link

openhands-ai bot commented Dec 20, 2025

I'm on it! enyst can track my progress at all-hands.dev

@openhands-ai
Copy link

openhands-ai bot commented Dec 20, 2025

Summary of work

Verification of Gemini PR (#1199)

  • Your understanding is correct: the Gemini PR adds a separate preset and get_gemini_agent without changing defaults. Users can opt into Gemini-style tools; the default agent remains unchanged.

What I implemented (new, alternative PR for GPT-5)

  • Branch: feat/preset-gpt5-apply-patch-from-main (created from main; I did not touch your ongoing PR branch)
  • Added an opt-in GPT-5 preset that uses ApplyPatchTool for file edits, mirroring the Gemini approach:
    • openhands-tools/openhands/tools/preset/gpt5.py
      • register_gpt5_tools(enable_browser=True)
      • get_gpt5_tools(enable_browser=True) -> [Terminal, ApplyPatch, TaskTracker, (+Browser)]
      • get_gpt5_condenser(llm)
      • get_gpt5_agent(llm, cli_mode=False)
    • Exported get_gpt5_agent in openhands-tools/openhands/tools/preset/init.py

Checks

  • Kept changes minimal and isolated (no defaults modified; new preset is opt-in)
  • Pre-commit checks passed (ruff format, ruff lint, pycodestyle, pyright, tool registration)
  • Commit includes Co-authored-by line

PR opened (draft)

Next steps (optional)

  • Add a small example script (parallel to the Gemini example) showing get_gpt5_agent
  • Open matching docs PR in OpenHands/docs (sdk/ section) to document the new preset usage

View full conversation

@enyst enyst closed this Dec 20, 2025
@enyst enyst mentioned this pull request Dec 23, 2025
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.

1 participant