Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/crewai/src/crewai/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,11 @@ async def _aexecute_core(
self._store_input_files()
try:
agent = agent or self.agent
self.agent = agent
if not agent:
raise Exception(
f"The task '{self.description}' has no agent assigned, therefore it can't be executed directly and should be executed in a Crew using a specific process that support that, like hierarchical."
)
self.agent = agent

self.prompt_context = context
tools = tools or self.tools or []
Expand Down Expand Up @@ -740,7 +740,7 @@ async def _aexecute_core(
if self.output_file:
content = (
json_output
if json_output
if json_output is not None
else (
pydantic_output.model_dump_json() if pydantic_output else result
)
Expand Down Expand Up @@ -770,11 +770,11 @@ def _execute_core(
self._store_input_files()
try:
agent = agent or self.agent
self.agent = agent
if not agent:
raise Exception(
f"The task '{self.description}' has no agent assigned, therefore it can't be executed directly and should be executed in a Crew using a specific process that support that, like hierarchical."
)
self.agent = agent

self.prompt_context = context
tools = tools or self.tools or []
Expand Down Expand Up @@ -865,7 +865,7 @@ def _execute_core(
if self.output_file:
content = (
json_output
if json_output
if json_output is not None
else (
pydantic_output.model_dump_json() if pydantic_output else result
)
Expand Down