RepoMicrosoftMicrosoftpublished Jul 17, 2026seen 2d

microsoft/IssueLens

Python

Open original ↗

Captured source

source ↗
published Jul 17, 2026seen 2dcaptured 2dhttp 200method plain

microsoft/IssueLens

Description: IssueLens

Language: Python

License: MIT

Stars: 0

Forks: 0

Open issues: 4

Created: 2026-07-17T01:56:28Z

Pushed: 2026-07-24T06:34:43Z

Default branch: main

Fork: no

Archived: no

README: IMPORTANT! All samples and other resources made available in this GitHub repository ("samples") are designed to assist in accelerating development of agents, solutions, and agent workflows for various scenarios. Review all provided resources and carefully test output behavior in the context of your use case. AI responses may be inaccurate and AI actions should be monitored with human oversight.

IssueLens — GitHub Issue Triage Agent (Foundry hosted)

A GitHub issue-triage agent built on the GitHub Copilot SDK (CopilotClient) and the azure-ai-agentserver-invocations protocol. It identifies critical issues (hot / blocking / regression), detects duplicates, applies labels, assigns owners, and sends notifications — deployable as a Foundry hosted agent.

How It Works

1. Receives a JSON task via POST /invocations. The payload has exactly two fields: input (the task, a free-form text prompt) and github_token (used to authenticate the GitHub MCP server), e.g. {"input": "Triage open issues in owner/repo", "github_token": "ghs_..."}. 2. Creates a fresh Copilot session per request configured with:

  • the Foundry model (BYOK via Managed Identity) or the GitHub Copilot model for inference;
  • the remote GitHub MCP server, authenticated with the github_token from the payload — so the agent reads issues and applies labels as that token's identity;
  • notification tools provided by the Foundry toolbox.

3. The preselected issuelens orchestrator delegates analysis to the runtime Critical Issue Analyst sub-agent registered with the Copilot SDK, then runs the find-duplicates, label-issue, assign-issue, and notify skills for requested follow-up actions. 4. Each Copilot SessionEvent is streamed back as an SSE data: event; a final event: done marks the end. Triage runs end with a JSON summary.

Environment Variables

Model (inference) — configure one

| Variable | Required | Description | |----------|----------|-------------| | FOUNDRY_PROJECT_ENDPOINT | For Foundry model | Azure AI Foundry project endpoint URL. Auto-injected when hosted — only needed locally | | AZURE_AI_MODEL_DEPLOYMENT_NAME | For Foundry model | Model deployment name (e.g. gpt-4o) | | GITHUB_TOKEN | For Copilot model | GitHub fine-grained PAT with Copilot Requests → Read-only permission |

If the Foundry variables are set they take precedence over GITHUB_TOKEN.

GitHub resource access

The agent authenticates the remote GitHub MCP server with the github_token supplied in each invocation payload — there is nothing to configure via environment variables. Override the endpoint only if needed:

| Variable | Required | Description | |----------|----------|-------------| | GITHUB_MCP_URL | No | GitHub MCP endpoint (default https://api.githubcopilot.com/mcp/). Override for GitHub Enterprise |

Notifications

WorkIQ (notification) tools are provided by the Foundry toolbox and are not configured in this codebase.

Running Locally

Prerequisites

  • Python 3.10+
  • A GitHub fine-grained PAT (github_pat_ prefix)

Create one at github.com/settings/personal-access-tokens/new with Account permissions → Copilot Requests → Read-only.

> Note: Classic tokens (ghp_) are not supported. Use a fine-grained PAT (github_pat_), OAuth token (gho_), or GitHub App user token (ghu_).

Using azd

Show steps

Create a local .env file from the sample template and set GITHUB_TOKEN:

cp .env.example .env # skip if .env already exists
# Edit .env and set GITHUB_TOKEN=github_pat_...

The sample loads .env automatically when running locally. If you plan to deploy with azd, also add the token to your azd environment so it can be injected into the hosted agent:

azd env set GITHUB_TOKEN="github_pat_..."

Next, start the agent locally with the run command:

azd ai agent run

The agent starts on http://localhost:8088/.

Using the Foundry Toolkit VS Code Extension

The Foundry Toolkit VS Code extension has a built-in sample gallery. You can open this sample directly from the extension without cloning the repository, it scaffolds the project into a new workspace, generates agent.yaml, .env, and .vscode/tasks.json + launch.json automatically, and configures a one-click F5 debug experience.

Chat with a running agent using the Agent Inspector:

1. Start the agent locally first using Using `azd` or Manual setup above. The agent listens on http://localhost:8088/. 2. Open the Command Palette (Ctrl+Shift+P) and run Foundry Toolkit: Open Agent Inspector. 3. The Inspector auto-connects to the running agent. Send messages to chat with the agent and watch the streamed responses.

Manual setup

pip install -r requirements.txt
cp .env.example .env # skip if .env already exists
# Edit .env and set GITHUB_TOKEN=github_pat_...
python main.py

The agent starts on http://localhost:8088/.

Invoke with azd

Show steps

Local

Bash:

azd ai agent invoke --local '{"input": "Triage open issues in microsoft/vscode-java-pack and label the critical ones", "github_token": "ghs_..."}'

PowerShell:

azd ai agent invoke --local '{\"input\": \"Triage open issues in microsoft/vscode-java-pack and label the critical ones\", \"github_token\": \"ghs_...\"}'

Test with curl

# Triage a repository (find critical issues) and notify
curl -N -X POST http://localhost:8088/invocations \
-H "Content-Type: application/json" \
-d '{"input": "Triage open issues updated in the last 24h in owner/repo, then send the report", "github_token": "ghs_..."}'

# Label a single issue
curl -N -X POST http://localhost:8088/invocations \
-H "Content-Type: application/json" \
-d '{"input": "Label issue owner/repo#123", "github_token": "ghs_..."}'

# Assign a single issue using area ownership and historical patterns
curl -N -X POST...

Excerpt shown — open the source for the full document.