File size: 1,019 Bytes
816198f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import yaml
import os
import sys
from urllib.parse import urljoin
from typing import Callable, Dict, Any
from utils.configs import TOOLS_SERVER_BASE_ENDPOINT_URL, WEB_BASED_TOOLS_USE_CACHE
from tool_kits.base import BaseToolkit


class BashToolkit(BaseToolkit):
    NAME = "bash"
    TOOLS_SERVER_BASE_ENDPOINT = TOOLS_SERVER_BASE_ENDPOINT_URL
    ENTRY_POINT = "bash"
    DESCRIPTION = (
        "Execute a shell script in the current working directory. "
        "Use this tool to run one or more shell commands as a single script or "
        "execute script files (e.g. `python script.py`)."
    )
    TIMEOUT = 900
    TOOL_PARAMS = {
        "command": {
            "type": "string",
            "description": (
                "A shell script to execute. Multiple commands are allowed and will be "
                "executed sequentially in the same shell session. Use relative paths by default."
            ),
        },
    }
    TOOL_PARAMS_REQUIRED = ["command"]
    USE_CACHE = WEB_BASED_TOOLS_USE_CACHE