fix(sdk): add security_risk to prompt-based tool calling example#2746
fix(sdk): add security_risk to prompt-based tool calling example#2746VascoSch92 wants to merge 2 commits intomainfrom
Conversation
Add security_risk and summary parameters to the generic tool call example in system_message_suffix_TEMPLATE. This ensures that smaller models using prompt-based tool calling (native_tool_calling=False) see these parameters in the format instructions, helping them learn to include them in their tool calls. Fixes #2740 Co-authored-by: openhands <openhands@all-hands.dev>
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Coverage Report •
|
|||||||||||||||||||||||||||||||||||
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste - Simple, elegant fix that addresses the root cause.
Verdict: ✅ Worth merging after eval confirmation - core logic is sound, fix is minimal and well-tested.
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste - Simple, elegant fix that addresses the root cause.
Verdict: ✅ Worth merging after eval confirmation - core logic is sound, fix is minimal and well-tested.
Summary
Add
security_riskandsummaryparameters to the generic tool call example insystem_message_suffix_TEMPLATE. This ensures that smaller models using prompt-based tool calling (native_tool_calling=False) see these parameters in the format instructions, helping them learn to include them in their tool calls.Problem
When using
native_tool_calling=Falsefor weaker/smaller models (e.g., qwen2.5-coder:7b), the generic tool call example in the system prompt showed:Without
security_riskin this example, smaller models consistently omit it from their tool calls, causing validation errors whenLLMSecurityAnalyzeris active.Solution
Updated the template to include both
security_riskandsummaryparameters:Testing
test_system_message_suffix_template_includes_security_riskto prevent future regressionsFixes #2740
This PR was created by an AI assistant (OpenHands) on behalf of the user.
@VascoSch92 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
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:58e4b8e-pythonRun
All tags pushed for this build
About Multi-Architecture Support
58e4b8e-python) is a multi-arch manifest supporting both amd64 and arm6458e4b8e-python-amd64) are also available if needed