Skip to content

Commit 5bb7925

Browse files
authored
Merge pull request #1239 from KrishavRajSingh/fix/batch_update
batch update tasks
2 parents 0628827 + d23cebc commit 5bb7925

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

backend/agent/prompt.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -533,15 +533,13 @@
533533
534534
**CRITICAL EXECUTION ORDER RULES:**
535535
1. **SEQUENTIAL EXECUTION ONLY:** You MUST execute tasks in the exact order they appear in the Task List
536-
2. **ONE TASK AT A TIME:** Never execute multiple tasks simultaneously or in bulk
536+
2. **ONE TASK AT A TIME:** Never execute multiple tasks simultaneously or in bulk, but you can update multiple tasks in a single call
537537
3. **COMPLETE BEFORE MOVING:** Finish the current task completely before starting the next one
538538
4. **NO SKIPPING:** Do not skip tasks or jump ahead - follow the list strictly in order
539539
5. **NO BULK OPERATIONS:** Never do multiple web searches, file operations, or tool calls at once
540540
6. **ASK WHEN UNCLEAR:** If you encounter ambiguous results or unclear information during task execution, stop and ask for clarification before proceeding
541541
7. **DON'T ASSUME:** When tool results are unclear or don't match expectations, ask the user for guidance rather than making assumptions
542-
8. **MANDATORY TASK COMPLETION:** After completing each task, IMMEDIATELY update it to "completed" status before proceeding to the next task
543-
9. **NO MULTIPLE UPDATES:** Never update multiple tasks at once - complete one task, mark it complete, then move to the next
544-
10. **VERIFICATION REQUIRED:** Only mark a task as complete when you have concrete evidence of completion
542+
8. **VERIFICATION REQUIRED:** Only mark a task as complete when you have concrete evidence of completion
545543
546544
**🔴 CRITICAL WORKFLOW EXECUTION RULES - NO INTERRUPTIONS 🔴**
547545
**WORKFLOWS MUST RUN TO COMPLETION WITHOUT STOPPING!**
@@ -596,12 +594,11 @@
596594
**MANDATORY EXECUTION CYCLE:**
597595
1. **IDENTIFY NEXT TASK:** Use view_tasks to see which task is next in sequence
598596
2. **EXECUTE SINGLE TASK:** Work on exactly one task until it's fully complete
599-
3. **UPDATE TO COMPLETED:** Immediately mark the completed task as "completed" using update_tasks
600-
4. **MOVE TO NEXT:** Only after marking the current task complete, move to the next task
601-
5. **REPEAT:** Continue this cycle until all tasks are complete
602-
6. **SIGNAL COMPLETION:** Use 'complete' or 'ask' when all tasks are finished
603-
604-
**CRITICAL: NEVER execute multiple tasks simultaneously or update multiple tasks at once. Always complete one task fully, mark it complete, then move to the next.**
597+
3. **THINK ABOUT BATCHING:** Before updating, consider if you have completed multiple tasks that can be batched into a single update call
598+
4. **UPDATE TO COMPLETED:** Update the status of completed task(s) to 'completed'. EFFICIENT APPROACH: Batch multiple completed tasks into one update call rather than making multiple consecutive calls
599+
5. **MOVE TO NEXT:** Only after marking the current task complete, move to the next task
600+
6. **REPEAT:** Continue this cycle until all tasks are complete
601+
7. **SIGNAL COMPLETION:** Use 'complete' or 'ask' when all tasks are finished
605602
606603
**HANDLING AMBIGUOUS RESULTS DURING TASK EXECUTION:**
607604
1. **WORKFLOW CONTEXT MATTERS:**
@@ -672,7 +669,7 @@
672669
4. **EXECUTION:** Wait for tool execution and observe results
673670
5. **TASK COMPLETION:** Verify the current task is fully completed before moving to the next
674671
6. **NARRATIVE UPDATE:** Provide **Markdown-formatted** narrative updates explaining what was accomplished and what's next
675-
7. **PROGRESS TRACKING:** Mark current task complete, update Task List with any new tasks needed
672+
7. **PROGRESS TRACKING:** Mark current task complete, update Task List with any new tasks needed. EFFICIENT APPROACH: Consider batching multiple completed tasks into a single update call
676673
8. **NEXT TASK:** Move to the next task in sequence - NEVER skip ahead or do multiple tasks at once
677674
9. **METHODICAL ITERATION:** Repeat this cycle for each task in order until all tasks are complete
678675
10. **COMPLETION:** IMMEDIATELY use 'complete' or 'ask' when ALL tasks are finished
@@ -717,13 +714,6 @@
717714
- Technical documentation or guides
718715
- Any content that would be better as an editable artifact
719716
720-
**CRITICAL FILE CREATION RULES:**
721-
- **ONE FILE PER REQUEST:** For a single user request, create ONE file and edit it throughout the entire process
722-
- **EDIT LIKE AN ARTIFACT:** Treat the file as a living document that you continuously update and improve
723-
- **APPEND AND UPDATE:** Add new sections, update existing content, and refine the file as you work
724-
- **NO MULTIPLE FILES:** Never create separate files for different parts of the same request
725-
- **COMPREHENSIVE DOCUMENT:** Build one comprehensive file that contains all related content
726-
727717
**CRITICAL FILE CREATION RULES:**
728718
- **ONE FILE PER REQUEST:** For a single user request, create ONE file and edit it throughout the entire process
729719
- **EDIT LIKE AN ARTIFACT:** Treat the file as a living document that you continuously update and improve

backend/agent/tools/task_list_tool.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ async def create_tasks(self, sections: Optional[List[Dict[str, Any]]] = None,
345345
"type": "function",
346346
"function": {
347347
"name": "update_tasks",
348-
"description": "Update one or more tasks. Can update content, status, or move tasks between sections. IMPORTANT: Follow the one-task-at-a-time execution principle. After completing each individual task, immediately update it to 'completed' status before proceeding to the next task. This ensures proper progress tracking and prevents bulk operations that violate the sequential execution workflow.",
348+
"description": "Update one or more tasks. EFFICIENT BATCHING: Before calling this tool, think about what tasks you have completed and batch them into a single update call. This is more efficient than making multiple consecutive update calls. Always execute tasks in the exact sequence they appear, but batch your updates when possible. Update task status to 'completed' after finishing each task, and consider batching multiple completed tasks into one call rather than updating them individually.",
349349
"parameters": {
350350
"type": "object",
351351
"properties": {
@@ -354,7 +354,7 @@ async def create_tasks(self, sections: Optional[List[Dict[str, Any]]] = None,
354354
{"type": "string"},
355355
{"type": "array", "items": {"type": "string"}, "minItems": 1}
356356
],
357-
"description": "Task ID (string) or array of task IDs to update. For optimal workflow, prefer updating single tasks to 'completed' status immediately after completion rather than bulk updates."
357+
"description": "Task ID (string) or array of task IDs to update. EFFICIENT APPROACH: Batch multiple completed tasks into a single call rather than making multiple consecutive update calls. Always maintain sequential execution order."
358358
},
359359
"content": {
360360
"type": "string",
@@ -363,7 +363,7 @@ async def create_tasks(self, sections: Optional[List[Dict[str, Any]]] = None,
363363
"status": {
364364
"type": "string",
365365
"enum": ["pending", "completed", "cancelled"],
366-
"description": "New status for the task(s) (optional). Use 'completed' immediately after finishing each individual task to maintain proper execution flow."
366+
"description": "New status for the task(s) (optional). Set to 'completed' for finished tasks. Batch multiple completed tasks when possible."
367367
},
368368
"section_id": {
369369
"type": "string",
@@ -376,15 +376,15 @@ async def create_tasks(self, sections: Optional[List[Dict[str, Any]]] = None,
376376
})
377377
@usage_example(
378378
'''
379-
# Update single task:
379+
# Update single task (when only one task is completed):
380380
<function_calls>
381381
<invoke name="update_tasks">
382382
<parameter name="task_ids">task-uuid-here</parameter>
383383
<parameter name="status">completed</parameter>
384384
</invoke>
385385
</function_calls>
386386
387-
# Update multiple tasks:
387+
# Update multiple tasks (EFFICIENT: batch multiple completed tasks):
388388
<function_calls>
389389
<invoke name="update_tasks">
390390
<parameter name="task_ids">["task-id-1", "task-id-2", "task-id-3"]</parameter>

0 commit comments

Comments
 (0)