mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 08:41:53 +09:00
[Update] new logic
This commit is contained in:
parent
95d56259e7
commit
92967ed353
38 changed files with 1516 additions and 5209 deletions
20
lib/agents/run_agent.py
Normal file
20
lib/agents/run_agent.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from lib.browser_use_utils.clean_resources import clean_agent_resources
|
||||
|
||||
async def run_agent(agent):
|
||||
try:
|
||||
response = await agent.run()
|
||||
final_result = response.final_result()
|
||||
|
||||
if final_result is None:
|
||||
return -1, "최종 결과가 없습니다. 에이전트 실행 실패"
|
||||
return 0, final_result
|
||||
except Exception as e:
|
||||
# API 쿼터 문제인지 확인
|
||||
if "ResourceExhausted" in str(e) or "429" in str(e):
|
||||
return 1, "API 쿼터 에러로 인한 실패"
|
||||
# 일반 에러 처리
|
||||
else:
|
||||
return 2, "일반 에러로 인한 실패"
|
||||
finally:
|
||||
await clean_agent_resources(agent)
|
||||
print("리소스 정리 완료")
|
||||
Loading…
Add table
Add a link
Reference in a new issue