π OpenHands: AI-Driven Development
feat(agent): Add import placement guidance to CodeAct agent system prompts (#9794)
Xingyao Wangf5674d7c76ae
diff --git a/openhands/agenthub/codeact_agent/prompts/system_prompt.j2 b/openhands/agenthub/codeact_agent/prompts/system_prompt.j2index bc6bf1a2a5..c202ab2052 100644--- a/openhands/agenthub/codeact_agent/prompts/system_prompt.j2+++ b/openhands/agenthub/codeact_agent/prompts/system_prompt.j2@@ -27,6 +27,7 @@ Your primary role is to assist users by executing commands, modifying code, and* When implementing solutions, focus on making the minimal changes needed to solve the problem.* Before implementing any changes, first thoroughly understand the codebase through exploration.* If you are adding a lot of code to a function or file, consider splitting the function or file into smaller pieces when appropriate.+* Place all imports at the top of the file unless explicitly requested otherwise or if placing imports at the top would cause issues (e.g., circular imports, conditional imports, or imports that need to be delayed for specific reasons).</CODE_QUALITY><VERSION_CONTROL>diff --git a/openhands/agenthub/codeact_agent/prompts/system_prompt_interactive.j2 b/openhands/agenthub/codeact_agent/prompts/system_prompt_interactive.j2index af3824bffc..a8fd87008b 100644--- a/openhands/agenthub/codeact_agent/prompts/system_prompt_interactive.j2+++ b/openhands/agenthub/codeact_agent/prompts/system_prompt_interactive.j2@@ -21,6 +21,7 @@ Your primary role is to assist users by executing commands, modifying code, and* When implementing solutions, focus on making the minimal changes needed to solve the problem.* Before implementing any changes, first thoroughly understand the codebase through exploration.* If you are adding a lot of code to a function or file, consider splitting the function or file into smaller pieces when appropriate.+* Place all imports at the top of the file unless explicitly requested otherwise or if placing imports at the top would cause issues (e.g., circular imports, conditional imports, or imports that need to be delayed for specific reasons).</CODE_QUALITY><VERSION_CONTROL>diff --git a/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2 b/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2index 1bcc124632..1431e578b4 100644--- a/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2+++ b/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2@@ -21,6 +21,7 @@ Your primary role is to assist users by executing commands, modifying code, and* When implementing solutions, focus on making the minimal changes needed to solve the problem.* Before implementing any changes, first thoroughly understand the codebase through exploration.* If you are adding a lot of code to a function or file, consider splitting the function or file into smaller pieces when appropriate.+* Place all imports at the top of the file unless explicitly requested otherwise or if placing imports at the top would cause issues (e.g., circular imports, conditional imports, or imports that need to be delayed for specific reasons).</CODE_QUALITY><VERSION_CONTROL>