agentscope icon indicating copy to clipboard operation
agentscope copied to clipboard

[Bug]: CodeAct Agent: cannot reuse already awaited coroutine

Open drakewxh opened this issue 8 months ago • 2 comments

Describe the bug When I use CodeAct Agent to generate code and execute it, an error message appears: cannot reuse already awaited coroutine. I suspect it may be related to jupyter notebook. When I restart my project, the error still exists. I restarted my computer again, and the error still exists. Please help me analyze how to solve this problem. Thank you.

Error messages python code user: Excution Failed: Execution Output: cannot reuse already awaited coroutine

drakewxh avatar May 12 '25 07:05 drakewxh

@garyzhang99 Please take a look at this issue

DavdGao avatar May 12 '25 08:05 DavdGao

Based on the information you've provided, it appears that you are calling the CodeActAgent within JupyterNotebook, which itself utilizes asyncio. Multiple calls to asyncio in this context may result in errors.

I suggest implementing the following code to potentially resolve this issue:

import nest_asyncio
nest_asyncio.apply()

Additionally, you may wish to consider running the examples directly from either: examples/conversation_with_codeact_agent/codeact_agent_example_modeling.ipynb or examples/conversation_with_codeact_agent/codeact_agent_example_tools.ipynb

This might help you determine if the issue persists.

garyzhang99 avatar May 13 '25 06:05 garyzhang99