Skip to content

Conversation

@xingyaoww
Copy link
Contributor

Summary

This PR adds comprehensive documentation for using custom tools with remote agent servers in the OpenHands SDK.

Changes

New Guide

Added sdk/guides/custom-tools-remote-agent.md covering:

  • Overview: When and why to use custom tools with remote servers
  • Architecture: How dynamic tool registration works
  • Implementation Steps:
    1. Define custom tool with @register_tool
    2. Create Dockerfile that builds from source
    3. Copy tool modules and set PYTHONPATH
    4. Build custom image
    5. Use with SDK client
  • Common Patterns:
    • Structured data collection (QA reporting example)
    • External API integration
    • Custom validation logic
  • Troubleshooting: ImportError and registration issues

Updated Sidebar

  • Added new guide to sidebar navigation under "Guides"

Related PRs

Use Case

Addresses a common user need: collecting structured data from agent runs (e.g., bug reports from QA bots, test results, audit findings) where enforcing a specific schema is critical for downstream processing.

Co-authored-by: openhands [email protected]

@xingyaoww can click here to continue refining the PR

This guide documents how to use custom tools with a remote agent server
by building a custom Docker image that includes tool implementations.

Covers:
- Overview and use cases for custom tools with remote servers
- Architecture and workflow
- Step-by-step implementation guide
- Dynamic tool registration
- Production deployment best practices
- Troubleshooting common issues
- Real-world example (bug reporting bot)

References the complete example in the SDK repository:
examples/02_remote_agent_server/05_custom_tool/

Relates to: OpenHands/software-agent-sdk#1381

Co-authored-by: openhands <[email protected]>
- Update example from ReportBugTool to LogDataTool (matching actual implementation)
- Change from DockerWorkspace to DockerDevWorkspace with base_image parameter
- Update Dockerfile to use simple base image approach
- Add note about importing tool module to register in client registry
- Update code examples to match the actual SDK example
- Update troubleshooting section with additional guidance

Co-authored-by: openhands <[email protected]>
Custom tools only work with source mode deployments because PyInstaller
binaries cannot dynamically import external Python modules at runtime.

References GitHub issue #1531 for more details and alternatives.

Co-authored-by: openhands <[email protected]>

Create a Python module for your tool (e.g., `custom_tools/log_data.py`):

```python
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OpenHands please make this PR more succinct - you only need to mention the core part in this doc. Please refer to the corresponding PR to understand the context

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the custom tools documentation more succinct as requested. The changes have been pushed to the PR.

Summary of Changes

File: sdk/guides/agent-server/custom-tools.mdx

  • Reduced from 510 lines to 113 lines (78% reduction)

What was removed:

  • Full 130-line code example for the custom tool (now links to GitHub)
  • Detailed production deployment section
  • Extensive best practices section
  • Verbose troubleshooting section (replaced with a concise table)
  • Redundant example use case section
  • Mermaid sequence diagram

What was kept (core content):

  • Overview with link to standalone custom tools guide
  • Binary mode limitation warning (condensed)
  • Link to complete GitHub example
  • Quick Start with minimal code snippets showing the pattern
  • Brief "How It Works" explanation (4 bullet points)
  • Troubleshooting table with common issues
  • See Also links

The documentation now focuses on the core concepts and directs users to the complete working example on GitHub for full implementation details.

View full conversation

Reduce documentation from 510 to 113 lines by:
- Removing full code listings (link to GitHub example instead)
- Condensing step-by-step guide to Quick Start
- Simplifying troubleshooting to a table
- Removing redundant sections (production deployment, best practices, example use case)

The complete working example is available on GitHub for reference.

Co-authored-by: openhands <[email protected]>
…vigation

- Use sync code blocks to auto-populate example code from agent-sdk
- Add custom-tools page to docs.json navigation under Remote Agent Server
- Follow the same format as other SDK guides
- Include both main example and custom tool implementation files

Co-authored-by: openhands <[email protected]>
@xingyaoww xingyaoww requested a review from neubig December 29, 2025 17:43
@xingyaoww xingyaoww marked this pull request as ready for review December 29, 2025 17:43
@xingyaoww xingyaoww requested a review from enyst as a code owner December 29, 2025 17:43
@xingyaoww xingyaoww merged commit 70fbd35 into main Dec 29, 2025
2 checks passed
@xingyaoww xingyaoww deleted the document-custom-tools-remote-agent branch December 29, 2025 18:41
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.

4 participants