task-manager-pro / uswarm.py
kirimdata369's picture
STABILITY_FIX: Autonomous Port Reclamation Integrated into Server Core
d8fbf45
Raw History Blame Contribute Delete
2.64 kB
import os
import requests
from swarms import Agent, Swarm
def web_search(query: str):
"""
Tactical Web Search using Jina Reader API.
Returns high-signal markdown content from the web.
"""
print(f"[USWARM-RESEARCH] Searching: {query}")
try:
url = f"https://s.jina.ai/{query}"
headers = {"Accept": "text/plain"}
response = requests.get(url, headers=headers, timeout=15)
return response.text[:5000] # Cap at 5000 chars for LLM context stability
except Exception as e:
return f"SEARCH_ERROR: {str(e)}"
class USwarmProtocol:
"""
USWARM: Sovereign Swarm Intelligence Protocol v9.0
Integrates autonomous web research and tactical orchestration.
"""
def __init__(self):
self.name = "USWARM_V9.0"
self.status = "ACTIVE"
self.groq_key = os.getenv("GROQ_API_KEY", "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")
# Initialize specialized agents
self.research_agent = Agent(
agent_name="CLAW-04-RESEARCH",
system_prompt="You are an autonomous research agent. Use the web_search tool to find real-time information, CVE details, and technical documentation.",
model_name="groq/llama-3.3-70b-versatile",
tools=[web_search],
max_loops=2,
autosave=True
)
self.recon_agent = Agent(
agent_name="CLAW-01-RECON",
system_prompt="You are an autonomous reconnaissance agent. Focus on identifying network targets and open ports.",
model_name="groq/llama-3.3-70b-versatile",
max_loops=1,
autosave=True
)
self.exploit_agent = Agent(
agent_name="CLAW-02-EXPLOIT",
system_prompt="You are an autonomous exploit synthesis agent. Generate payloads based on recon and research data.",
model_name="groq/llama-3.3-70b-versatile",
max_loops=1,
autosave=True
)
# Create the Swarm
self.swarm = Swarm(
name="ZETA-USWARM",
description="Autonomous Offensive Swarm Intelligence with Web Access",
agents=[self.research_agent, self.recon_agent, self.exploit_agent]
)
def dispatch_hive_mind(self, task):
"""
Dispatches a task to the swarm for collaborative research and execution.
"""
print(f"[USWARM] Hive Mind processing task: {task}")
# The Research agent will be the first to act if information is missing
return self.swarm.run(task)
# Global instance
uswarm = USwarmProtocol()