ops agent - kongusen/loom-agent GitHub Wiki

Ops Agent

Use this pattern when the app watches system state and recommends or performs operational actions.

What The App Usually Needs

  • signal-based observation
  • strong action constraints
  • explicit separation between monitoring and remediation
  • session continuity for incident handling

Shape

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")

Design Rule

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 RunContext or external application state

Good Defaults

  • keep critical actions vetoable
  • use sessions per incident or per environment
  • start in recommendation mode before enabling remediation
  • keep shell access approval-gated

Related Patterns

Runnable Example

⚠️ **GitHub.com Fallback** ⚠️