31 lines
951 B
Python
31 lines
951 B
Python
"""System monitoring agents."""
|
||
|
||
from langgraph.prebuilt import create_react_agent
|
||
from custom_tools import get_shell_tool
|
||
|
||
|
||
def create_system_info_worker():
|
||
"""Create system information gathering agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool()],
|
||
prompt="""
|
||
You are a Linux sysadmin. Use shell commands like `lscpu`, `free -h`, and `df -h` to gather CPU, RAM, and disk usage.
|
||
Return a concise plain‑text summary. Only run safe, read‑only commands.
|
||
""",
|
||
name="system_info_worker"
|
||
)
|
||
|
||
|
||
def create_service_inventory_worker():
|
||
"""Create service inventory agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool()],
|
||
prompt="""
|
||
List all running services using `systemctl list-units --type=service --state=running`.
|
||
Return a JSON array of service names.
|
||
""",
|
||
name="service_inventory_worker"
|
||
)
|