If Tasks Run in Order, Why Declare Context Explicitly?

Refer to Module 1 Graded Lab

crew = Crew(
    . . . ,
    # add the list of tasks    
    tasks=[analyze_code_quality, review_security, make_review_decision],
)

When defining a Crew, tasks are already listed in a specific sequence, which implies that they will execute in order and that later tasks conceptually depend on earlier ones. Given this, it’s unclear why the context parameter is also required in the definition of the Review Decision task earlier in the code

### START CODE HERE ###

# Create the review decision task
make_review_decision = Task(
    ...
    agent=tech_lead,
    # add the two previous tasks as context
    context=[analyze_code_quality, review_security], 
    ...
)
### END CODE HERE ###

Specifically:

  • If analyze_code_quality and review_security are executed before make_review_decision due to task ordering in the Crew, why must their outputs be explicitly declared again via context?
  • Is task ordering alone insufficient to ensure that earlier task outputs are available to later tasks? I just don’t understand why duplication?

Hey @therisingsun. If you don’t specify the context, then only the result from the immediate previous task is passed. In this case, only the result from review_security would be passed to make_review_decision. Since you also want the output from the first task to complete the make_review_decisionyou need to set the context.