Code Editor & Terminal Execution
Tools for file editing and shell execution complying with SWE-bench, NVIDIA Open-SWE-Traces, and terminal agent specifications.
1. File String Replacement Editor (str_replace_editor)
str_replace_editor is the standard editing interface used by Anthropic SWE-bench and Open-SWE-Traces. It provides atomic, exact-match text replacement with history tracking and undo capability.
- Signature:
(command: str, path: str, file_text: str = None, old_str: str = None, new_str: str = None, insert_line: int = None, view_range: list[int] = None) -> str
Commands:
view: Display numbered lines of a file.view_range: Optional[start_line, end_line]range (1-indexed).create: Create a new file with specifiedfile_text. Overwrites if existing while saving undo state.str_replace: Replaceold_strwithnew_str.old_strmust appear uniquely (exactly once) in the file. Ifnew_stris omitted or empty,old_stris deleted.insert: Insertnew_strafterinsert_line. Ifinsert_line = 0, new lines are prepended to the very beginning of the file.undo_edit: Revert the last modification topathusing session history.
2. Terminal Execution (execute_bash & bash)
execute_bash / bash
Execute arbitrary bash shell commands inside a subprocess with execution timeouts, exit codes, and structured output.
- Signature:
(command: str, timeout_seconds: int = 30, cwd: str = None) -> str - Both
execute_bashandbashare registered for full compatibility with benchmark agent prompts. - Output includes exit code, stdout, and stderr.