Initial commit: Antigravity Agent Core
This commit is contained in:
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM python:3.9-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Встановлюємо бібліотеки для Postgres
|
||||
RUN apt-get update && apt-get install -y libpq-dev gcc && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Залежності
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Код
|
||||
COPY . .
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
0
docker-compose.yml
Normal file
0
docker-compose.yml
Normal file
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)
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
psycopg2-binary
|
||||
requests
|
||||
Reference in New Issue
Block a user