the-organism / agents /agent_database.py
digitview's picture
init: clean release of the organism architecture core
f1ba810
Raw History Blame Contribute Delete
914 Bytes
# -*- coding: utf-8 -*-
import os
import json
from organism_logger import log_telemetry_packet
def query_agent_database(query_key):
"""
Retrieves stored state records and system metrics from the organism database [LK].
"""
db_path = "C:/Users/leonk/Documents/AI_Projects/ai_workspace/agents/logs/organism_state.json"
print("=" * 70)
print("[LK] QUERYING AGENT DATABASE FOR KEY:", query_key)
print("=" * 70)
try:
if os.path.exists(db_path):
with open(db_path, "r", encoding="utf-8") as f:
data = json.load(f)
result = data.get(query_key, "Record not found")
log_telemetry_packet("Agent-Database", f"Query executed for: {query_key}")
return result
return "Database not initialized"
except Exception as e:
print("[LK] DATABASE QUERY ERROR:", str(e))
return None