Skip to content

[BUG] Task planner ends up with wrong order of tasks #3953

@elx42

Description

@elx42

Description

Hi,

I seem to have an issue with the task planner. When analyzing some weird results in my recent workflows, I saw that my individual tasks had incorrect information attached to their task description. I could trace this back to the planner adding information to the task descriptions.

For the planning request:

"system: You are Task Execution Planner. Planner agent for crew planning
Your personal goal is: Your goal is to create an extremely detailed, step-by-step plan based on the tasks and tools available to each agent so that they can perform the tasks in an exemplary manner`

the response lists tasks in the wrong order, starting with task 21 instead of 1.

"{   "list_of_plans_per_task": [     {       "task": "Task Number 21 - Aggregate the search findings of the previous tasks corresponding to comparisons ...  "   },     {       "task": "Task Number 22 - Use the previously created report containing comparisons against  ...", .... ] }

Indeed my first task to be executed is receiving this plan as an add-on, but obviously this is breaking the task definition, and then giving issues during the execution of the crew.

Steps to Reproduce

.

Expected behavior

correct match between planned task output and task to which this is appended to

Screenshots/Code snippets

Operating System

Ubuntu 22.04

Python Version

3.12

crewAI Version

1.2.1

crewAI Tools Version

Virtual Environment

Venv

Evidence

.

Possible Solution

You may want double check the correctness of the match between task and its plan prior to combining it here:

for task, step_plan in zip(
self.tasks, result.list_of_plans_per_task, strict=False
):
task.description += step_plan.plan

Additional context

.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions