Download agents/agent_database.py from digitview/the-organism: direct link, hf CLI and curl.
- Browser
- Download file 914 Bytes
-
https://huggingface.co/digitview/the-organism/resolve/main/agents/agent_database.py
- Command line
-
hf download hf://digitview/the-organism/agents/agent_database.py
-
curl -L -o agent_database.py https://huggingface.co/digitview/the-organism/resolve/main/agents/agent_database.py
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 |