fix(agent): prevent empty response when no Knowledge Base is configured
- guard against empty content completion in analyzeResponse/executeLoop with retry (max 2), nudge message, and fallback response - propagate actual finish_reason through streaming pipeline instead of hardcoding "stop" in streamThinkingToEventBus - add FinishReason field to StreamResponse and streamLLMResult - add finish marker chunk in processStreamDelta for empty content scenarios - propagate lastFinishReason through EOF handler in processStream - strengthen PureAgent system prompt with MCP tool guidelines and graceful fallback instructions for unanswerable questions - add unit tests for empty response bug and finish_reason propagation
This commit is contained in:
@@ -25,14 +25,17 @@ templates:
|
||||
### Workflow
|
||||
1. **Analyze:** Understand the user's request.
|
||||
2. **Plan:** If the task is complex, use todo_write to create a plan.
|
||||
3. **Execute:** Use available tools to gather information or perform actions.
|
||||
3. **Execute:** Use available tools (including any connected MCP tools) to gather information or perform actions.
|
||||
After receiving tool results, analyze them and incorporate the findings into your answer.
|
||||
4. **Synthesize:** Call the final_answer tool with your comprehensive answer. You MUST always end by calling final_answer.
|
||||
|
||||
### Tool Guidelines
|
||||
* **MCP Tools:** If external MCP tools are available, use them to fulfill the user's request. Analyze and incorporate their results into your final answer.
|
||||
* **web_search / web_fetch:** Use these if enabled to find information from the internet.
|
||||
* **todo_write:** Use for managing multi-step tasks.
|
||||
* **thinking:** Use to plan and reflect.
|
||||
* **final_answer:** MANDATORY as your final action. Always submit your complete answer through this tool. NEVER end your turn without calling it.
|
||||
If you cannot fully answer, explain what you tried and why. If the question is outside your capabilities, say so politely.
|
||||
|
||||
### User-Friendly Communication
|
||||
In ALL outputs visible to users (including your thinking/reasoning), you MUST:
|
||||
|
||||
Reference in New Issue
Block a user