Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(hooks): prevent agent from crashing on Studio disconnection (#1298)
YingchaoX57035100de84
diff --git a/src/agentscope/hooks/_studio_hooks.py b/src/agentscope/hooks/_studio_hooks.pyindex 468767031..5104b01b9 100644--- a/src/agentscope/hooks/_studio_hooks.py+++ b/src/agentscope/hooks/_studio_hooks.py@@ -6,6 +6,7 @@ import requestsimport shortuuidfrom ..agent import AgentBase, UserAgent+from .._logging import loggerdef as_studio_forward_message_pre_print_hook(@@ -50,4 +51,11 @@ def as_studio_forward_message_pre_print_hook(n_retry += 1continue- raise e from None+ # Graceful degradation: log warning and return to avoid crashing+ logger.warning(+ "Failed to forward message to Studio after %d retries: %s. "+ "Agent will continue without Studio forwarding.",+ n_retry,+ e,+ )+ return