import requests from agent import BasicAgent API_URL = "https://agents-course-unit4-scoring.hf.space" USERNAME = "egor-fedosov" AGENT_CODE = "https://huggingface.co/spaces/egor-fedosov/finalagent/tree/main" agent = BasicAgent() questions = requests.get(f"{API_URL}/questions", timeout=30).json() answers = [] for item in questions: task_id = item["task_id"] question = item["question"] try: answer = agent(question) except Exception as e: answer = f"ERROR: {e}" print(task_id, answer) answers.append({ "task_id": task_id, "submitted_answer": answer }) payload = { "username": USERNAME, "agent_code": AGENT_CODE, "answers": answers } response = requests.post( f"{API_URL}/submit", json=payload, timeout=120 ) print(response.status_code) print(response.text)