Recipes

Triage GitHub issues

Triage GitHub issues by starting a run on github.issues.opened, asking Triager for a structured classification, and applying the returned labels to the issue.

What you'll build

  • An event trigger for new issues in acme/api.
  • An agent step that writes label, severity, and summary.
  • An action step that calls github.issue.add_labels.

Prerequisites

  • A connected GitHub integration for acme/api.
  • An agent named Triager (agt_triager).
  • Permission to edit loops and run GitHub issue actions.

Build it

  1. In the app, open Build > Loops.
  2. Create a loop named Triage issues.
  3. Add an Event trigger for github.issues.opened.
  4. Scope the trigger to acme/api if the trigger editor offers a repository filter.
  5. Add an agent step named Classify issue.
  6. Select Triager and ask for JSON with label, severity, and summary.
  7. Add an action step named Apply label.
  8. Select github.issue.add_labels.
  9. Publish or create the loop as active.

Your loop now starts when GitHub sends a new issue event.

Finished spec

schema_version: "1"
name: triage-issues
description: Classify new GitHub issues and label them.
concurrency: allow
triggers:
  - key: github-issue-opened
    name: GitHub issue opened
    kind: event
    enabled: true
    config:
      event_type: github.issues.opened
      source_id: github
      condition: event.repository.full_name == "acme/api"
steps:
  - key: classify
    name: Classify issue
    kind: agent
    config:
      agent_id: agt_triager
      instructions: |
        Classify the GitHub issue. Return JSON with label, severity, and
        summary. Use one label from bug, feature, question, docs, or support.
      output_schema:
        type: object
        required: [label, severity, summary]
        properties:
          label:
            type: string
          severity:
            type: string
          summary:
            type: string
    save_as: triage
  - key: label
    name: Apply label
    kind: action
    config:
      action_name: github.issue.add_labels
      parameters:
        repo_full_name: "{{ .inputs.event.repository.full_name }}"
        issue_number: "{{ .inputs.event.issue.number }}"
        labels:
          - "{{ .context.triage.label }}"

Run it

Open a test issue in acme/api. The run timeline should have this shape:

run.started
step.started     step=classify kind=agent
step.completed   step=classify
step.started     step=label kind=action
action.called    action_name=github.issue.add_labels
action.completed action_name=github.issue.add_labels
step.completed   step=label
run.completed

The final output should include the saved classification and the GitHub action result:

{
  "triage": {
    "label": "bug",
    "severity": "medium",
    "summary": "The issue reports a failing API request after deployment."
  },
  "label": {
    "labels": ["bug"]
  }
}

If the run fails before action.completed, open the GitHub integration's recent events panel first. If the event arrived but the action failed, open the run Timeline and inspect the action.failed payload.

Variations

  • Add github.issue.create_comment after labeling to post Triager's summary.
  • Use queue if labels must be applied in issue-open order.
  • Add an interaction step before labeling if a human should approve high-severity issues.

Next