Loopypeterzakin/loopy

example · workflows/triage/

Triage

An incident arrives from a sensor. One agent triages it, finds the root cause, and normalizes it into a WorkItem for the resolve loop.

The steps

1 step in workflows/triage/

investigate.md
---
on: Incident
agent: Investigator
emits: WorkItem
---
Triage incident {{ event.issue_id }} — "{{ event.title }}" ({{ event.link }}).
Find the root cause and normalize it into a WorkItem for the resolve loop.

The trigger

A Sentry webhook becomes an Incident event. The sensor lives in sensors/sensors.py:

sensors/sensors.py
from loopy import sensor
from loopy.events import Incident, MetricThreshold


@sensor(webhook="/hooks/sentry", emits="Incident")
def sentry_issues(req) -> Incident:
    issue = req.json["data"]["issue"]
    return Incident(
        source="sentry",
        issue_id=issue["id"],
        title=issue["title"],
        link=issue["permalink"],
    )

From the registry

The agents and events this workflow refers to by name, from registry.yml.

registry.yml
defaults:
  agent:
    sandbox: default
    harness: { runtime: claude-code, model: claude-sonnet-4-6 }

sandboxes:
  default:
    provider: daytona
    image: { debian_slim: "3.12", apt: [git], workdir: /home/daytona, user: daytona }
    network: [github.com]

agents:
  Investigator: { skills: [code-review] }

events:
  Incident:
    fields:
      source: enum[sentry, linear, datadog, pagerduty, slack]
      issue_id: id
      title: str
      link: url

  WorkItem:
    fields:
      source: enum[sentry, linear, datadog, pagerduty, slack, cve]
      link: url
      root_cause: str
      proposed_goal: str
      repro: str
open on github → back to overview