Skip to content

fix: replace blocking requests calls with async aiohttp in agent handlers#42

Open
CodeBySayak wants to merge 1 commit into
fetchai:mainfrom
CodeBySayak:iss
Open

fix: replace blocking requests calls with async aiohttp in agent handlers#42
CodeBySayak wants to merge 1 commit into
fetchai:mainfrom
CodeBySayak:iss

Conversation

@CodeBySayak

Copy link
Copy Markdown

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

  • New agent example
  • Bug fix
  • Documentation update
  • Refactor / cleanup
  • Other

Checklist

  • I have starred this repository.
  • I ran ruff check ..
  • I ran ruff format ..
  • I added/updated README.md for changed example(s).
  • I added .env.example if environment variables are required.
  • I added demo image/GIF (if applicable).
  • I added agent profile link (if applicable).
  • I updated CHANGELOG.md (required for non-doc changes).
  • I verified paths/commands used in docs.

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.

@gautammanak1

Copy link
Copy Markdown
Collaborator

@leno23, please fix the CI check

@gautammanak1

Copy link
Copy Markdown
Collaborator

Thanks for the contribution 🚀

The CI for this PR is currently failing. Please fix the following so we can move forward:

  • format — run ruff format . and commit the result
  • lint — run ruff check . --fix and resolve remaining warnings
  • typecheck — fix the reported type errors
  • stargazer-gate — please ⭐ star this repository (the gate passes once you've starred)

Once the checks are green it'll be ready for maintainer review. Let me know if you need any help! 🙌

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants