Repository navigation
Closed
Labels
openhandsSolving the issue with OpenHands.
Description
We want to avoid this pattern:
cwd = os.getcwd()
bash = BashExecutor(working_dir=cwd)
file_editor = FileEditorExecutor()
tools: list[Tool] = [
execute_bash_tool.set_executor(executor=bash),
str_replace_editor_tool.set_executor(executor=file_editor),
]Instead, we want smth like:
bash = BashTool(working_dir=cwd)
file_editor = FileEditorTool()To do this we can:
class BashTool(Tool):
# override the arguments for tool constructor following what we've been doing in agent-sdk/openhands/tools/execute_bash/definition.py
# Then only accept arguments that are accepted by BashExecutor, and initialize the executor for this tool
We should do this for both Bash and StrReplaceEditor tool, then update .openhands/microagents/repo.md about this updated architecture.
We should also rewrite examples/ to follow the simplified pattern.
But do keep an example there showing an advanced usage of explicitly defining bash executor, and reuse that executor to define a new Tool inside that script called "glob" that does this:
_GLOB_DESCRIPTION = """Fast file pattern matching tool.
* Supports glob patterns like "**/*.js" or "src/**/*.ts"
* Use this tool when you need to find files by name patterns
* Returns matching file paths sorted by modification time
* Only the first 100 results are returned. Consider narrowing your search with stricter glob patterns or provide path parameter if you need more results.
* When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
"""
GlobTool = ChatCompletionToolParam(
type='function',
function=ChatCompletionToolParamFunctionChunk(
name='glob',
description=_GLOB_DESCRIPTION,
parameters={
'type': 'object',
'properties': {
'pattern': {
'type': 'string',
'description': 'The glob pattern to match files (e.g., "**/*.js", "src/**/*.ts")',
},
'path': {
'type': 'string',
'description': 'The directory (absolute path) to search in. Defaults to the current working directory.',
},
},
'required': ['pattern'],
},
),
)Reacted by openhands-ai
Metadata
Metadata
Assignees
Labels
openhandsSolving the issue with OpenHands.
Activity
openhands-ai commentedon Sep 3, 2025
I'm on it! xingyaoww can track my progress at all-hands.dev
🔴 Solvability: HARD
This issue appears to be extremely challenging to resolve due to the complete absence of essential information - there is no title, description, error messages, reproduction steps, or any technical details provided. The lack of standard problem-solving patterns and technical context makes it nearly impossible to understand what needs to be fixed.
You can make the issue easier to resolve by addressing these concerns in the conversation:
• Provide a clear title and detailed description explaining what the problem is and what you're trying to accomplish
• Include specific error messages, reproduction steps, and code snippets that demonstrate the issue
• Add environment details such as operating system, software versions, and configuration settings relevant to the problem
feat: Add BashTool and FileEditorTool subclasses for simplified tool …
openhands-ai commentedon Sep 3, 2025
✅ Issue #86 Successfully Completed
I have successfully implemented the BashTool and FileEditorTool subclasses as requested in issue #86. Here's a summary of what was accomplished:
🎯 Core Implementation
BashToolclass that inherits fromTooland acceptsworking_dir/usernameparametersFileEditorToolclass that inherits fromToolwith automatic executor initialization📚 Examples & Documentation
advanced_tools_with_glob.pydemonstrating both simplified and advanced patterns.openhands/microagents/repo.md🧪 Testing & Quality
🚀 Delivery
openhands/tool-subclasses-issue-86The implementation maintains backward compatibility while providing a much cleaner developer experience. The advanced pattern with explicit executor management is still available for complex use cases, as demonstrated in the new example file.
Pull Request: #88
View full conversation