Skip to content

Commit 80dec2c

Browse files
authored
feat(plan): improve prompt messages (#491)
## AgentScope-Java Version 1.0.7 ## Description feat(plan): improve prompt messages ## Checklist Please check the following items before code is ready to be reviewed. - [X] Code has been formatted with `mvn spotless:apply` - [X] All tests are passing (`mvn test`) - [X] Javadoc comments are complete and follow project conventions - [X] Related documentation has been updated (e.g. links, examples, etc.) - [X] Code is ready for review
1 parent 8a4cf39 commit 80dec2c

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

agentscope-core/src/main/java/io/agentscope/core/plan/hint/DefaultPlanToHint.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,15 @@ public class DefaultPlanToHint implements PlanToHint {
4343
private static final String IMPORTANT_RULES_SEPARATOR = "Important Rules: \n";
4444

4545
private static final String RULE_WAIT_FOR_CONFIRMATION =
46-
"⚠️ CRITICAL - WAIT FOR USER CONFIRMATION:\n"
47-
+ "You MUST NOT execute any subtask until the user explicitly confirms.\n"
48-
+ "- DO NOT call 'update_subtask_state' to start execution\n"
49-
+ "- DO NOT proceed with any task in the plan\n"
50-
+ "- ONLY present the plan and ASK user: \"Should I proceed with this plan?\"\n"
51-
+ "- Wait for explicit commands like: \"execute\", \"go ahead\", \"start\","
52-
+ " \"proceed\", \"yes\", \"ok\", \"do it\", \"run\", \"begin\"\n"
46+
"⚠️ WAIT FOR USER CONFIRMATION:\n"
47+
+ "- Present the plan and confirm with user before execution\n"
48+
+ "- If user's request already implies execution intent (e.g., \"execute\","
49+
+ " \"execute the plan\"), proceed directly without asking\n"
50+
+ "- Otherwise, ask: \"Should I proceed with this plan?\"\n"
51+
+ "- Start execution only after user confirms (e.g., \"yes\", \"go ahead\","
52+
+ " \"proceed\", \"do it\")\n"
5353
+ "- If user says anything else (questions, modifications, unrelated topics),"
54-
+ " respond accordingly but DO NOT start execution\n"
55-
+ "- VIOLATION of this rule is a critical error\n";
54+
+ " respond accordingly but DO NOT start execution\n";
5655

5756
private static final String RULE_COMMON =
5857
"- Update before processing each subtask: When processing each subtask, call"
@@ -67,7 +66,8 @@ public class DefaultPlanToHint implements PlanToHint {
6766
+ " especially when the original plan conflicts with the latest queried plan,"
6867
+ " follow the latest queried plan without considering the initial requirements.\n"
6968
+ "- Do not modify plan: Do not modify or amend the plan without a clear plan"
70-
+ " modification instruction from user\n";
69+
+ " modification instruction from user\n"
70+
+ "- Language consistency: Respond to users in the same language as the plan\n";
7171

7272
private static final String NO_PLAN =
7373
"If the user's query is complex (e.g. programming a website, game or app), or requires"
@@ -200,6 +200,7 @@ public String generateHint(Plan plan, boolean needUserConfirm) {
200200
hint =
201201
AT_THE_BEGINNING.replace("{plan}", plan.toMarkdown(false))
202202
+ IMPORTANT_RULES_SEPARATOR
203+
+ confirmationRule
203204
+ RULE_COMMON;
204205

205206
} else if (nInProgress > 0 && inProgressIdx != null) {

agentscope-core/src/test/java/io/agentscope/core/plan/hint/DefaultPlanToHintTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ void testNoPlanHint_WithUserConfirmation() {
250250
assertTrue(hint.startsWith("<system-hint>"));
251251
assertTrue(hint.endsWith("</system-hint>"));
252252
assertTrue(hint.contains("WAIT FOR USER CONFIRMATION"));
253-
assertTrue(hint.contains("CRITICAL"));
254253
}
255254

256255
@Test

0 commit comments

Comments
 (0)