Spaces:
Sleeping
Sleeping
Download test_agent_local.py from SAFE44/humanbrowser: direct link, hf CLI and curl.
- Browser
- Download file 932 Bytes
-
https://huggingface.co/spaces/SAFE44/humanbrowser/resolve/main/test_agent_local.py
- Command line
-
hf download hf://spaces/SAFE44/humanbrowser/test_agent_local.py
-
curl -L -o test_agent_local.py https://huggingface.co/spaces/SAFE44/humanbrowser/resolve/main/test_agent_local.py
932 Bytes
| # test_agent_local.py — last updated: Dec 2025 | |
| import os, traceback | |
| from dotenv import load_dotenv | |
| from langchain_groq import ChatGroq | |
| from browser_use import Agent, Browser, BrowserConfig | |
| load_dotenv() | |
| key = os.getenv("GROQ_API_KEY") | |
| assert key, "GROQ_API_KEY required for test" | |
| llm = ChatGroq(model="llama-3.3-70b-specdec", groq_api_key=key) | |
| def main(): | |
| browser = Browser(config=BrowserConfig( | |
| headless=True, | |
| extra_chromium_args=["--no-sandbox", "--disable-setuid-sandbox"] | |
| )) | |
| try: | |
| agent = Agent(task="كم الساعة الآن في لندن؟", llm=llm, browser=browser) | |
| result = agent.run() # adapt if async | |
| if hasattr(result, "final_result"): | |
| print("Final:", result.final_result()) | |
| else: | |
| print("Result:", result) | |
| except Exception as e: | |
| print("Error:", e) | |
| traceback.print_exc() | |
| if __name__ == "__main__": | |
| main() | |