async def clean_agent_resources(agent=None): """에이전트 리소스를 정리하는 함수""" if agent: try: await agent.close() except Exception as e: print(f"⚠️ 에이전트 리소스 정리 실패: {e}") async def clean_session_resources(session=None): """브라우저 리소스를 정리하는 함수""" if session: try: await session.close() except Exception as e: print(f"⚠️ 브라우저 리소스 정리 실패: {e}") async def clean_resources(agent=None, session=None): """리소스를 정리하는 함수""" await clean_agent_resources(agent) await clean_session_resources(session)