Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/strands_tools/browser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,14 @@ def close(self, action: CloseAction) -> Dict[str, Any]:
return {"status": "error", "content": [{"text": f"Error: {str(e)}"}]}

def _execute_async(self, action_coro) -> Any:
# Ensure the event loop is registered on the current thread.
# When stream_async() dispatches this method to a worker thread,
# the loop created in __init__ may not be set as the current
# thread's event loop, causing run_until_complete to fail with
# "RuntimeError: There is no current event loop in thread".
# See: strands-agents/tools#453
asyncio.set_event_loop(self._loop)

# Apply nest_asyncio if not already applied
if not self._nest_asyncio_applied:
nest_asyncio.apply()
Expand Down
Loading