Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(agent): guard against empty or interrupted streaming responses (#1861)
xueshanfeihu0073d10118e4f86
diff --git a/src/agentscope/agent/_agent.py b/src/agentscope/agent/_agent.pyindex 7440a1305..8c7acc90e 100644--- a/src/agentscope/agent/_agent.py+++ b/src/agentscope/agent/_agent.py@@ -879,6 +879,15 @@ class Agent:block_id=data_block_id,)+ # Guard against empty or interrupted streaming responses.+ if completed_response is None:+ raise RuntimeError(+ "Model returned an empty streaming response: no is_last=True"+ " chunk was received. The model call may have been "+ "interrupted mid-stream (network dropout, timeout, or model "+ "bug).",+ )+# Send the model call ended event with usage if availableyield ModelCallEndEvent(reply_id=self.state.reply_id,