Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(tool): preserve error state in tool responses (#2178)
KXH7be0da001fc4
diff --git a/src/agentscope/tool/_response.py b/src/agentscope/tool/_response.pyindex db6eed57a..999e284e7 100644--- a/src/agentscope/tool/_response.py+++ b/src/agentscope/tool/_response.py@@ -135,9 +135,15 @@ class ToolResponse(BaseModel):# worse.if chunk.state == ToolResultState.ERROR:self.state = ToolResultState.ERROR- elif chunk.state == "interrupted":+ elif (+ self.state != ToolResultState.ERROR+ and chunk.state == ToolResultState.INTERRUPTED+ ):self.state = ToolResultState.INTERRUPTED- elif chunk.state == ToolResultState.DENIED:+ elif (+ self.state != ToolResultState.ERROR+ and chunk.state == ToolResultState.DENIED+ ):self.state = ToolResultState.DENIEDself.metadata.update(chunk.metadata)