Skip to content
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

Fix busy loop in single threaded agent runtime #4773

Open
jackgerrits opened this issue Dec 20, 2024 · 1 comment
Open

Fix busy loop in single threaded agent runtime #4773

jackgerrits opened this issue Dec 20, 2024 · 1 comment
Milestone

Comments

@jackgerrits
Copy link
Member

Discussed in #4772

Originally posted by un-hongly December 20, 2024

team.run_stream(task=input.message)
async for message in stream:
   pass

async for message in stream cause high cpu usages.

Screenshot 2024-12-20 at 5 40 20 in the afternoon

We need to replace this busy loop with proper eventing based on when messages are available to be consumed.

@jackgerrits jackgerrits added this to the 0.4.0 milestone Dec 20, 2024
@ekzhu
Copy link
Collaborator

ekzhu commented Dec 20, 2024

Good catch. We can use asyncio.Event to set and fire events or use asyncio.Queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants