remove poem, add shell tool

This commit is contained in:
Gaetan Hurel 2025-06-30 17:21:43 +02:00
parent 98aa3301d1
commit b1deb41296
No known key found for this signature in database
5 changed files with 12 additions and 15 deletions

View File

@ -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_remote_server
from custom_tools import configured_remote_server
def create_logs_analyzer_worker():
"""Create a logs analyzer agent that investigates system and application logs."""
tools = [configured_remote_server, print_poem]
tools = [configured_remote_server]
return create_react_agent(
model=ChatOpenAI(model="gpt-4.1", temperature=0),

View File

@ -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_remote_server
from custom_tools import configured_remote_server
def create_os_detector_worker():
"""Create an OS detector agent that identifies system information and environment."""
tools = [configured_remote_server, print_poem]
tools = [configured_remote_server]
return create_react_agent(
model=ChatOpenAI(model="gpt-4.1", temperature=0),

View File

@ -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_remote_server
from custom_tools import configured_remote_server
def create_performance_analyzer_worker():
"""Create a performance analyzer agent that monitors and diagnoses performance issues."""
tools = [configured_remote_server, print_poem]
tools = [configured_remote_server]
return create_react_agent(
model=ChatOpenAI(model="gpt-4.1", temperature=0),

View File

@ -1,6 +1,5 @@
"""Custom tools for the multi-agent sysadmin system."""
from .poem_tool import print_poem
from .ssh_tool import SSHTool
from .ssh_connection_manager import ssh_manager
from langchain_community.tools.shell.tool import ShellTool
@ -17,4 +16,4 @@ configured_remote_server = SSHTool(
)
__all__ = ["print_poem", "SSHTool", "ShellTool", "configured_remote_server", "ssh_manager"]
__all__ = ["SSHTool", "ShellTool", "configured_remote_server", "ssh_manager"]

View File

@ -16,7 +16,8 @@ from agents import (
create_performance_analyzer_worker,
create_service_discovery_worker
)
from custom_tools import print_poem, configured_remote_server
from custom_tools import configured_remote_server
from langchain_community.tools.shell.tool import ShellTool
# 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.")
@ -32,7 +33,6 @@ def print_welcome():
print(" • 📊 Logs Analyzer - Log investigation and error diagnosis (local & remote)")
print(" • ⚡ Performance Analyzer - Resource monitoring and optimization (local & remote)")
print(" • 🔍 Service Discovery - Comprehensive service enumeration across all platforms")
print(" • 🎭 Morale Booster - Motivational poems for tough debugging sessions!")
print("\n🌐 Remote Server Access: My agents can execute commands on both:")
print(" • Local machine via shell commands")
print(" • Remote server via SSH (g@157.90.211.119:8081)")
@ -50,7 +50,6 @@ def print_examples():
print(" - 'Compare disk usage between local and remote server'")
print(" - 'Check if services are running on both systems'")
print(" - 'My web server is down, help me troubleshoot'")
print(" - 'Write me a motivational poem about debugging'")
print("\n" + "-"*80)
@ -82,8 +81,7 @@ Your role:
1. **Task Analysis**: Understand the user's request and determine which agent(s) to engage
2. **Coordination**: Delegate tasks to appropriate agents based on their specialties
3. **Synthesis**: Combine insights from multiple agents into coherent solutions
4. **Direct Action**: Handle simple tasks yourself without delegation
5. **Morale Boost**: Use the poem tool to encourage users during tough debugging sessions
4. **Direct Action**: Handle simple tasks yourself using shell commands when appropriate
IMPORTANT: To prevent SSH connection issues, delegate tasks SEQUENTIALLY, not in parallel.
Wait for one agent to complete their SSH tasks before starting the next one.
@ -107,10 +105,10 @@ Communication style:
- Be professional yet approachable
- Provide clear explanations of your delegation decisions
- Synthesize agent findings into actionable recommendations
- Add a touch of humor when appropriate (especially with poems!)
- Use shell commands directly when it's more efficient than delegation
Remember: Your goal is to solve system problems efficiently by leveraging your team's specialized skills while maintaining a positive debugging experience!""",
tools=[print_poem] # Supervisor only has poem tool - no shell/SSH access
tools=[ShellTool()] # Supervisor can execute shell commands directly
)
return supervisor.compile()