fix: replace blocking requests calls with async aiohttp in agent handlers#42
Open
CodeBySayak wants to merge 1 commit into
Open
fix: replace blocking requests calls with async aiohttp in agent handlers#42CodeBySayak wants to merge 1 commit into
CodeBySayak wants to merge 1 commit into
Conversation
Collaborator
|
@leno23, please fix the CI check |
Collaborator
|
Thanks for the contribution 🚀 The CI for this PR is currently failing. Please fix the following so we can move forward:
Once the checks are green it'll be ready for maintainer review. Let me know if you need any help! 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaced blocking synchronous requests HTTP calls with async aiohttp in three agent examples. The requests library blocks the entire asyncio event loop while waiting for a network response, preventing agents from processing concurrent messages or maintaining protocol heartbeats. This fix ensures agents remain fully responsive during external API calls.
Type of Change
Checklist
ruff check ..ruff format ..README.mdfor changed example(s)..env.exampleif environment variables are required.CHANGELOG.md(required for non-doc changes).Related Issue
Link issue number(s), if any: #41
Notes for Reviewers
The logic and behaviour of all three agents is unchanged — only the HTTP transport layer was swapped from requests to aiohttp. The aiohttp dependency was already present in image-agent-payment-protocol/requirements.txt, so no new dependencies are introduced for that example. For web3/internet-computer/fetch/, a requirements.txt was added as the file was missing entirely. For Rag-agent/ango/agent.py, arun() is the officially supported async method in the Agno framework and is a drop-in replacement for run() in an async context.