Skip to content

fix: retry with nudge when LLM returns empty response after tool use#315

Open
elseasama wants to merge 1 commit intosipeed:mainfrom
elseasama:fix/retry-empty-response-after-tool-use
Open

fix: retry with nudge when LLM returns empty response after tool use#315
elseasama wants to merge 1 commit intosipeed:mainfrom
elseasama:fix/retry-empty-response-after-tool-use

Conversation

@elseasama
Copy link

@elseasama elseasama commented Feb 16, 2026

Summary

  • Some models (e.g. kimi-k2.5 via NVIDIA API) occasionally return empty content after processing tool call results, causing the bot to reply with "I've completed processing but have no response to give."
  • When the LLM returns empty content after a tool use iteration (iteration > 1), the agent now appends a nudge message and retries, giving the model another chance to generate a proper response
  • The retry only happens once and respects maxIterations to avoid infinite loops

Test plan

  • Send a message that triggers a tool call (e.g. web search) and verify the bot responds with actual content
  • Verify that direct answers (no tool calls) are unaffected
  • Verify that the nudge retry only fires once per request (check logs for "Empty response after tool use, retrying with nudge")

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