import asyncio
import os
from google.antigravity import Agent, LocalAgentConfig
from dotenv import load_dotenv

# Load API keys from your .env file
load_dotenv()

async def test_agent():
    print("1. Connecting to Antigravity SDK...")
    # Setup a simple config
    config = LocalAgentConfig()
    
    try:
        print("2. Sending message to Agent...")
        async with Agent(config) as agent:
            response = await agent.chat("Hello! Are you working?")
            
            print("\n✅ SUCCESS! Agent replied:")
            print("===========================")
            print(await response.text())
            print("===========================")
    except Exception as e:
        print("\n❌ FAILED! Here is the error:")
        print(str(e))

if __name__ == "__main__":
    asyncio.run(test_agent())
