creamy-angle-38470
11/12/2025, 4:52 PMconversation.astream() still supported?
async def run_agent():
conversation = Conversation(agent=agent, workspace=cwd)
conversation.send_message("Write 3 facts about Python to FACTS.txt")
async for event in conversation.astream():
print(f"Event: {event}")
This is from the online docs: here.
When I try to run this code snippet locally, I get this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 await run_agent()
Cell In[1], line 40, in run_agent()
37 conversation = Conversation(agent=agent, workspace=cwd)
38 conversation.send_message("Please add 'hi there' to the top of the readme.md file")
---> 40 async for event in conversation.astream():
41 print(f"Event: {event}")
AttributeError: 'LocalConversation' object has no attribute 'astream'limited-student-10747
11/12/2025, 4:57 PMnutritious-balloon-65098
11/12/2025, 4:57 PMnutritious-balloon-65098
11/12/2025, 5:02 PMconversation.astream() functionality in the OpenHands/software-agent-sdk repository. Here's what I found:
Answer to Your Question:
The astream() method NEVER existed in the codebase and was never removed. This is a documentation error where a feature was documented before implementation.
Key Findings:
1. No Historical Evidence: I searched the entire git history using multiple methods (git log --grep, git log -S, etc.) and found zero commits that ever added or removed an astream() method.
2. Not in Current Code: The method doesn't exist in any conversation class (BaseConversation, LocalConversation, or RemoteConversation).
3. Documentation Issue: The problematic documentation was added on October 22, 2025 (commit b419a23) in the docs repository as part of a large documentation standardization effort. It shows example code using conversation.astream() that has never been implemented.
4. Mismatch with Examples: The actual working example file (examples/01_standalone_sdk/11_async.py) that the documentation links to does NOT use astream(). Instead, it uses the callback-based approach with AsyncCallbackWrapper.
Current Working Alternative:
Users should use the callback-based approach instead:
async def callback_coro(event: Event):
# Process events here
pass
async def main():
loop = asyncio.get_running_loop()
callback = AsyncCallbackWrapper(callback_coro, loop)
await loop.run_in_executor(None, run_conversation, callback)
There was no justification for removal because the feature was never implemented in the first place.
I've created a detailed investigation report at /workspace/project/astream_investigation.md documenting all evidence and findings. No code changes were made as this was purely an investigative task.
<sub>View full conversation</sub>chilly-france-44439
11/12/2025, 5:06 PMastream in OpenHands/docs repo (sdk/guides/convo-async#async-streaming). Also for concurrency agent, instead of using run_task, you should refer to the function that has been defined above in the example document. Send a PR when you are donenutritious-balloon-65098
11/12/2025, 5:06 PMlimited-student-10747
11/12/2025, 5:06 PMastream in OpenHands/docs repo (sdk/guides/convo-async#async-streaming). Also for concurrency agent, instead of using run_task, you should refer to the function that has been defined above in the example document. Send a PR when you are done
This is in the OpenHands/docs directorynutritious-balloon-65098
11/12/2025, 5:06 PMnutritious-balloon-65098
11/12/2025, 5:09 PMastream usage from sdk/guides/convo-async.mdx - Complete
2. Fix concurrent agents example to use actual functions from the example - Complete
3. Send a PR - Complete
Changes Made to OpenHands/docs:
File Modified: sdk/guides/convo-async.mdx
1. Removed "Async Streaming" section (14 lines deleted)
â—¦ Eliminated documentation for non-existent conversation.astream() method
â—¦ This was causing AttributeError for users following the docs
2. Fixed "Concurrent Agents" example (8 lines added)
â—¦ Changed from undefined run_task() to actual run_conversation() function defined in the example
â—¦ Added proper async setup: loop.run_in_executor() with AsyncCallbackWrapper(callback_coro, loop)
â—¦ Now demonstrates correct concurrent execution pattern
Pull Request:
🔗 PR #103: https://github.com/OpenHands/docs/pull/103
• Branch: fix-astream-documentation
• Status: Draft (ready for review)
• Net change: -10 lines (removed incorrect documentation)
The documentation now accurately reflects the SDK's actual implementation and provides working examples that users can follow without errors.
<sub>View full conversation</sub>creamy-angle-38470
11/12/2025, 7:16 PMastream() - basically an async generator of the events?
My understanding is that conversation.run() doesnt actually return anything, but creates the side effects in the repository. So I think it would have to somehow involve an async-callback?limited-student-10747
11/12/2025, 11:15 PMchilly-france-44439
11/12/2025, 11:31 PMon_event callback that adds stuff to the queue?
And then you can listen to that queue as an async generator of events