EmptyResponsePolicy

Determines how the tool loop responds when the LLM returns a blank text response with no tool calls. This is a known failure mode of weak open-weights models (gpt-oss-20b, qwen, etc.) after a tool call when they don't know how to proceed — see EmptyLlmResponseException.

Without a policy, the tool loop exits with empty content and the caller surfaces a generic "no response" message. With a policy the loop can either feed the model a synthetic nudge so it gets one more chance, throw immediately, or preserve the current exit-and-let-caller handle behaviour.

See also

Inheritors

Functions

Link copied to clipboard
abstract fun handle(): EmptyResponseAction

Handle a blank-text-no-tool-calls response from the LLM.

Link copied to clipboard
open fun onNonEmpty()

Called whenever the LLM returns a non-blank response, allowing stateful policies to reset internal counters.