Files
crewAI/lib
Devin AI 1dd566311e feat: add debug logging when OutputParserError triggers agent retry
This addresses issue #4246 by adding optional debug logging that captures:
- The raw LLM output that failed to parse (truncated to 500 chars)
- The specific parsing error message
- Retry count per agent turn
- Agent role context for easier debugging

The debug logging is controlled by Python's standard logging module at DEBUG level,
allowing users to enable it via environment variables or log configuration.

Changes:
- Modified handle_output_parser_exception() in agent_utils.py to accept raw_output
  and agent_role parameters for debug logging
- Updated CrewAgentExecutor._invoke_loop() and _ainvoke_loop() to pass raw output
  and agent role to the exception handler
- Updated LiteAgent._invoke_loop() to pass raw output and agent role
- Added comprehensive tests for the new debug logging functionality

Co-Authored-By: João <joao@crewai.com>
2026-01-16 18:51:36 +00:00
..