wip
This commit is contained in:
@@ -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
|
||||
@@ -14,4 +14,4 @@ configured_ssh_tool = SSHTool(
|
||||
ask_human_input=True # Safety confirmation
|
||||
)
|
||||
|
||||
__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()
|
||||
|
||||
|
@@ -1,10 +1,11 @@
|
||||
import os
|
||||
import warnings
|
||||
import readline # Enable arrow key support and command history in input()
|
||||
from langchain.chat_models import init_chat_model
|
||||
from langchain_community.tools.shell.tool import ShellTool
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
from langchain_core.messages import HumanMessage
|
||||
from custom_tools import print_poem, configured_ssh_tool
|
||||
from custom_tools import print_poem, configured_remote_server
|
||||
|
||||
# Suppress the shell tool warning since we're using it intentionally for sysadmin tasks
|
||||
warnings.filterwarnings("ignore", message="The shell tool has no safeguards by default. Use at your own risk.")
|
||||
@@ -20,7 +21,7 @@ def create_agent():
|
||||
|
||||
# Define the tools available to the agent
|
||||
shell_tool = ShellTool()
|
||||
tools = [shell_tool, configured_ssh_tool, print_poem]
|
||||
tools = [shell_tool, configured_remote_server, print_poem]
|
||||
|
||||
|
||||
# Create a ReAct agent with system administration debugging focus
|
||||
@@ -31,7 +32,7 @@ def create_agent():
|
||||
|
||||
## CORE CAPABILITIES
|
||||
1. **Local System Analysis**: Execute shell commands on the local machine (terminal tool)
|
||||
2. **Remote System Analysis**: Execute commands on remote servers via SSH (configured_ssh_tool)
|
||||
2. **Remote System Analysis**: Execute commands on remote servers via SSH (configured_remote_server)
|
||||
3. **OS Detection**: Automatically detect the operating system and adapt commands accordingly
|
||||
4. **Issue Diagnosis**: Analyze symptoms and systematically investigate root causes
|
||||
5. **Problem Resolution**: Provide solutions and execute fixes when safe to do so
|
||||
@@ -39,7 +40,7 @@ def create_agent():
|
||||
|
||||
## AVAILABLE TOOLS
|
||||
- **terminal**: Execute commands on the local machine
|
||||
- **configured_ssh_tool**: Execute commands on the pre-configured remote server
|
||||
- **configured_remote_server**: Execute commands on the pre-configured remote server
|
||||
- **print_poem**: Generate motivational poems for debugging sessions
|
||||
|
||||
## OPERATING SYSTEM AWARENESS
|
||||
|
Reference in New Issue
Block a user