File size: 1,103 Bytes
8c5ec67
 
 
 
 
 
daa6053
8c5ec67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c84357
8c5ec67
 
5cafe57
5c84357
5cafe57
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
42
43
# app.py

from agent import fetch_questions, run_agent_on_question, submit_answers
import json
import os

def get_answers():
    print("πŸ“₯ Fetching questions...")
    questions = fetch_questions()
    if not questions:
        print("No questions fetched. Exiting.")
        return

    answers = []
    for q in questions:
        print(f"πŸ” Running agent on: {q['question']}")
        try:
            result = run_agent_on_question(q)
            print(f"βœ… Answer: {result}\n")
            answers.append({
                "task_id": q["task_id"],
                "submitted_answer": result
            })
        except Exception as e:
            print(f"❌ Error on question {q['task_id']}: {e}")
            answers.append({
                "task_id": q["task_id"],
                "submitted_answer": "error"
            })

    os.makedirs("data", exist_ok=True)
    with open("data/answers_output.json", "w") as f:
        json.dump(answers, f, indent=2)

    print("πŸ“€ Submitting answers...")
    submit_answers(answers)
    return

if __name__ == "__main__":
    get_answers()