#!/usr/bin/env python3
"""Test script to verify the agent works correctly."""
import asyncio
import sys
import os
# Add parent directory to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from adk_agent.agent import SalesAnalyticsAgent, MCP_TOOLS
async def test_agent():
"""Run test queries through the agent."""
print("=" * 70)
print("Testing Sales Analytics Agent")
print("=" * 70)
print()
agent = SalesAnalyticsAgent(MCP_TOOLS)
test_queries = [
"What tables are available in Cloud SQL?",
"What tables are available in BigQuery?",
"Show me the schema for the orders table in Cloud SQL",
"What is the total sales amount from Cloud SQL orders?",
"How many customers are in the Cloud SQL database?",
]
for i, query in enumerate(test_queries, 1):
print(f"\n{'=' * 70}")
print(f"Test {i}/{len(test_queries)}: {query}")
print('=' * 70)
try:
response = await agent.process_message(query)
print(f"\n🤖 Response:\n{response}")
except Exception as e:
print(f"\n❌ Error: {e}")
# Reset conversation between tests
agent.reset_conversation()
await asyncio.sleep(1) # Rate limiting
print(f"\n{'=' * 70}")
print("Testing complete!")
print('=' * 70)
if __name__ == "__main__":
try:
asyncio.run(test_agent())
except KeyboardInterrupt:
print("\n\nTest interrupted")
sys.exit(0)