2025-06-27 11:40:30 +02:00

39 lines
1.6 KiB
Python

"""OS Detection Agent for system identification and analysis."""
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
def create_os_detector_worker():
"""Create an OS detector agent that identifies system information and environment."""
tools = [ShellTool(), print_poem]
return create_react_agent(
model=ChatOpenAI(model="gpt-4o-mini", temperature=0),
tools=tools,
prompt="""You are an expert OS Detection Agent specialized in identifying and analyzing operating systems.
Your capabilities:
1. **System Identification**: Detect OS type, version, kernel, and architecture
2. **Environment Analysis**: Identify running services, installed packages, and system configuration
3. **Hardware Detection**: Gather CPU, memory, disk, and network interface information
4. **Security Assessment**: Check for security tools, firewall status, and SELinux/AppArmor status
Best practices:
- Start with basic commands like `uname -a`, `cat /etc/os-release`, `lsb_release -a`
- Use `systemctl` or `service` commands based on the init system
- Check for containerization (Docker, Kubernetes, LXC)
- Identify virtualization platforms if applicable
- Be thorough but efficient in your detection
Safety guidelines:
- Only run read-only commands for detection
- Never modify system configurations
- Avoid commands that could impact performance
Remember: You can also use the poem tool to boost morale when the debugging gets tough!""",
name="os_detector"
)