-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GrpcWorkerAgentRuntimeHost fails to start due to "no running event loop" error #5124
Comments
It's not a bug, you need to run this inside an async function. async def main():
host = GrpcWorkerAgentRuntimeHost(address="0.0.0.0:50051")
host.start() # Start a host service in the background.
await service.stop_when_signal()
if __name__ == "__main__":
asyncio.run(main()) See sample: https://github.com/microsoft/autogen/blob/main/python/samples/core_grpc_worker_runtime/run_host.py |
I followed the sample to wrap the GrpcWorkerAgentRuntimeHost usage inside an async function as shown below
However, I still encountered the following error when running the code:
I found workaround by chatgpt:
|
Would you like to submit a PR to update the sample code. It's very helpful :) |
What happened?
While using Distributed Agent Runtime to start
GrpcWorkerAgentRuntimeHost
, an error occurs. Below are the steps to reproduce the issue and the code snippet.Steps to Reproduce:
GrpcWorkerAgentRuntimeHost
:Expected Behavior:
GrpcWorkerAgentRuntimeHost
should successfully start the background service without throwing aRuntimeError
.What did you expect to happen?
How can we reproduce it (as minimally and precisely as possible)?
The error message suggests that an asyncio event loop is not properly initialized, which causes asyncio.create_task to fail.
AutoGen version
0.4.2
Which package was this bug in
Extensions
Model used
No response
Python version
3.11.6
Operating system
Windows10
Any additional info you think would be helpful for fixing this bug
No response
The text was updated successfully, but these errors were encountered: