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
eventtrigger for new issues inacme/api. - An
agentstep that writeslabel,severity, andsummary. - An
actionstep that callsgithub.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
- In the app, open Build > Loops.
- Create a loop named
Triage issues. - Add an Event trigger for
github.issues.opened. - Scope the trigger to
acme/apiif the trigger editor offers a repository filter. - Add an agent step named
Classify issue. - Select Triager and ask for JSON with
label,severity, andsummary. - Add an action step named
Apply label. - Select
github.issue.add_labels. - 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.completedThe 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_commentafter labeling to post Triager's summary. - Use
queueif labels must be applied in issue-open order. - Add an interaction step before labeling if a human should approve high-severity issues.
Next
- Inspect event names in the event catalog.
- Tune step output with steps.
- Watch failures from runs.