Skip to content

Repository files navigation

IssueAgent (formerly "Issue Triager Agent")

Open in GitHub Codespaces Open in Dev Containers

This repository provides a LangGraph-based agentic system that proposes closing stale GitHub issues, with a human-in-the-loop review step using Agent Inbox. It selects stale issues from a target repository, investigates with repository-aware tools, and then interrupts for you to approve, edit, respond, or ignore before it posts a closing comment and closes the issue.

Supported LLM backends:

  • GitHub Models (default if API_HOST unset) – requires a PAT with models access.

  • OpenAI API (API_HOST=openai) – requires OPENAI_API_KEY.

  • Azure OpenAI (API_HOST=azure) – requires Azure deployment variables.

  • Graph IDs: issueagent (new) and legacy agent still available (see langgraph.json)

  • Default target repo: Azure-samples/azure-search-openai-demo (configurable via TARGET_REPO)

Contents

  • Getting started
    • GitHub Codespaces
    • VS Code Dev Containers
    • Local environment
  • GitHub authentication (required)
  • Configuring Azure AI models
  • Running the stale issue closer
  • Agent Inbox setup
  • Cost estimate
  • Developer tasks
  • Resources

Getting started

  1. Make sure the following are installed:

    • Python 3.11+
    • Git
    • uv (for dependency management)
  2. Clone the repository:

    git clone <repository-url>
    cd issue-agent
  3. Create the virtual environment and install dependencies (this will create .venv and uv.lock):

    uv sync

Choosing a model backend

Set one of these in your environment / .env:

API_HOST value Required variables Notes
(omit) or github GITHUB_TOKEN (+ models access) Uses GitHub Models endpoint; PAT must have models permission.
openai OPENAI_API_KEY (and optionally OPENAI_MODEL, defaults gpt-4o-mini) Fast to start if you already have OpenAI access.
gemini GEMINI_API_KEY (and optionally GEMINI_MODEL, defaults gemini-1.5-flash) Uses Google AI Gemini via langchain-google-genai.
Example .env snippet for Gemini:
API_HOST=gemini
GEMINI_API_KEY=AIza... # your Google AI Studio key
# Optional model variations: gemini-1.5-pro, gemini-1.5-flash, gemini-1.5-pro-exp
# GEMINI_MODEL=gemini-1.5-pro
GITHUB_TOKEN=ghp_...   # still required for GitHub issue operations
TARGET_REPO=psf/requests

| azure | AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_CHAT_DEPLOYMENT, AZURE_OPENAI_VERSION, plus AZURE_OPENAI_API_KEY or Azure AD auth | Provision via azd provision. |

Example .env snippet for OpenAI:

API_HOST=openai
OPENAI_API_KEY=sk-... # your key
# Optional:
# OPENAI_MODEL=gpt-4o-mini
GITHUB_TOKEN=ghp_...   # still required for GitHub issue operations
TARGET_REPO=psf/requests

If you see a 401 with message “The models permission is required”, your PAT lacks GitHub Models access; switch to OpenAI or Azure.

Configuring Azure AI models

This project uses Azure OpenAI for the LLM. This repository includes IaC (Bicep) to provision an Azure OpenAI deployment and writes a ready-to-use .env file.

  1. Install the Azure Developer CLI (azd)

  2. Sign in to Azure:

    azd auth login
  3. Provision Azure resources (this deploys Azure OpenAI and writes .env via a post-provision hook):

    azd provision

    After provisioning, your .env will include values like AZURE_TENANT_ID, AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_CHAT_DEPLOYMENT, AZURE_OPENAI_VERSION, AZURE_OPENAI_CHAT_MODEL

Configuring GitHub authentication

This project requires a GitHub personal access token to call the GitHub GraphQL and REST APIs (for searching issues/code and closing issues). It does not use GitHub Models for the LLM calls.

  1. In GitHub Developer Settings, create a personal access token with repo scope.

  2. Set GITHUB_TOKEN in your shell or in the .env file:

    export GITHUB_TOKEN=your_personal_access_token
  3. Set the target repository (optional, defaults to Azure-samples/azure-search-openai-demo):

    # Full name, e.g., owner/name. Default is Azure-samples/azure-search-openai-demo
    export TARGET_REPO=owner/name

Configuring Langsmith

This project uses Langsmith for tracing and for integration with Agent Inbox. To enable Langsmith tracing, set the following environment variables in your shell or in the .env file:

LANGSMITH_TRACING="true"
LANGSMITH_ENDPOINT="https://api.smith.langchain.com"
LANGSMITH_API_KEY="<your_langsmith_api_key>"
LANGSMITH_PROJECT="<your_project_name>"

Selecting a public repository to test

You can point the agent at any public repository you have read access to by setting TARGET_REPO=owner/name.

Tips for picking a test repo:

  1. Choose a project with many open issues and some clearly stale ones (older than ~30–60 days with no recent activity).
  2. Avoid repositories where you are not comfortable potentially posting a comment or closing an issue (you always approve first, but be cautious).
  3. You can start with a large library like psf/requests or pallets/flask but consider forking a repo if you want to safely exercise closing actions without affecting the upstream.

Dry-run concept: Today the graph applies actions after you approve. To simulate without side effects, approve only proposals that do not close or comment, or temporarily comment out calls in apply_decision_node.

Running the triager

This project uses uv and LangGraph’s dev server.

  1. Ensure dependencies are installed:

    uv sync
  2. Start the LangGraph dev server (inside the uv-managed virtualenv):

    uvx --from "langgraph-cli[inmem]" --with-editable . langgraph dev --allow-blocking

    When it’s running, a browser tab should open to LangGraph Studio via LangSmith. If it doesn’t, open this URL: https://smith.langchain.com/studio/thread?baseUrl=http%3A%2F%2F127.0.0.1%3A2024

  3. In LangGraph Studio, start a new run of the agent graph. The agent will select a stale issue from TARGET_REPO, investigate with tools, then interrupt for review.

Running the Agent Inbox

This repository includes the Langchain Agent Inbox UI as a git submodule at agent-inbox. Use it to review and act on issue proposals produced by the triager.

  1. If you cloned this repo without --recurse-submodules, initialize/update the submodule first:

    git submodule update --init --recursive
  2. Start the local Agent Inbox dev server:

    cd agent-inbox
    yarn install   # first time only (or when dependencies change)
    yarn dev
  3. Navigate to the server running at http://localhost:3000

  4. Configure the inbox:

    • Add your LangSmith API key: Click the "Settings" button in the sidebar, and enter your LangSmith API key.
    • Graph/Assistant ID: agent (matches langgraph.json)
    • Deployment URL: http://127.0.0.1:2024
  5. When the triager makes a proposal, it should show up as a thread in the inbox. Accept or edit to let the triager continue; if approved it will apply the actions (comment / labels / close).

Cost estimate

LLM usage varies per issue depending on the number of tool calls and the length of the issue and comments. With Azure OpenAI, cost depends on the model and tokens processed. See pricing: https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/

Developer tasks

Common dev tasks are available via uv and the included Makefile targets:

  • Run tests:

    uv run -- python -m pytest
  • Lint / format:

    uv run -- ruff check .
    uv run -- ruff format .
  • Type checking:

    uv run -- mypy src

Resources

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages