2424logger = get_logger (__name__ )
2525
2626
27- async def bash_tool (command : str , description : str , tool_context : ToolContext ):
27+ async def bash_tool (
28+ command : str , description : str , tool_context : ToolContext , timeout : float = 600.0
29+ ) -> str :
2830 """Execute bash commands in the skills environment with local shell.
2931
3032 This tool uses the local bash shell to execute commands with:
@@ -57,9 +59,8 @@ async def bash_tool(command: str, description: str, tool_context: ToolContext):
5759 - Use read_file, write_file, and edit_file for interacting with the filesystem.
5860
5961 Timeouts:
60- - pip install: 120s
61- - python scripts: 60s
62- - other commands: 30s
62+ - Default timeout is 600 seconds (10 minutes).
63+ - Adjust the 'timeout' parameter as needed for longer-running commands.
6364
6465 Args:
6566 command: Bash command to execute. Use && to chain commands.
@@ -78,9 +79,6 @@ async def bash_tool(command: str, description: str, tool_context: ToolContext):
7879 working_dir = get_session_path (session_id = tool_context .session .id )
7980 logger .info (f"Session working directory: { working_dir } " )
8081
81- # Determine timeout based on command
82- timeout = _get_command_timeout_seconds (command )
83-
8482 # Prepare environment with PYTHONPATH including skills directory
8583 # This allows imports like: from skills.slack_gif_creator.core import something
8684 env = os .environ .copy ()
@@ -146,13 +144,3 @@ async def bash_tool(command: str, description: str, tool_context: ToolContext):
146144 error_msg = f"Error executing command '{ command } ': { e } "
147145 logger .error (error_msg )
148146 return error_msg
149-
150-
151- def _get_command_timeout_seconds (command : str ) -> float :
152- """Determine appropriate timeout for command in seconds."""
153- if "pip install" in command or "pip3 install" in command :
154- return 120.0
155- elif "python " in command or "python3 " in command :
156- return 60.0
157- else :
158- return 30.0
0 commit comments