Created
January 9, 2025 12:55
-
-
Save ttlg/2f813225c487ef16af6101ccdad45b79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat << EOF > run_agent.py | |
import argparse | |
import asyncio | |
from browser_use import Agent | |
from langchain_openai import ChatOpenAI | |
def parse_args(): | |
parser = argparse.ArgumentParser(description="Run AI agent with a custom task.") | |
parser.add_argument("--task", type=str, required=True, help="Task for the AI agent.") | |
return parser.parse_args() | |
async def main(): | |
args = parse_args() | |
agent = Agent( | |
task=args.task, | |
llm=ChatOpenAI(model="gpt-4o"), | |
) | |
result = await agent.run() | |
print(result) | |
if __name__ == "__main__": | |
asyncio.run(main()) | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment