diff --git a/run_agent.py b/run_agent.py index 1372def27f1..e5f070f9c1a 100644 --- a/run_agent.py +++ b/run_agent.py @@ -3308,6 +3308,10 @@ class AIAgent: # (for example Hindsight) that own their own network clients. # Explicitly stop those providers before closing the agent so # their aiohttp sessions do not leak until GC/process exit. + # Then close all remaining resources (httpx client, + # subprocesses, etc.) so GC doesn't try to clean them up on a + # dead asyncio event loop (which produces "Event loop is + # closed" errors). if review_agent is not None: try: review_agent.shutdown_memory_provider()