sparse-teacher-68460
12/10/2025, 7:31 PMlimited-student-10747
12/10/2025, 7:36 PMlimited-student-10747
12/10/2025, 7:37 PMsparse-teacher-68460
12/10/2025, 7:52 PMreport_bug tool. Throughout a run I will collect up all the bugs it found and then create jira tasks for them or compile them into a report.
I can kind of do that right now via get_agent_final_response, except I don't get to define and enforce the structure.
So I could create a report_bug tool, an add_comment tool, etc. and add them to the agent server image. But maybe a more general purpose "aliasing" of a give_structured_data tool could solve this problem. The tool itself would be built in, but multiple configurations of the tool (with a different schema) could be registered.limited-student-10747
12/10/2025, 8:26 PMpurple-thailand-64770
12/10/2025, 8:57 PMchilly-france-44439
12/10/2025, 9:31 PMwooden-umbrella-84098
12/11/2025, 8:39 AMwooden-umbrella-84098
12/11/2025, 8:39 AMwooden-umbrella-84098
12/11/2025, 8:39 AMchilly-france-44439
12/11/2025, 2:28 PMexamples/02_remote agent server/XX_custom_tool/ (replace XX with the latest example number). When this is done, we should also write a documentation under "guides" of SDK in OpenHands/docs repo.
Please create the github issue first, then try to resolve it. You can refer to 02_custom_tool.py for how it will work when in a standalone mode. You should consider using DockerDevWorkspace, which will prebuild the Docker image for you using a new base image. In this example, XX_custom_tool/ should be a folder that consists of a SDK script (similar to 02_custom_tool.py ), a tool implementation where the SDK custom_tool will import from, and a Dockerfile that includes the "custom tool implementation" into the python path.
Also note you may need to merge https://github.com/OpenHands/software-agent-sdk/pull/1129 into your branch first when you are debugging this - we don't yet have dynamic tool registration supported yet in the remote agent server, you should take the chance in this PR to implement that as well.nutritious-balloon-65098
12/11/2025, 2:29 PMnutritious-balloon-65098
12/11/2025, 2:43 PMcustom_tools/report_bug.py: Full-featured ReportBugTool implementation demonstrating structured data collection with:
▪︎ BugAction (input) with severity levels, reproduction steps, affected files
▪︎ BugObservation (output) with bug ID and success status
▪︎ ReportBugExecutor for handling bug reports
▪︎ Auto-registration using register_tool()
◦ Dockerfile: Simple, production-ready Dockerfile that extends the base agent server image with custom tools
◦ build_custom_image.sh: Build script for creating custom agent server images with clear instructions
◦ custom_tool_example.py: Complete SDK example showing:
▪︎ Automatic image building if not present
▪︎ Creating agents with custom tools
▪︎ Dynamic tool registration workflow
▪︎ Full conversation lifecycle
◦ README.md: Comprehensive documentation covering:
▪︎ Architecture and workflow
▪︎ Step-by-step implementation guide
▪︎ Production deployment considerations
▪︎ Troubleshooting guide
▪︎ Real-world use case examples
3. Merged Dynamic Tool Registration (PR #1129):
◦ Server-side support for importing tool modules dynamically
◦ Client-side transmission of tool module qualnames
◦ Automatic tool registration when creating conversations
◦ Tests for the complete workflow
4. Created Documentation in OpenHands/docs repo:
◦ sdk/guides/agent-server/custom-tools.mdx: Comprehensive guide covering:
▪︎ Overview and architecture
▪︎ Complete step-by-step tutorial with code examples
▪︎ Dynamic tool registration explanation with sequence diagram
▪︎ Production deployment best practices
▪︎ Troubleshooting section
▪︎ Real-world example (bug reporting bot)
📦 Branches Created
OpenHands/software-agent-sdk:
• Branch: implement-custom-tools-remote-agent
• Includes: Dynamic tool registration + complete custom tools example
• Ready for PR: https://github.com/OpenHands/software-agent-sdk/pull/new/implement-custom-tools-remote-agent
OpenHands/docs:
• Branch: document-custom-tools-remote-agent
• Includes: Comprehensive guide for custom tools with remote agent servers
• Ready for PR: https://github.com/OpenHands/docs/pull/new/document-custom-tools-remote-agent
🎯 Key Features
1. Simple Workflow: Users can extend the base agent server image with just a few lines in a Dockerfile
2. Dynamic Registration: Tools are automatically registered when conversations are created
3. Production Ready: Includes build scripts, best practices, and deployment guidance
4. Well Documented: Both in-example README and comprehensive docs guide
5. Type Safe: Full Pydantic validation for actions and observations
6. Extensible: Clear patterns for creating more complex tools
📝 Next Steps
Would you like me to:
1. Create pull requests for both repositories?
2. Run the example to verify it works end-to-end?
3. Make any adjustments to the implementation or documentation?
The implementation addresses the original use case of collecting structured data (like bug reports) during agent runs, with clear patterns that can be extended to other use cases like metrics logging, event recording, or custom integrations.
<sub>View full conversation</sub>nutritious-balloon-65098
12/11/2025, 2:46 PMexamples/02_remote_agent_server/05_custom_tool/)
• ReportBugTool - Custom tool for structured bug data collection with severity levels, reproduction steps, and affected files
• Dockerfile - Extends base agent server image with custom tools
• build_custom_image.sh - Script to build custom agent server images
• custom_tool_example.py - SDK script demonstrating the full workflow
• README.md - Comprehensive documentation with setup, usage, and troubleshooting
3. Dynamic Tool Registration
• Merged PR #1129 (openhands/dynamic-tool-registration) into the implementation branch
• Enables server-side dynamic tool import and registration via module qualnames
• Includes tests for the new functionality
4. Documentation (sdk/guides/agent-server/custom-tools.mdx)
• Architecture diagrams and workflow explanation
• Step-by-step implementation guide
• Production deployment best practices
• Troubleshooting section
• Real-world bug reporting example
Verification
✅ Request Completely Addressed:
• GitHub issue created and documented
• Example under 05_custom_tool/ with all required components
• Dynamic tool registration implemented (merged PR #1129)
• Documentation in OpenHands/docs under guides
✅ Changes Are Concise:
• 13 files changed in SDK repo (794 lines for example + 269 lines for dynamic registration)
• 1 file added in docs repo (443 lines)
• All changes directly related to the feature
Branches Pushed
SDK Repository: implement-custom-tools-remote-agent
• https://github.com/OpenHands/software-agent-sdk/pull/new/implement-custom-tools-remote-agent
Docs Repository: document-custom-tools-remote-agent
• https://github.com/OpenHands/docs/pull/new/document-custom-tools-remote-agent
How It Works
1. Build a custom Docker image that extends the base agent server with your tools
2. The Dockerfile copies custom tools into the Python path
3. When creating a conversation, the client sends tool module qualnames to the server
4. The server dynamically imports and registers the tools
5. The agent can now use your custom tools during execution
This solution addresses your use case of collecting structured data (bugs, metrics, etc.) during agent runs for downstream processing (Jira tickets, reports, workflows).
Next Steps: Review the PRs, test the example, and let me know if you'd like me to create the pull requests or make any adjustments!
<sub>View full conversation</sub>nutritious-balloon-65098
12/11/2025, 3:15 PMconversation_service.py to dynamically import and register custom tools from client's tool_module_qualnames
2. Updated RemoteConversation.create() to transmit tool module qualnames to the server
3. Extended API schema (StartConversationRequest) to accept tool_module_qualnames
4. Added registry function get_tool_module_qualnames() to track tool-to-module mappings
5. Comprehensive tests for the new functionality
✅ Complete Example (examples/02_remote_agent_server/05_custom_tool/)
Custom Tool: ReportBugTool - demonstrates the structured data collection pattern (common QA workflow use case)
Key Components:
• Dockerfile: Multi-stage build that:
◦ Builds agent-server from source (includes dynamic tool registration code)
◦ Copies custom tool modules into the image
◦ Sets PYTHONPATH for importability
• Example Script: custom_tool_example.py showing end-to-end usage
• Build Script: build_custom_image.sh for easy Docker image creation
• README: Comprehensive documentation with architecture diagrams and troubleshooting
✅ Testing Results
Successfully verified:
1. Custom tool modules import server-side ✅
2. Tools register correctly via @register_tool decorator ✅
3. Agent resolves and loads custom tools ✅
4. Conversation creation succeeds with custom tools ✅
✅ Documentation
Created comprehensive guide in OpenHands/docs:
• Location: sdk/guides/agent-server/custom-tools.mdx
• Content: Architecture overview, step-by-step implementation, common patterns, troubleshooting
✅ Pull Requests Created
Both PRs are draft and cross-referenced:
• SDK PR #1383: https://github.com/OpenHands/software-agent-sdk/pull/1383
• Docs PR #177: https://github.com/OpenHands/docs/pull/177
All changes have been pushed to the remote branches.
-------------------------
How It Works
When creating a RemoteConversation with custom tools:
1. Client's SDK automatically detects all registered tools (including custom ones)
2. Sends tool_module_qualnames mapping to the server (e.g., {'ReportBugTool': 'custom_tools.report_bug'})
3. Server dynamically imports the modules before initializing the agent
4. Custom tools are now available for the agent to use
This enables the exact use case you described: collecting structured data (bug reports, test results, etc.) from agent runs where enforcing a specific schema is critical for downstream processing.
<sub>View full conversation</sub>nutritious-balloon-65098
12/11/2025, 3:28 PMimplement-custom-tools-remote-agent branch to PR #1129 (openhands/dynamic-tool-registration).
What I Did
Analysis:
• Discovered that PR #1129 already contains the core dynamic tool registration functionality (tool_module_qualnames field, registry changes, and server-side registration logic)
• Identified that my branch had the example implementation that demonstrates how to use this feature
Changes Added to PR #1129:
I cherry-picked 2 commits that add:
1. Complete Example (examples/02_remote_agent_server/05_custom_tool/)
◦ ReportBugTool - demonstrates structured data collection (the use case you described: QA workflows that need to collect bug reports with enforced schemas)
◦ Dockerfile - multi-stage build that includes custom tool modules
◦ build_custom_image.sh - build script for creating custom images
◦ custom_tool_example.py - complete end-to-end SDK example
◦ README.md - comprehensive documentation with architecture explanation
2. Supporting Changes
◦ Updated .dockerignore to allow custom_tools/ directory in Docker builds
◦ Added debug logging to show tool_module_qualnames being sent from client
Status
✅ Changes pushed to PR #1129: https://github.com/OpenHands/software-agent-sdk/pull/1129
✅ Comment added to PR explaining the additions
✅ Pre-commit checks passed
✅ All testing verified (custom tool registration works end-to-end)
Related Work
• Issue #1381: Documents the feature request
• Docs PR #177: Draft documentation in OpenHands/docs repo (created earlier)
The example directly addresses your use case: collecting structured data from agent runs where you need to enforce a specific schema for downstream processing (creating Jira tickets, generating reports, etc.).
<sub>View full conversation</sub>