diff --git a/src/agent/run.ts b/src/agent/run.ts index f161533..14382b2 100644 --- a/src/agent/run.ts +++ b/src/agent/run.ts @@ -117,7 +117,7 @@ export async function runAgent( fullResponse += currentText; // If stream errored with "no output" and we have no text, try to recover - if (streamError && !currentText) { + if (streamError && (!currentText && toolCalls.lenght === 0)) { // Add a fallback response fullResponse = "I apologize, but I wasn't able to generate a response. Could you please try rephrasing your message?";