Spaces:
Running
Running
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -9,34 +9,35 @@ def autonomous_spectrum_scrub(frequency_range: str) -> str:
|
|
| 9 |
Args:
|
| 10 |
frequency_range: The specific spectrum range to scan (e.g., '3.4GHz - 4.2GHz').
|
| 11 |
"""
|
| 12 |
-
# This simulates the Sentinel 'spotting' and healing a rogue agent
|
| 13 |
node_id = f"SENTINEL-FIX-{hash(frequency_range) % 1000}"
|
| 14 |
|
| 15 |
return json.dumps({
|
| 16 |
"node_id": node_id,
|
| 17 |
"action": "AUTO-CLEANSE",
|
| 18 |
"target_range": frequency_range,
|
| 19 |
-
"result": "Neutralized looping BCI feedback.
|
| 20 |
-
"
|
| 21 |
}, indent=2)
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
model = HfApiModel(
|
| 27 |
model_id="meta-llama/Llama-3.2-3B-Instruct",
|
| 28 |
-
token=
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
nano_patrol_agent = CodeAgent(
|
| 32 |
tools=[autonomous_spectrum_scrub],
|
| 33 |
model=model,
|
| 34 |
system_prompt="""
|
| 35 |
-
You are the XYZ Nano Sentinel.
|
| 36 |
-
|
| 37 |
-
Micromanage the cleanup by generating 'Healed Nodes'.
|
| 38 |
|
|
|
|
| 39 |
{{managed_agents_descriptions}}
|
|
|
|
|
|
|
| 40 |
{{authorized_imports}}
|
| 41 |
"""
|
| 42 |
)
|
|
|
|
| 9 |
Args:
|
| 10 |
frequency_range: The specific spectrum range to scan (e.g., '3.4GHz - 4.2GHz').
|
| 11 |
"""
|
|
|
|
| 12 |
node_id = f"SENTINEL-FIX-{hash(frequency_range) % 1000}"
|
| 13 |
|
| 14 |
return json.dumps({
|
| 15 |
"node_id": node_id,
|
| 16 |
"action": "AUTO-CLEANSE",
|
| 17 |
"target_range": frequency_range,
|
| 18 |
+
"result": "Neutralized looping BCI feedback.",
|
| 19 |
+
"status": "HEALED"
|
| 20 |
}, indent=2)
|
| 21 |
|
| 22 |
+
# Set up the model with tokens and length limits to prevent 'printing errors'
|
| 23 |
+
token = os.getenv("HF_TOKEN")
|
|
|
|
| 24 |
model = HfApiModel(
|
| 25 |
model_id="meta-llama/Llama-3.2-3B-Instruct",
|
| 26 |
+
token=token,
|
| 27 |
+
max_new_tokens=512 # Keeps output short to avoid performance lag
|
| 28 |
)
|
| 29 |
|
| 30 |
nano_patrol_agent = CodeAgent(
|
| 31 |
tools=[autonomous_spectrum_scrub],
|
| 32 |
model=model,
|
| 33 |
system_prompt="""
|
| 34 |
+
You are the XYZ Nano Sentinel. Your output MUST be brief JSON only.
|
| 35 |
+
Focus: BCI/Neural spectrum. Micromanage the cleanup of looping amateur attacks.
|
|
|
|
| 36 |
|
| 37 |
+
Available tools:
|
| 38 |
{{managed_agents_descriptions}}
|
| 39 |
+
|
| 40 |
+
Security rules:
|
| 41 |
{{authorized_imports}}
|
| 42 |
"""
|
| 43 |
)
|