ops agent - kongusen/loom-agent GitHub Wiki
Use this pattern when the app watches system state and recommends or performs operational actions.
- signal-based observation
- strong action constraints
- explicit separation between monitoring and remediation
- session continuity for incident handling
from loom import Agent, Capability, Model, Runtime, RuntimeSignal, SessionConfig, tool
@tool(description="Restart a service")
async def restart_service(name: str) -> str:
return f"Restarted {name}"
agent = Agent(
model=Model.anthropic("claude-sonnet-4"),
instructions="Monitor operational state and propose safe remediations.",
tools=[restart_service],
capabilities=[
Capability.shell(require_approval=True),
],
runtime=Runtime.supervised(criteria=["critical services require approval"]),
)
incident = agent.session(SessionConfig(id="incident-2026-04-27"))
await incident.receive(
RuntimeSignal.create(
"Memory usage exceeded 90%",
source="heartbeat",
type="alert",
urgency="high",
payload={"service": "api"},
)
)
result = await incident.run("Assess system health and recommend the next action")Ops agents should be constrained by runtime policy, not only by prompt wording.
In practice:
- heartbeat/gateway/cron events become
RuntimeSignal - capability declarations define what the agent can reach
- governance and supervised runtime profiles define the hard stops
- approvals should enter through
RunContextor external application state
- keep critical actions vetoable
- use sessions per incident or per environment
- start in recommendation mode before enabling remediation
- keep shell access approval-gated