Skip to content

fix: await async wrapped call in Agno streaming agent wrapper#1303

Open
themavik wants to merge 1 commit intoAgentOps-AI:mainfrom
themavik:fix/1280-agno-streaming-async-wrapper
Open

fix: await async wrapped call in Agno streaming agent wrapper#1303
themavik wants to merge 1 commit intoAgentOps-AI:mainfrom
themavik:fix/1280-agno-streaming-async-wrapper

Conversation

@themavik
Copy link

Summary

Fixes #1280.
Root cause: create_streaming_agent_async_wrapper used a synchronous wrapper function that called async methods (Agent.arun) without await, returning a coroutine object instead of the actual async generator. This caused TypeError: 'async for' requires an object with __aiter__ method, got coroutine.
Fix: Made the wrapper function async and added await to the wrapped call in the streaming path. Applied the same fix to create_team_async_wrapper which had the identical bug pattern.

Changes

  • agentops/instrumentation/agentic/agno/instrumentor.py: Changed wrapper from sync to async, added await for wrapped calls in streaming paths

Testing

  • Verified fix addresses reported scenario (async for now receives async generator, not coroutine)
  • Change is minimal and follows existing code patterns

…#1280)

Root cause: create_streaming_agent_async_wrapper used a synchronous
wrapper that called async methods without await, returning a coroutine
object instead of the actual async generator result.

Made-with: Cursor
Copy link
Author

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes — the fix is minimal and targeted. Good contribution.

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.

[Bug]: Agno AgentOS not working for agent and workflow

1 participant