Blog
4 min readmcpgithubtutorial

How to Build an AI Agent That Files GitHub Issues

Build an AI agent that answers from your docs and files clean GitHub issues for real bugs — with human write-confirm before anything is created.

An AI agent that files GitHub issues answers questions from your docs first, and only when a real bug remains, drafts a clean, reproducible issue — created after a human approves. It turns scattered support reports into an actionable backlog without filling your tracker with noise.

The goal: triage, not just filing

The wrong version of this agent files an issue for every complaint, drowning your tracker in duplicates and support questions. The right version triages. It tries to resolve the problem from your documentation and existing issues first, deflecting anything that's really a question. Only when something is a genuine, new bug does it collect the details and draft an issue. That distinction — answer first, file second — is what makes the agent helpful rather than a firehose. See how to connect GitHub.

Step 1: Ground it in your docs and repo

Index your documentation and GitHub repository so the agent answers from real content and can check existing issues. This grounding is what lets it deflect non-bugs and recognize duplicates. An agent without your content can't tell a known issue from a new one, so it files everything — exactly what you don't want. Grounding is the foundation; see what is RAG.

Step 2: Connect GitHub with scoped access

Install the GitHub MCP connector and authorize it, scoping access to the specific repositories the agent should touch. Attach the read tools (search code, search issues) and the create-issue tool. The reads let it check for duplicates and ground answers; the create tool lets it file — but only behind approval.

Step 3: Write a triage prompt

The agent's behavior comes from its prompt. Instruct it to answer from your content first, to search existing issues before filing, and — only for genuine bugs — to gather version, environment, reproduction steps, and expected versus actual behavior, then draft a concise issue. Tell it never to fabricate reproduction details. The issue triage template gives you a ready starting point.

Step 4: Keep the write gated

Creating an issue is a mutating action, so it runs behind write-confirm. The agent drafts the issue and surfaces it for a maintainer to approve. This is what keeps the tracker clean: a human glances at the drafted issue, approves the good ones, and declines the noise. The agent does the tedious drafting; the human keeps the quality bar.

Step 5: Test the full loop

Describe a bug to the agent and watch it work: it checks your docs, confirms it's not a known issue, gathers the details, drafts the issue, and pauses for your approval. Approve, and the issue appears in GitHub. Try a question that your docs answer, and confirm it resolves it without filing anything. That two-path behavior — file real bugs, deflect questions — is the whole point.

Getting started

Build this on the AIML.chat free plan: ground the agent, connect GitHub, and apply the triage prompt. Compare tiers on the pricing page, and read AI agents for open source: auto-triage issues for an OSS angle.

Will it file an issue for every message?+

No — a triage agent answers questions from your docs first and only files an issue when something is a genuine, new bug.

Who approves the issues?+

A maintainer — issue creation is a mutating action behind write-confirm, so the agent drafts and a human approves before it's filed.

How does it avoid duplicates?+

It searches existing issues before filing, which it can do because it's grounded in your repo and documentation.

Get the AIML.chat newsletter

Practical tips on AI docs assistants, RAG, and growing with content — a couple of emails a month. No spam, unsubscribe anytime.

Double opt-in — we'll email you to confirm.

Add AI chat to your site

Free plan · No credit card · 5 minutes

Get started free