wip
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
from langchain_community.tools.shell.tool import ShellTool
|
||||
from custom_tools import print_poem, configured_ssh_tool
|
||||
from custom_tools import print_poem, configured_remote_server
|
||||
|
||||
|
||||
def create_logs_analyzer_worker():
|
||||
"""Create a logs analyzer agent that investigates system and application logs."""
|
||||
|
||||
tools = [ShellTool(), configured_ssh_tool, print_poem]
|
||||
|
||||
|
||||
tools = [configured_remote_server, print_poem]
|
||||
|
||||
return create_react_agent(
|
||||
model=ChatOpenAI(model="gpt-4o-mini", temperature=0),
|
||||
tools=tools,
|
||||
|
@@ -3,13 +3,13 @@
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
from langchain_community.tools.shell.tool import ShellTool
|
||||
from custom_tools import print_poem, configured_ssh_tool
|
||||
from custom_tools import print_poem, configured_remote_server
|
||||
|
||||
|
||||
def create_os_detector_worker():
|
||||
"""Create an OS detector agent that identifies system information and environment."""
|
||||
|
||||
tools = [ShellTool(), configured_ssh_tool, print_poem]
|
||||
tools = [configured_remote_server, print_poem]
|
||||
|
||||
return create_react_agent(
|
||||
model=ChatOpenAI(model="gpt-4o-mini", temperature=0),
|
||||
|
@@ -3,13 +3,13 @@
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
from langchain_community.tools.shell.tool import ShellTool
|
||||
from custom_tools import print_poem, configured_ssh_tool
|
||||
from custom_tools import print_poem, configured_remote_server
|
||||
|
||||
|
||||
def create_performance_analyzer_worker():
|
||||
"""Create a performance analyzer agent that monitors and diagnoses performance issues."""
|
||||
|
||||
tools = [ShellTool(), configured_ssh_tool, print_poem]
|
||||
tools = [configured_remote_server, print_poem]
|
||||
|
||||
return create_react_agent(
|
||||
model=ChatOpenAI(model="gpt-4o-mini", temperature=0),
|
||||
|
@@ -6,7 +6,7 @@ from langchain_community.tools.shell.tool import ShellTool
|
||||
|
||||
# Pre-configured SSH tool for your server - only connects when actually used
|
||||
# TODO: Update these connection details for your actual server
|
||||
configured_ssh_tool = SSHTool(
|
||||
configured_remote_server = SSHTool(
|
||||
host="157.90.211.119", # Replace with your server
|
||||
port=8081,
|
||||
username="g", # Replace with your username
|
||||
@@ -15,4 +15,4 @@ configured_ssh_tool = SSHTool(
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["print_poem", "SSHTool", "ShellTool", "configured_ssh_tool"]
|
||||
__all__ = ["print_poem", "SSHTool", "ShellTool", "configured_remote_server"]
|
||||
|
@@ -77,6 +77,8 @@ class SSHSession:
|
||||
|
||||
def execute(self, command: str) -> str:
|
||||
"""Execute a single command, handling sudo automatically."""
|
||||
print(f"🔧 Executing command: {command}")
|
||||
|
||||
if not self.client:
|
||||
self.connect()
|
||||
|
||||
|
@@ -6,6 +6,7 @@ A supervisor-based system that coordinates specialized agents for system adminis
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
import readline # Enable arrow key support and command history in input()
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langchain_core.messages import HumanMessage
|
||||
from langgraph_supervisor import create_supervisor
|
||||
@@ -14,7 +15,7 @@ from agents import (
|
||||
create_logs_analyzer_worker,
|
||||
create_performance_analyzer_worker
|
||||
)
|
||||
from custom_tools import print_poem
|
||||
from custom_tools import print_poem, configured_remote_server
|
||||
|
||||
# Suppress the shell tool warning since worker agents use it intentionally for sysadmin tasks
|
||||
warnings.filterwarnings("ignore", message="The shell tool has no safeguards by default. Use at your own risk.")
|
||||
@@ -93,7 +94,7 @@ Communication style:
|
||||
|
||||
Remember: Your goal is to solve system problems efficiently by leveraging your team's specialized skills while maintaining a positive debugging experience!
|
||||
|
||||
IMPORTANT: You do NOT have direct access to shell commands or SSH. You must delegate all system tasks to your specialized agents.""",
|
||||
IMPORTANT: You do NOT have direct access to shell commands or SSH. You must delegate all system tasks to your specialized agents. If you don't know which OS is running, use the OS Detector agent first.""",
|
||||
tools=[print_poem] # Supervisor only has poem tool - no shell/SSH access
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user