diff --git a/src/crewai/agents/parser.py b/src/crewai/agents/parser.py index 4041a5ee6..7dd3ba8e7 100644 --- a/src/crewai/agents/parser.py +++ b/src/crewai/agents/parser.py @@ -122,7 +122,10 @@ class CrewAgentParser: regex = r"(.*?)(?:\n\nAction|\n\nFinal Answer)" thought_match = re.search(regex, text, re.DOTALL) if thought_match: - return thought_match.group(1).strip() + thought = thought_match.group(1).strip() + # Remove any triple backticks from the thought string + thought = thought.replace("```", "").strip() + return thought return "" def _clean_action(self, text: str) -> str: