Tool configuration
This shows how to configure tools for SWE-agent.
sweagent.tools.tools.ToolConfig
pydantic-model
Bases: BaseModel
Fields:
-
filter
(ToolFilterConfig
) -
bundles
(list[Bundle]
) -
env_variables
(dict[str, Any]
) -
submit_command
(str
) -
parse_function
(ParseFunction
) -
enable_bash_tool
(bool
) -
format_error_template
(str
) -
command_docs
(str
) -
multi_line_command_endings
(dict[str, str]
) -
submit_command_end_name
(str | None
) -
reset_commands
(list[str | list[str]]
) -
execution_timeout
(int
) -
install_timeout
(int
) -
use_function_calling
(bool
) -
state_commands
(list[str]
) -
commands
(list[Command]
) -
tools
(list[dict]
)
command_docs
pydantic-field
command_docs: str = None
commands
pydantic-field
commands: list[Command]
Read command files and return parsed command objects
enable_bash_tool
pydantic-field
enable_bash_tool: bool = True
env_variables
pydantic-field
env_variables: dict[str, Any] = {}
Shorthand to set environment variables for the tools, effectively
equivalent to adding export VARNAME=value
to the reset_commands
.
execution_timeout
pydantic-field
execution_timeout: int = 30
Timeout for executing commands in the environment
format_error_template
pydantic-field
format_error_template: str = None
Defaults to format_error_template in ParseFunction
install_timeout
pydantic-field
install_timeout: int = 300
Timeout used for each of the installation commands
multi_line_command_endings
pydantic-field
multi_line_command_endings: dict[str, str] = {}
parse_function
pydantic-field
parse_function: ParseFunction
reset_commands
pydantic-field
reset_commands: list[str | list[str]] = []
Commands to reset the environment. They will also be called when we start the environment.
Unlike install_commands
, these commands are part of the environment state.
state_commands
pydantic-field
state_commands: list[str]
submit_command
pydantic-field
submit_command: str = 'submit'
submit_command_end_name
pydantic-field
submit_command_end_name: str | None = None
Commands to install dependencies and tools. These commands are executed in a subprocess and are not part of the environment state.
tools
pydantic-field
tools: list[dict]
use_function_calling
pydantic-field
use_function_calling: bool
sweagent.tools.tools.ToolFilterConfig
pydantic-model
Bases: BaseModel
Fields:
-
blocklist_error_template
(str
) -
blocklist
(list[str]
) -
blocklist_standalone
(list[str]
) -
block_unless_regex
(dict[str, str]
)
block_unless_regex
pydantic-field
block_unless_regex: dict[str, str] = {'radare2': '\\b(?:radare2)\\b.*\\s+-c\\s+.*', 'r2': '\\b(?:radare2)\\b.*\\s+-c\\s+.*'}
Block any command that matches one of these regexes unless it also matches the regex
blocklist
pydantic-field
blocklist: list[str] = ['vim', 'vi', 'emacs', 'nano', 'nohup', 'git', 'gdb', 'less', 'tail -f', 'python -m venv']
Block any command that starts with one of these
blocklist_error_template
pydantic-field
blocklist_error_template: str = "Operation '{{action}}' is not supported by this environment."
blocklist_standalone
pydantic-field
blocklist_standalone: list[str] = ['python', 'python3', 'ipython', 'bash', 'sh', '/bin/bash', '/bin/sh', 'nohup', 'vi', 'vim', 'emacs', 'nano', 'su']
Block any command that matches one of these exactly
sweagent.tools.bundle.Bundle
pydantic-model
Bases: BaseModel
Fields:
-
path
(Path
) -
hidden_tools
(list[str]
) -
_config
(BundleConfig
) -
state_command
(str | None
) -
config
(BundleConfig
) -
commands
(list[Command]
)
Validators:
config
pydantic-field
config: BundleConfig
hidden_tools
pydantic-field
hidden_tools: list[str]
path
pydantic-field
path: Path
state_command
pydantic-field
state_command: str | None
validate_tools
pydantic-validator
validate_tools()
Source code in sweagent/tools/bundle.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|