diff --git a/src/agentscope/agents/react_agent.py b/src/agentscope/agents/react_agent.py index a806c40a9..8c18d759f 100644 --- a/src/agentscope/agents/react_agent.py +++ b/src/agentscope/agents/react_agent.py @@ -222,11 +222,20 @@ def _acting(self, function_call: dict) -> None: ] # The execution message, may be execution output or error information - msg_execution = self.service_toolkit.parse_and_call_func( + msg_execution_str = self.service_toolkit.parse_and_call_func( formatted_function_call, ) + + # Convert the string to a Msg object + msg_execution = Msg( + name="system", + content=msg_execution_str, + role="system", + echo=self.verbose + ) + if self.verbose: - self.speak(msg_execution) + self.speak(msg_execution.content) self.memory.add(msg_execution) @staticmethod @@ -243,4 +252,4 @@ def finish(response: str) -> ServiceResponse: return ServiceResponse( status=ServiceExecStatus.SUCCESS, content=response, - ) + ) \ No newline at end of file