43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
"""Analysis and remediation agents."""
|
||
|
||
from langgraph.prebuilt import create_react_agent
|
||
from custom_tools import get_shell_tool
|
||
|
||
|
||
def create_risk_worker():
|
||
"""Create risk assessment agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[], # pure‑LLM reasoning
|
||
prompt="""
|
||
Aggregate the findings from other agents and assign a severity: Critical, High, Medium, or Low.
|
||
Output a short report.
|
||
""",
|
||
name="risk_scorer"
|
||
)
|
||
|
||
|
||
def create_remediation_worker():
|
||
"""Create remediation agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool()],
|
||
prompt="""
|
||
Propose safe bash commands or configuration edits to fix detected issues.
|
||
NEVER run destructive commands automatically; always request confirmation.
|
||
""",
|
||
name="remediation_worker"
|
||
)
|
||
|
||
|
||
def create_harmonizer_worker():
|
||
"""Create system hardening agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool()],
|
||
prompt="""
|
||
Apply best‑practice hardening (`ulimit`, `sysctl`, journald rotation) in dry‑run mode unless severity is High.
|
||
""",
|
||
name="harmonizer_worker"
|
||
)
|