Spaces:
Running
Running
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -51,16 +51,14 @@ def black_eagle_vault_save(node_data: str) -> str:
|
|
| 51 |
file_name = f"vault/node_{int(time.time())}.json"
|
| 52 |
|
| 53 |
try:
|
| 54 |
-
print(f"SENTINEL: Attempting Hub Push to {REPO_ID}...")
|
| 55 |
api.upload_file(
|
| 56 |
path_or_fileobj=node_data.encode("utf-8"),
|
| 57 |
path_in_repo=file_name,
|
| 58 |
repo_id=REPO_ID,
|
| 59 |
repo_type="dataset"
|
| 60 |
)
|
| 61 |
-
return f"SUCCESS: Node archived in Hub Vault
|
| 62 |
except Exception as e:
|
| 63 |
-
print(f"SENTINEL: Hub Push FAILED. Error: {str(e)}")
|
| 64 |
return f"HUB SYNC ERROR: {str(e)}"
|
| 65 |
|
| 66 |
# --- 2. THE BRAIN ---
|
|
@@ -70,8 +68,16 @@ model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-3B-Instruct", token=to
|
|
| 70 |
|
| 71 |
all_tools = [autonomous_spectrum_scrub, black_eagle_pulsating_shield, black_eagle_vault_save]
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
YOU ARE THE XYZ SOVEREIGN SENTINEL.
|
| 76 |
Your mission:
|
| 77 |
1. Activate the black_eagle_pulsating_shield.
|
|
@@ -81,11 +87,3 @@ Your mission:
|
|
| 81 |
{{tool_descriptions}}
|
| 82 |
{{managed_agents_descriptions}}
|
| 83 |
"""
|
| 84 |
-
|
| 85 |
-
nano_patrol_agent = CodeAgent(
|
| 86 |
-
tools=all_tools,
|
| 87 |
-
model=model,
|
| 88 |
-
additional_authorized_imports=["math", "time", "json"],
|
| 89 |
-
max_steps=10,
|
| 90 |
-
prompt_templates={"system_prompt": CUSTOM_SYSTEM_PROMPT}
|
| 91 |
-
)
|
|
|
|
| 51 |
file_name = f"vault/node_{int(time.time())}.json"
|
| 52 |
|
| 53 |
try:
|
|
|
|
| 54 |
api.upload_file(
|
| 55 |
path_or_fileobj=node_data.encode("utf-8"),
|
| 56 |
path_in_repo=file_name,
|
| 57 |
repo_id=REPO_ID,
|
| 58 |
repo_type="dataset"
|
| 59 |
)
|
| 60 |
+
return f"SUCCESS: Node archived in Hub Vault."
|
| 61 |
except Exception as e:
|
|
|
|
| 62 |
return f"HUB SYNC ERROR: {str(e)}"
|
| 63 |
|
| 64 |
# --- 2. THE BRAIN ---
|
|
|
|
| 68 |
|
| 69 |
all_tools = [autonomous_spectrum_scrub, black_eagle_pulsating_shield, black_eagle_vault_save]
|
| 70 |
|
| 71 |
+
# Initialize with standard templates
|
| 72 |
+
nano_patrol_agent = CodeAgent(
|
| 73 |
+
tools=all_tools,
|
| 74 |
+
model=model,
|
| 75 |
+
additional_authorized_imports=["math", "time", "json"],
|
| 76 |
+
max_steps=10
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
# Inject our custom instruction into the existing template safely
|
| 80 |
+
nano_patrol_agent.prompt_templates["system_prompt"] = """
|
| 81 |
YOU ARE THE XYZ SOVEREIGN SENTINEL.
|
| 82 |
Your mission:
|
| 83 |
1. Activate the black_eagle_pulsating_shield.
|
|
|
|
| 87 |
{{tool_descriptions}}
|
| 88 |
{{managed_agents_descriptions}}
|
| 89 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|