Files
crewAI/lib
Devin AI 29be99a74e Fix format_answer() to re-raise OutputParserError for retry logic
This commit fixes issue #3771 where format_answer() was catching all
exceptions including OutputParserError and converting them to AgentFinish,
which prevented the retry logic in _invoke_loop() from working correctly.

Changes:
- Modified format_answer() in agent_utils.py to specifically catch and
  re-raise OutputParserError, allowing the retry logic to handle malformed
  LLM outputs properly
- Added comprehensive tests in test_agent_utils.py to verify the fix and
  prevent regressions

The fix ensures that when an LLM returns malformed output (e.g., missing
colons in the Action/Action Input format), the agent will retry with an
error message instead of immediately returning an AgentFinish with the
malformed text.

Co-Authored-By: João <joao@crewai.com>
2025-10-22 02:08:31 +00:00
..