Description
I noticed the agents ignore the context tasks given to them in the context field when run using pipeline.
The following code shows three tasks: "Say Giraffe", "Say Dolphin", and "Say both of the previous words".
The last one is given the context of the first two.
When I run the following code, I get the answer:
# Agent: A dad
## Final Answer:
Twho words
As if it doesn't understand what the previous words are.
Steps to Reproduce
Run the following code:
from crewai import Crew, Process, Task, Agent, Pipeline
import asyncio
dad_agent = Agent(
role="A dad",
goal="Do as your kid commands",
backstory="You are a dad, you have to do as your kid commands",
tools=[],
verbose=True,
llm="gpt-4o-mini",
)
task_1 = Task(
description="say Giraffe", expected_output="A single word", agent=dad_agent
)
task_2 = Task(
description="say Dolphin", expected_output="A single word", agent=dad_agent
)
task_3 = Task(
description="Say both of the previous words",
expected_output="Twho words",
agent=dad_agent,
context=[task_1, task_2],
)
# Instantiate your crew with a sequential process
dadCrew = Crew(
agents=[dad_agent],
tasks=[task_1, task_2, task_3],
verbose=True,
process=Process.sequential,
output_log_file="crewai.log",
)
class MyPipeline:
def __init__(self):
self.dad_crew = dadCrew
def create_pipeline(self):
return Pipeline(
stages=[
self.dad_crew,
]
)
async def kickoff(self, inputs):
pipeline = self.create_pipeline()
results = await pipeline.kickoff(inputs)
return results
def run():
"""
Run the pipeline.
"""
pipeline = MyPipeline()
results = asyncio.run(pipeline.kickoff(inputs=[{}]))
print(results)
if __name__ == "__main__":
print("Running the crew without debug mode")
run()
Expected behavior
Expected final output:
#Agent: A dad
##Final Answer:
Giraffe Dolphin
Screenshots/Code snippets
The code above ^
Operating System
Windows 11
Python Version
3.12
crewAI Version
0.65.2
crewAI Tools Version
0.65.2
Virtual Environment
Venv
Evidence

Possible Solution
Fix the way context is given to the tasks. Something doesn't work there
Additional context
After debugging, It seens the context of the third task contains both of the tasks without their outputs after they ran.
Description
I noticed the agents ignore the context tasks given to them in the
contextfield when run using pipeline.The following code shows three tasks: "Say Giraffe", "Say Dolphin", and "Say both of the previous words".
The last one is given the context of the first two.
When I run the following code, I get the answer:
As if it doesn't understand what the previous words are.
Steps to Reproduce
Run the following code:
Expected behavior
Expected final output:
#Agent: A dad
##Final Answer:
Giraffe Dolphin
Screenshots/Code snippets
The code above ^
Operating System
Windows 11
Python Version
3.12
crewAI Version
0.65.2
crewAI Tools Version
0.65.2
Virtual Environment
Venv
Evidence
Possible Solution
Fix the way context is given to the tasks. Something doesn't work there
Additional context
After debugging, It seens the context of the third task contains both of the tasks without their outputs after they ran.