browser-use-oauth/lib/browser_use_utils/clean_resources.py
tv0924@icloud.com 92967ed353 [Update] new logic
2025-06-22 20:35:56 +09:00

21 lines
No EOL
724 B
Python

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)