[AI Agent Application Development Framework] - 🚀 Build AI agent native application in very few code 💬 Easy to interact with AI agent in code using structure data and chained-calls syntax 🧩 Enhance AI Agent using plugins instead of rebuild a whole new agent
之前在运行workflow时候多轮次中间经常出现,RuntimeError: Event loop is closed,但结果能够得到,为了解决这个问题,我找了写资料,发觉在agent.py里面改下代码即可,在214行,增加一个try finally即可。 def start_in_theard(): asyncio.set_event_loop(asyncio.new_event_loop()) loop = asyncio.get_event_loop() try: reply = asyncio.get_event_loop().run_until_complete(self.start_async(request_type)) reply_queue.put_nowait(reply) finally: loop.close()
reply = asyncio.get_event_loop().run_until_complete(self.start_async(request_type))
虽然这个错误看起来很可怕,但实际上它不会影响程序的正常运行和输出结果。这只是一个警告信息,表示在程序结束时,事件循环已经关闭,因此无法正常关闭一些底层连接。
为了避免这个警告,你可以在程序结束前手动关闭事件循环,这样就不会触发这个错误了。