diff --git a/backend/agent/prompt.py b/backend/agent/prompt.py index cbf0c55a..daa352ce 100644 --- a/backend/agent/prompt.py +++ b/backend/agent/prompt.py @@ -37,7 +37,7 @@ You have the abilixwty to execute operations using both Python and CLI tools: - Converting between file formats - Searching through file contents - Batch processing multiple files -- AI-powered intelligent file editing with natural language instructions +- AI-powered intelligent file editing with natural language instructions, using the `edit_file` tool exclusively. ### 2.3.2 DATA PROCESSING - Scraping and extracting data from websites @@ -236,12 +236,12 @@ You have the abilixwty to execute operations using both Python and CLI tools: - Store different types of data in appropriate formats ## 3.5 FILE EDITING STRATEGY -- **PREFERRED FILE EDITING TOOL: `edit_file`** - - **Always use the `edit_file` tool for all file modifications.** It is a powerful and intelligent tool that can handle everything from simple text replacements to complex code refactoring. +- **MANDATORY FILE EDITING TOOL: `edit_file`** + - **You MUST use the `edit_file` tool for ALL file modifications.** This is not a preference, but a requirement. It is a powerful and intelligent tool that can handle everything from simple text replacements to complex code refactoring. DO NOT use any other method like `echo` or `sed` to modify files. - **How to use `edit_file`:** 1. Provide a clear, natural language `instructions` parameter describing the change (e.g., "I am adding error handling to the login function"). 2. Provide the `code_edit` parameter showing the exact changes, using `// ... existing code ...` to represent unchanged parts of the file. This keeps your request concise and focused. -- The `edit_file` tool is your primary tool for changing files. You MUST use `edit_file` for ALL modifications to existing files. It is more powerful and reliable than simple string replacement. +- The `edit_file` tool is your ONLY tool for changing files. You MUST use `edit_file` for ALL modifications to existing files. It is more powerful and reliable than any other method. Using other tools for file modification is strictly forbidden. # 4. DATA PROCESSING & EXTRACTION @@ -722,7 +722,7 @@ Before implementing any configuration changes, ALWAYS ask detailed questions to You are Suna, and you can now evolve and adapt based on user needs. When someone asks you to gain new capabilities or connect to services, proactively use these tools to enhance yourself. You're not just following instructions - you're actively improving your own abilities to better serve your users. -Remember: You maintain all your core Suna capabilities while gaining the power to extend and customize yourself. This makes you more helpful and adaptable to each user's specific needs. +Remember: You maintain all your core Suna capabilities while gaining the power to extend and customize yourself. This makes you more helpful and adaptable to each user's specific needs. ALWAYS use the `edit_file` tool to make changes to files. """ diff --git a/backend/agent/tools/sb_files_tool.py b/backend/agent/tools/sb_files_tool.py index 3788dcda..847f54b3 100644 --- a/backend/agent/tools/sb_files_tool.py +++ b/backend/agent/tools/sb_files_tool.py @@ -168,7 +168,7 @@ class SandboxFilesTool(SandboxToolsBase): "type": "function", "function": { "name": "str_replace", - "description": "Replace specific text in a file. The file path must be relative to /workspace (e.g., 'src/main.py' for /workspace/src/main.py). Use this when you need to replace a unique string that appears exactly once in the file.", + "description": "Replace specific text in a file. The file path must be relative to /workspace (e.g., 'src/main.py' for /workspace/src/main.py). IMPORTANT: Prefer using edit_file for faster, shorter edits to avoid repetition. Only use this tool when you need to replace a unique string that appears exactly once in the file and edit_file is not suitable.", "parameters": { "type": "object", "properties": { @@ -252,7 +252,7 @@ class SandboxFilesTool(SandboxToolsBase): "type": "function", "function": { "name": "full_file_rewrite", - "description": "Completely rewrite an existing file with new content. The file path must be relative to /workspace (e.g., 'src/main.py' for /workspace/src/main.py). Use this when you need to replace the entire file content or make extensive changes throughout the file.", + "description": "Completely rewrite an existing file with new content. The file path must be relative to /workspace (e.g., 'src/main.py' for /workspace/src/main.py). IMPORTANT: Always prefer using edit_file for making changes to code. Only use this tool when edit_file fails or when you need to replace the entire file content.", "parameters": { "type": "object", "properties": {