HF_Agents_Final_Project / test_question.py
Yago Bolivar
feat: add GAIA Agent and local testing scripts, including setup and requirements for development
2abc50d
raw
history blame
1.36 kB
#!/usr/bin/env python
# /Users/yagoairm2/Desktop/agents/final project/HF_Agents_Final_Project/test_question.py
"""
Script to test GAIA agent with a single question
Usage:
python test_question.py "Your question here"
"""
import sys
import json
import logging
from app2 import GAIAAgent # Import the agent from app2.py
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
handlers=[logging.StreamHandler()]
)
logger = logging.getLogger(__name__)
def main():
"""Run the agent on a single question from command line"""
if len(sys.argv) < 2:
print("Usage: python test_question.py \"Your question here\"")
return
# Get question from command line
question = sys.argv[1]
print(f"\n=== Testing GAIA Agent with question ===\n{question}\n")
# Initialize agent
try:
agent = GAIAAgent()
print("\n=== Agent initialized successfully ===\n")
except Exception as e:
print(f"\n!!! Error initializing agent: {e}")
return
# Run agent on question
try:
print("\n=== Running agent... ===\n")
answer = agent(question)
print(f"\n=== Agent response ===\n{answer}\n")
except Exception as e:
print(f"\n!!! Error running agent: {e}")
if __name__ == "__main__":
main()