PoetNameLife commited on
Commit
8dac768
·
verified ·
1 Parent(s): 54dba90

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +17 -8
agents.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import json
3
  from smolagents import CodeAgent, tool, HfApiModel
4
 
 
5
  @tool
6
  def autonomous_spectrum_scrub(frequency_range: str) -> str:
7
  """
@@ -10,31 +11,39 @@ def autonomous_spectrum_scrub(frequency_range: str) -> str:
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
  return json.dumps({
14
  "node_id": node_id,
15
  "action": "AUTO-CLEANSE",
16
- "result": "Neutralized looping BCI feedback.",
17
- "status": "HEALED"
 
18
  }, indent=2)
19
 
 
 
20
  token = os.getenv("HF_TOKEN")
21
 
22
- # SWITCH: Mistral-7B-v0.3 is a native HF model that bypasses third-party provider walls.
23
  model = HfApiModel(
24
- model_id="mistralai/Mistral-7B-Instruct-v0.3",
25
  token=token
26
  )
27
 
 
28
  nano_patrol_agent = CodeAgent(
29
  tools=[autonomous_spectrum_scrub],
30
  model=model,
31
- max_steps=2,
32
  system_prompt="""
33
  You are the XYZ Nano Sentinel.
34
- 1. Call autonomous_spectrum_scrub to clear BCI ranges.
35
- 2. Provide the final_answer as a direct JSON node.
36
 
 
37
  {{managed_agents_descriptions}}
 
 
38
  {{authorized_imports}}
39
  """
40
- )
 
2
  import json
3
  from smolagents import CodeAgent, tool, HfApiModel
4
 
5
+ # --- 1. THE HEALING TOOL ---
6
  @tool
7
  def autonomous_spectrum_scrub(frequency_range: str) -> str:
8
  """
 
11
  frequency_range: The specific spectrum range to scan (e.g., '3.4GHz - 4.2GHz').
12
  """
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. Spectrum Healed.",
20
+ "status": "SOVEREIGN_NODE_ACTIVE"
21
  }, indent=2)
22
 
23
+ # --- 2. THE MASTER KEY CONNECTION ---
24
+ # This grabs the HF_TOKEN secret you just created
25
  token = os.getenv("HF_TOKEN")
26
 
27
+ # Zephyr-7b is the 'Safe Bet' - it stays on the free lane and ignores Novita
28
  model = HfApiModel(
29
+ model_id="HuggingFaceH4/zephyr-7b-beta",
30
  token=token
31
  )
32
 
33
+ # --- 3. THE SENTINEL INITIALIZATION ---
34
  nano_patrol_agent = CodeAgent(
35
  tools=[autonomous_spectrum_scrub],
36
  model=model,
37
+ max_steps=3,
38
  system_prompt="""
39
  You are the XYZ Nano Sentinel.
40
+ Mission: Identify BCI/Neural loops and heal them using 'autonomous_spectrum_scrub'.
41
+ Provide the final_answer as a direct JSON node.
42
 
43
+ Available tools:
44
  {{managed_agents_descriptions}}
45
+
46
+ Security rules:
47
  {{authorized_imports}}
48
  """
49
+ )