Aaradhya-Badal's picture
Replace BasicAgent stub with a GAIA LlamaIndex Workflow agent
eb8c02f
Raw
History Blame Contribute Delete
1.56 kB
# 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()