forked from PathOnAI/LiteWebAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_main.py
41 lines (35 loc) · 2.16 KB
/
search_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from dotenv import load_dotenv
import argparse
_ = load_dotenv()
from litewebagent.core.agent_factory import setup_search_agent
def main(args):
features = args.features.split(',') if args.features else None
branching_factor = args.branching_factor if args.branching_factor else None
agent = setup_search_agent(args.starting_url, args.goal, model_name=args.model, agent_type=args.agent_type,
features=features, branching_factor=branching_factor, log_folder=args.log_folder,
storage_state=args.storage_state)
trajectories = agent.send_prompt(args.plan, args.search_algorithm)
print(trajectories)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run web automation tasks with different agent types.")
parser.add_argument('--agent_type', type=str, default="PromptSearchAgent",
choices=["PromptSearchAgent"],
help="Type of agent to use (default: PromptSearchAgent)")
parser.add_argument('--search_algorithm', type=str, default="bfs",
choices=["bfs", "dfs"])
parser.add_argument('--model', type=str, default="gpt-4o-mini",
help="Model to use for the agent (default: gpt-4o-mini)")
parser.add_argument('--starting_url', type=str, required=True,
help="Starting URL for the web automation task")
parser.add_argument('--plan', type=str, required=True,
help="Plan for the web automation task")
parser.add_argument('--storage_state', type=str, default="state.json",
help="Storage state json file")
parser.add_argument('--goal', type=str, required=True,
help="Goal for the web automation task")
parser.add_argument('--features', type=str, default="axtree",
help="Comma-separated list of features to use (default: None, which uses all features)")
parser.add_argument('--branching_factor', type=int, default=None)
parser.add_argument('--log_folder', type=str, default='log', help='Path to the log folder')
args = parser.parse_args()
main(args)