-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch.py
More file actions
29 lines (22 loc) Β· 936 Bytes
/
Copy pathbatch.py
File metadata and controls
29 lines (22 loc) Β· 936 Bytes
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
from agent import run_agent
from history import save_to_history
def run_batch(queries: list, spreadsheet_url: str):
"""Run multiple queries and push all to the same sheet"""
print(f"\n π¦ Batch mode β {len(queries)} searches queued")
print(" " + "β"*55)
results_summary = []
for i, query in enumerate(queries, 1):
query = query.strip()
if not query:
continue
print(f"\n [{i}/{len(queries)}] Starting: '{query}'")
url = run_agent(query, spreadsheet_url)
if url:
results_summary.append((query, url))
print(f" β
'{query}' β done!")
else:
print(f" β '{query}' β failed, skipping")
print(f"\n{'='*55}")
print(f" π Batch Complete! {len(results_summary)}/{len(queries)} searches succeeded")
print(f" π Sheet: {spreadsheet_url}")
print(f"{'='*55}\n")