agentscope icon indicating copy to clipboard operation
agentscope copied to clipboard

[Bug]: Agent被打断

Open bjmajic opened this issue 1 month ago • 0 comments

创建了一个ReAct智能体,使用 try: agent_response = await self.agent(user_message) print(f"ReActAgent: {agent_response.content}") except Exception as e: print(f"Error: {e}")

使用管道捕获流式输出: ` async for msg, last in stream_printing_messages( agents=[self.planning_agent.agent], coroutine_task=self.planning_agent.generate_plan(data_dict), ):

        # print(msg.content, last)
        yield msg.content[0].get("text"), last
        if last:
            json_content = extract_response_from_content(msg.content[0].get("text", "[warning] no content found"))
            on_finished(json_content)
            return

`

Image

但是会打印出:ReActAgent: I noticed that you have interrupted me. What can I do for you? 应该是触发了 raise asyncio.CancelledError()

请问这是什么情况?

bjmajic avatar Nov 26 '25 04:11 bjmajic