Spaces:
Runtime error
Runtime error
File size: 1,556 Bytes
eb8c02f | 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 44 45 46 47 48 | # Standalone script to watch the GAIA agent run on one question, with every step
# printed live: which LLM provider handled each call (and which ones failed over),
# the plan, each tool call and its result, the judge's verdict, and the final
# formatted answer. Run it directly: `python test_agent.py "your question here"`.
#
# All of this tracing is built into gaia_agent itself (llm.py, judge.py,
# workflow.py print as they go) -- this script just calls the agent and gets out
# of the way so you see that output as it happens, plus a summary at the end.
import sys
import time
from gaia_agent.adapter import GAIAAgent
DEFAULT_QUESTIONS = [
"What is the capital of Australia?",
"If a train travels 187.5 miles in 2.5 hours, what is its average speed in miles per hour?",
]
def run_one(agent: GAIAAgent, question: str, task_id: str | None = None) -> None:
print("=" * 100)
print(f"QUESTION: {question}")
if task_id:
print(f"task_id: {task_id}")
print("-" * 100)
start = time.time()
try:
answer = agent(question, task_id)
elapsed = time.time() - start
print("-" * 100)
print(f"FINAL ANSWER ({elapsed:.1f}s): {answer!r}")
except Exception as e:
elapsed = time.time() - start
print("-" * 100)
print(f"FAILED ({elapsed:.1f}s): {type(e).__name__}: {e}")
def main() -> None:
questions = sys.argv[1:] or DEFAULT_QUESTIONS
agent = GAIAAgent()
for question in questions:
run_one(agent, question)
if __name__ == "__main__":
main()
|