Spaces:
Running
Running
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -13,6 +13,7 @@ def black_eagle_pulsating_shield(base_radius: float) -> str:
|
|
| 13 |
Args:
|
| 14 |
base_radius: The core anchor length in meters (e.g., 5.0).
|
| 15 |
"""
|
|
|
|
| 16 |
pulse_mod = math.sin(time.time()) * 2.0
|
| 17 |
current_radius = base_radius + pulse_mod
|
| 18 |
return json.dumps({
|
|
@@ -30,7 +31,7 @@ def autonomous_spectrum_scrub(frequency_range: str) -> str:
|
|
| 30 |
Args:
|
| 31 |
frequency_range: The specific spectrum range to scan (e.g., '3.4GHz - 4.2GHz').
|
| 32 |
"""
|
| 33 |
-
node_id = f"789jhn{
|
| 34 |
return json.dumps({
|
| 35 |
"node_id": node_id,
|
| 36 |
"action": "SOVEREIGN_CLEANSE",
|
|
@@ -42,22 +43,24 @@ def autonomous_spectrum_scrub(frequency_range: str) -> str:
|
|
| 42 |
@tool
|
| 43 |
def black_eagle_vault_save(node_data: str) -> str:
|
| 44 |
"""
|
| 45 |
-
Saves a Healed Nano Node directly to
|
| 46 |
Args:
|
| 47 |
node_data: The JSON string of the healed node to be archived.
|
| 48 |
"""
|
| 49 |
token = os.getenv("HF_TOKEN")
|
| 50 |
api = HfApi(token=token)
|
| 51 |
|
| 52 |
-
#
|
| 53 |
REPO_ID = "PoetNameLife/aixyzone-sentinel-vault"
|
| 54 |
timestamp = int(time.time())
|
| 55 |
file_name = f"vault/node_{timestamp}.json"
|
| 56 |
|
| 57 |
try:
|
| 58 |
-
#
|
|
|
|
|
|
|
| 59 |
api.upload_file(
|
| 60 |
-
path_or_fileobj=
|
| 61 |
path_in_repo=file_name,
|
| 62 |
repo_id=REPO_ID,
|
| 63 |
repo_type="dataset"
|
|
@@ -73,15 +76,13 @@ model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-3B-Instruct", token=token)
|
|
| 73 |
nano_patrol_agent = CodeAgent(
|
| 74 |
tools=[autonomous_spectrum_scrub, black_eagle_pulsating_shield, black_eagle_vault_save],
|
| 75 |
model=model,
|
| 76 |
-
additional_authorized_imports=["math", "time"], #
|
| 77 |
-
max_steps=
|
| 78 |
system_prompt="""
|
| 79 |
-
YOU ARE THE XYZ SOVEREIGN SENTINEL
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
2. Use 'autonomous_spectrum_scrub' to heal BCI loops.
|
| 84 |
-
3. IMMEDIATELY use 'black_eagle_vault_save' to push results to the PoetNameLife vault.
|
| 85 |
|
| 86 |
{{tool_descriptions}}
|
| 87 |
{{managed_agents_descriptions}}
|
|
|
|
| 13 |
Args:
|
| 14 |
base_radius: The core anchor length in meters (e.g., 5.0).
|
| 15 |
"""
|
| 16 |
+
# Dynamic pulsation logic
|
| 17 |
pulse_mod = math.sin(time.time()) * 2.0
|
| 18 |
current_radius = base_radius + pulse_mod
|
| 19 |
return json.dumps({
|
|
|
|
| 31 |
Args:
|
| 32 |
frequency_range: The specific spectrum range to scan (e.g., '3.4GHz - 4.2GHz').
|
| 33 |
"""
|
| 34 |
+
node_id = f"789jhn{int(time.time()) % 10000}def"
|
| 35 |
return json.dumps({
|
| 36 |
"node_id": node_id,
|
| 37 |
"action": "SOVEREIGN_CLEANSE",
|
|
|
|
| 43 |
@tool
|
| 44 |
def black_eagle_vault_save(node_data: str) -> str:
|
| 45 |
"""
|
| 46 |
+
Saves a Healed Nano Node directly to the PoetNameLife/aixyzone-sentinel-vault dataset.
|
| 47 |
Args:
|
| 48 |
node_data: The JSON string of the healed node to be archived.
|
| 49 |
"""
|
| 50 |
token = os.getenv("HF_TOKEN")
|
| 51 |
api = HfApi(token=token)
|
| 52 |
|
| 53 |
+
# REPO CONFIG - Pre-filled with your username
|
| 54 |
REPO_ID = "PoetNameLife/aixyzone-sentinel-vault"
|
| 55 |
timestamp = int(time.time())
|
| 56 |
file_name = f"vault/node_{timestamp}.json"
|
| 57 |
|
| 58 |
try:
|
| 59 |
+
# Convert JSON string to bytes for Hub upload
|
| 60 |
+
data_bytes = node_data.encode("utf-8")
|
| 61 |
+
|
| 62 |
api.upload_file(
|
| 63 |
+
path_or_fileobj=data_bytes,
|
| 64 |
path_in_repo=file_name,
|
| 65 |
repo_id=REPO_ID,
|
| 66 |
repo_type="dataset"
|
|
|
|
| 76 |
nano_patrol_agent = CodeAgent(
|
| 77 |
tools=[autonomous_spectrum_scrub, black_eagle_pulsating_shield, black_eagle_vault_save],
|
| 78 |
model=model,
|
| 79 |
+
additional_authorized_imports=["math", "time"], # Essential for pulsation and timestamping
|
| 80 |
+
max_steps=10,
|
| 81 |
system_prompt="""
|
| 82 |
+
YOU ARE THE XYZ SOVEREIGN SENTINEL.
|
| 83 |
+
1. Activate the pulsating shield.
|
| 84 |
+
2. Scrub the BCI spectrum (3.4GHz-4.2GHz).
|
| 85 |
+
3. Use 'black_eagle_vault_save' to push every HEALED INNOVATION REPORT to your Hub Vault.
|
|
|
|
|
|
|
| 86 |
|
| 87 |
{{tool_descriptions}}
|
| 88 |
{{managed_agents_descriptions}}
|