Skip to content

Conversation

Vidit-Ostwal
Copy link
Contributor

@Vidit-Ostwal Vidit-Ostwal commented Sep 25, 2025

This is a try solution for None / Empty response from LLM.

This PR assumes that this might be because of context length exceeded at the server side, which is not returning an error, just an empty response.
This PR captures the ValueError which is being raised and try again with summarization.


Note

Detect and recover from null/empty LLM responses caused by context-length overflow, while standardizing messages to LLMMessage and adding targeted tests.

  • Utilities:
    • Context Length Handling: Extend is_context_length_exceeded(exception, messages, llm) and add is_null_response_because_context_length_exceeded(...) to detect empty responses from context overflow; update call sites to pass messages and llm.
    • Summarization Flow: handle_context_length unchanged behavior but now triggered also on null responses due to context overflow.
  • Agents:
    • Executor: Update CrewAgentExecutor to type messages as list[LLMMessage], import Literal, and narrow _append_message role to Literal["user","assistant","system"]; pass new args to is_context_length_exceeded.
    • Mixin: Change messages type to list[LLMMessage].
  • Typing/Interfaces:
    • Use BaseAgent instead of Agent in TaskEvaluator and execute_tool_and_check_finality signatures.
  • Tests:
    • Add tests/utilities/test_agent_utils.py covering is_null_response_because_context_length_exceeded edge cases.
    • Add agent test for handling no/empty LLM response via summarization path when respect_context_window=True.

Written by Cursor Bugbot for commit a3d1666. This will update automatically on new commits. Configure here.

@Vidit-Ostwal
Copy link
Contributor Author

Hey @lucasgomide, do you think this could be possible solution for this?
#2885 (comment)

I got some feedback from folks who tried the feature branch

@Vidit-Ostwal Vidit-Ostwal changed the title vo/fix/none_empty_response WIP Fix no response / null response from LLM Sep 27, 2025
cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant