High severity beginner · Fix: 2-5 min

AttributeError

builtins.AttributeError: 'CrewOutput' object has no attribute 'raw_output'

What this error means
CrewAI's CrewOutput object does not expose a 'raw_output' attribute; the correct attribute is 'raw' or access output via task results directly.

Stack trace

traceback
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'?
QUICK FIX
Replace crew_output.raw_output with crew_output.raw, or access individual task outputs via crew.tasks[i].output.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

1

Accessing crew_output.raw_output instead of crew_output.raw

✓ Fix

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.

2

Expecting CrewOutput to have a single raw_output property like in older crewai versions

✓ Fix

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.

3

Using task.output.raw_output instead of task.output.raw

✓ Fix

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.

4

Crew kickoff returns multiple task outputs but code assumes a single raw_output at crew level

✓ Fix

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

Broken - triggers the error
python
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
Fixed - works correctly
python
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}")
Changed crew_output.raw_output to crew_output.raw (the correct attribute name in crewai>=0.55), and added examples of accessing structured outputs via pydantic_object and individual task outputs.

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.

Python 3.10+ · crewai >=0.55.0 · tested on 0.55.x
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.