Help with Task Context Resolution in CrewAI

I’m encountering an issue with task context resolution in CrewAI. I’m using version 0.76.9. When a task references another task in its context list, if appears to be causing configuration processing errors.

Example Config

assign_experts:
  description: >
    Sample description
  expected_output: >
    Sample expected output
  agent: expert_picker
  output_file: assigned_tasks.yaml
  context:
    - collect_tasks

collect_tasks:
  description: >
    Sample description
  expected_output: >
    Sample expected output
  agent: task_picker

Current Behavior

When processing the context list in crew_base.py, the code immediately instantiates referenced tasks, which causes a second process_config call that tries to process the agent name string as configuration data.

The exact error I get is AttributeError: 'str' object has no attribute 'get' which is triggered because the string “collect_tasks” is being referenced as if its a config dictionary.

Is this a bug or am I doing this wrong?

Thanks!

I think I figured out what is wrong. This error happens if the tasks are defined out of order. For example, if task2 includes task1 as context but task2 is defined first in the yaml list, you will get this error when crew_base.py attempts to reference the task dependency. It seems that when it can’t find the task definition, it tries to create an instance of the missing task, which results in the process_config ultimately trying to reference the task string as a task config.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.