Initial commit: Antigravity Agent Core
This commit is contained in:
39
main.py
Normal file
39
main.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import os
|
||||
import time
|
||||
import psycopg2
|
||||
import requests
|
||||
|
||||
# Налаштування (беруться з Environment Variables)
|
||||
DB_HOST = os.getenv("DB_HOST", "postgres")
|
||||
DB_USER = os.getenv("DB_USER", "postgres")
|
||||
DB_PASS = os.getenv("DB_PASS", "password")
|
||||
GRAPHITI_URL = os.getenv("GRAPHITI_URL", "http://graphiti:8000")
|
||||
|
||||
def check_connections():
|
||||
print("🕵️ Antigravity Agent: Starting Diagnostics...")
|
||||
|
||||
# 1. Перевірка Graphiti (Пам'ять)
|
||||
try:
|
||||
r = requests.get(f"{GRAPHITI_URL}/health", timeout=3)
|
||||
if r.status_code == 200:
|
||||
print(f"✅ Graphiti Memory is ONLINE at {GRAPHITI_URL}")
|
||||
else:
|
||||
print(f"⚠️ Graphiti returned status {r.status_code}")
|
||||
except Exception as e:
|
||||
print(f"❌ Graphiti Connection Failed: {e}")
|
||||
|
||||
# 2. Перевірка Postgres (База Знань)
|
||||
try:
|
||||
conn = psycopg2.connect(
|
||||
host=DB_HOST, user=DB_USER, password=DB_PASS, dbname="postgres"
|
||||
)
|
||||
print("✅ Postgres Database is CONNECTED")
|
||||
conn.close()
|
||||
except Exception as e:
|
||||
print(f"❌ Postgres Connection Failed: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
check_connections()
|
||||
print("💤 Sleeping for 60 seconds...")
|
||||
time.sleep(60)
|
||||
Reference in New Issue
Block a user