AttributeError
builtins.AttributeError: 'CrewOutput' object has no attribute 'raw_output'
Stack trace
Traceback (most recent call last):
File "main.py", line 45, in <module>
print(crew_output.raw_output)
AttributeError: 'CrewOutput' object has no attribute 'raw_output'. Did you mean: 'raw'? Why it happens
CrewAI's CrewOutput class exposes structured task results through specific attributes (raw, pydantic_object, json_dict) but not 'raw_output'. This confusion typically arises from outdated documentation or assumptions about attribute naming. In crewai>=0.55, CrewOutput from crew.kickoff() returns a structured object where individual task outputs are accessed via task execution results, not a top-level raw_output property.
Detection
Before deploying, test your crew.kickoff() output by printing dir(crew_output) or crew_output.__dict__ to verify available attributes. Add type hints: from crewai import CrewOutput, then type-check the return value to catch attribute access errors at linting time.
Causes & fixes
Accessing crew_output.raw_output instead of crew_output.raw
Change crew_output.raw_output to crew_output.raw. If you need the raw string of a specific task result, use task_result.raw instead of accessing crew-level output.
Expecting CrewOutput to have a single raw_output property like in older crewai versions
Update to crewai>=0.55 API: crew output is now a CrewOutput object with .raw (string), .pydantic_object, and .json_dict properties. Access individual task outputs via crew.tasks[i].output or iterate crew_output results.
Using task.output.raw_output instead of task.output.raw
Task outputs are TaskOutput objects; use task.output.raw for the string output, task.output.pydantic_object for structured data, or task.output.json_dict for JSON.
Crew kickoff returns multiple task outputs but code assumes a single raw_output at crew level
Iterate through crew execution results: if using crew.kickoff(), access individual task outputs via the returned CrewOutput object's properties, or store task outputs separately during crew execution.
Code: broken vs fixed
from crewai import Agent, Task, Crew
import os
# Define agents and tasks
researcher = Agent(
role="Researcher",
goal="Research AI trends",
backstory="An expert AI researcher"
)
research_task = Task(
description="Research the latest AI trends",
agent=researcher,
expected_output="A summary of AI trends"
)
crew = Crew(
agents=[researcher],
tasks=[research_task]
)
# Execute crew
crew_output = crew.kickoff()
# This line causes AttributeError: 'CrewOutput' object has no attribute 'raw_output'
print(crew_output.raw_output) # WRONG — raw_output does not exist from crewai import Agent, Task, Crew
import os
# Define agents and tasks
researcher = Agent(
role="Researcher",
goal="Research AI trends",
backstory="An expert AI researcher"
)
research_task = Task(
description="Research the latest AI trends",
agent=researcher,
expected_output="A summary of AI trends"
)
crew = Crew(
agents=[researcher],
tasks=[research_task]
)
# Execute crew
crew_output = crew.kickoff()
# FIXED: Use .raw instead of .raw_output
print(crew_output.raw) # Correct — outputs the raw string result
# Alternative: Access structured output
if crew_output.pydantic_object:
print(f"Structured: {crew_output.pydantic_object}")
# Access specific task output
for task in crew.tasks:
print(f"Task: {task.description}")
print(f"Output: {task.output.raw}") Workaround
If you have legacy code expecting raw_output, create a wrapper function: def get_crew_raw(crew_output): return crew_output.raw if hasattr(crew_output, 'raw') else str(crew_output). This maps the expected interface to the actual attribute, allowing you to defer the refactor.
Prevention
Always check CrewOutput object structure after crew.kickoff(): add print(type(crew_output), dir(crew_output)) to verify available attributes. Use IDE autocomplete (if using VS Code + Pylance) to surface available properties. Add type hints: crew_output: CrewOutput to catch typos at lint time. Reference official crewai>=0.55 docs for CrewOutput schema.