Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions .github/actions/strands-task-labeller/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: 'Strands Task Labeller'
description: 'Automatically analyze and label GitHub issues using Strands agent'
inputs:
aws_role_arn:
description: 'AWS IAM role ARN for authentication'
required: true
sessions_bucket:
description: 'S3 bucket for session storage'
required: true
pat_token:
description: 'pat token to modify repo'
required: false

runs:
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
sparse-checkout: |
.github

- name: Copy .github to safe directory
shell: bash
run: |
mkdir -p ${{ runner.temp }}/strands-labeller
cp -r .github ${{ runner.temp }}/strands-labeller

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: '${{ runner.temp }}/strands-labeller/.github/scripts/python/requirements.txt'

- name: Install Strands Agents
shell: bash
run: |
echo "📦 Installing from requirements.txt"
uv pip install --system -r ${{ runner.temp }}/strands-labeller/.github/scripts/python/requirements.txt --quiet

- name: Configure Git
shell: bash
run: |
git config --global user.name "Strands Agent"
git config --global user.email "217235299+strands-agent@users.noreply.github.com"
git config --global core.pager cat
PAGER=cat

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.aws_role_arn }}
role-session-name: GitHubActions-StrandsAgent-${{ github.run_id }}
aws-region: us-west-2
mask-aws-account-id: true
inline-session-policy: >-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid":"BedrockAccess",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModelWithResponseStream",
"bedrock:InvokeModel"
],
"Resource": "*"
}, {
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::${{ inputs.sessions_bucket }}/*"
]
}, {
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": [
"arn:aws:s3:::${{ inputs.sessions_bucket }}"
]
}
]
}

- name: Execute labelling task
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
PAT_TOKEN: ${{ inputs.pat_token }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_WRITE: 'true'
S3_SESSION_BUCKET: ${{ inputs.sessions_bucket }}
SESSION_ID: 'labeller-${{ github.event.issue.number }}-${{ github.run_id }}'
INPUT_SYSTEM_PROMPT: 'You are a GitHub Issue Categorization Agent. Your role is to analyze new GitHub issues and automatically apply appropriate labels and tag relevant area experts.

## Core Responsibilities
1. **Label Assignment**: Apply relevant labels from the repository based on issue content
2. **Area Expert Tagging**: Tag appropriate team members using @mentions based on technical areas
3. **Issue Summary**: Generate a brief summary with context from similar issues

## Process
1. First, search for similar issues using search_similar_issues tool to understand context
2. Get available repository labels using list_repository_labels tool
3. Read the automation configuration from .github/config/automation-config.json for area experts
4. Analyze the issue title, description, and any provided context
5. Apply ONLY existing labels from step 2 using add_labels_to_issue tool
6. Tag relevant area experts with @mentions in a comment

## Similar Issues Analysis
- Use search_similar_issues tool to find related issues before categorizing
- Extract keywords from the new issue title and description
- Review similar issues to understand patterns and common solutions
- Reference similar issues in your summary if relevant

## Label Assignment
- CRITICAL: Use list_repository_labels tool FIRST to get available labels
- ONLY apply labels that exist in the repository - NEVER create new labels
- Match issue content to existing labels (bug, enhancement, documentation, etc.)
- If no perfect match exists, choose the closest existing label
- Focus on categorization labels that help with organization

## Area Expert Assignment Rules
- Match issue content to technical areas (typescript, bedrock, openai, mcp, etc.)
- Tag ONLY the 2 most relevant experts based on the area_experts configuration
- Use @username format for mentions
- Prioritize experts most closely related to the specific issue content

## Area Expert Matching
Match issue content to these technical areas and tag corresponding experts:
- agent_loop, context_management, async_streaming, tool_executors
- bi_directional_streaming, human_in_loop, hooks
- bedrock, anthropic, gemini, litellm, llamaapi, llama_cpp, mistralai, ollama, openai, sagemaker, writer, cohere
- multi_agent, a2a, sessions, memory, mcp, structured_outputs
- agentcore_integrations, telemetry, evaluations, github_workflows
- website_docs, tools, samples, agent_builder, mcp_server
- embodied_ai, typescript, constraints_engine

## Output Format
- Apply labels immediately using add_labels_to_issue tool
- Post a single comment with expert mentions that includes:
- Brief issue summary with context from similar issues (if found)
- Expert mentions (MAX 2 people): "CC @expert1 @expert2 for [specific area] - [brief reason why they are needed]"
- Links to similar issues if relevant
- Clear action items or next steps if applicable
- Keep comments professional but informative
- For TypeScript issues: Only tag TypeScript experts if the issue is specifically about TypeScript compilation, syntax, or type errors (not just because this is a TypeScript project)

## Important Notes
- Do NOT set any project fields or priorities - this agent is for categorization only
- Focus on helping organize and route issues to the right people
- Prioritization will be handled by a separate process

Use GitHub tools to execute all actions. Be thorough but efficient in your analysis.'
STRANDS_TOOL_CONSOLE_MODE: 'enabled'
BYPASS_TOOL_CONSENT: 'true'
run: |
uv run ${{ runner.temp }}/strands-labeller/.github/scripts/python/agent_runner.py "Analyze and categorize GitHub issue #${{ github.event.issue.number }}: search for similar issues, apply appropriate labels, and tag relevant area experts based on issue content."
148 changes: 148 additions & 0 deletions .github/config/automation-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"area_experts": {
"agent_loop": {
"name": "Agent Loop",
"github_usernames": ["pgrayy", "zastrowm"]
},
"context_management": {
"name": "Context Management / Windows",
"github_usernames": ["Unshure", "afarntrog"]
},
"async_streaming": {
"name": "Async / Callbacks Streaming",
"github_usernames": ["pgrayy"]
},
"tool_executors": {
"name": "Tool Executors",
"github_usernames": ["pgrayy"]
},
"bi_directional_streaming": {
"name": "Bi-directional Streaming",
"github_usernames": ["mehtarac", "mkmeral", "pgrayy"]
},
"human_in_loop": {
"name": "Human in the Loop / Interrupts",
"github_usernames": ["mkmeral", "pgrayy"]
},
"hooks": {
"name": "Hooks",
"github_usernames": ["zastrowm"]
},
"bedrock": {
"name": "Bedrock Model Provider",
"github_usernames": ["mehtarac"]
},
"anthropic": {
"name": "Anthropic Model Provider",
"github_usernames": ["pgrayy"]
},
"gemini": {
"name": "Gemini Model Provider",
"github_usernames": ["notgitika"]
},
"litellm": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to list the the label associated with the category? Or are we allowing any label?

Right now all of our "area" label start with "area-"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For labels, the agent will only use existing labels. It will @ the person in this list in the comment, thus the expert will receive an email noticification. We can do assign the expert directly, but personally I think this is a little aggressive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we shouldn't assign. I like mentioning more.

But we do have to be concerned with user-submitted content possibly spamming the repository via the agent. Some sort of guard rails around what the agent can do I think would be ideal.

"name": "LiteLLM Model Provider",
"github_usernames": ["dbschmigelski"]
},
"llamaapi": {
"name": "LlamaAPI Model Provider",
"github_usernames": ["pgrayy"]
},
"llama_cpp": {
"name": "llama.cpp Model Provider",
"github_usernames": ["awsarron"]
},
"mistralai": {
"name": "MistralAI Model Provider",
"github_usernames": ["mehtarac"]
},
"ollama": {
"name": "Ollama Model Provider",
"github_usernames": ["dbschmigelski"]
},
"openai": {
"name": "OpenAI Model Provider",
"github_usernames": ["pgrayy"]
},
"sagemaker": {
"name": "SageMaker Model Provider",
"github_usernames": ["mehtarac"]
},
"writer": {
"name": "Writer Model Provider",
"github_usernames": ["mehtarac"]
},
"cohere": {
"name": "Cohere Model Provider",
"github_usernames": ["Unshure"]
},
"multi_agent": {
"name": "Multi-agent Orchestrators",
"github_usernames": ["mkmeral", "JackYPCOnline", "awsarron"]
},
"a2a": {
"name": "A2A",
"github_usernames": ["awsarron"]
},
"sessions": {
"name": "Sessions",
"github_usernames": ["Unshure", "JackYPCOnline"]
},
"memory": {
"name": "Memory",
"github_usernames": ["Unshure", "mehtarac", "afarntrog"]
},
"mcp": {
"name": "MCP",
"github_usernames": ["dbschmigelski"]
},
"structured_outputs": {
"name": "Structured Outputs",
"github_usernames": ["afarntrog"]
},
"agentcore_integrations": {
"name": "AgentCore Integrations",
"github_usernames": ["JackYPCOnline", "afarntrog", "mehtarac", "dbschmigelski"]
},
"telemetry": {
"name": "Telemetry / Observability",
"github_usernames": ["poshinchen", "JackYPCOnline"]
},
"evaluations": {
"name": "Evaluations",
"github_usernames": ["poshinchen"]
},
"github_workflows": {
"name": "GitHub Workflows and Actions",
"github_usernames": ["dbschmigelski", "yonib05", "Unshure"]
},
"website_docs": {
"name": "Website and Docs",
"github_usernames": ["zastrowm", "yonib05", "rycolez"]
},
"tools": {
"name": "Tools",
"github_usernames": ["cagataycali", "JackYPCOnline", "zastrowm", "mehtarac"]
},
"agent_builder": {
"name": "Agent Builder",
"github_usernames": ["cagataycali"]
},
"mcp_server": {
"name": "MCP Server",
"github_usernames": ["JackYPCOnline", "mkmeral"]
},
"embodied_ai": {
"name": "Embodied / Physical AI and Edge Inference / Robotics",
"github_usernames": ["awsarron", "cagataycali", "mkmeral"]
},
"typescript": {
"name": "TypeScript",
"github_usernames": ["Unshure", "zastrowm", "afarntrog", "awsarron"]
},
"steering": {
"name": "Steering",
"github_usernames": ["dbschmigelski"]
}
}
}
6 changes: 6 additions & 0 deletions .github/scripts/python/agent_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Import local GitHub tools we need
from github_tools import (
add_issue_comment,
add_labels_to_issue,
create_issue,
create_pull_request,
get_issue,
Expand All @@ -28,7 +29,9 @@
get_pr_review_and_comments,
list_issues,
list_pull_requests,
list_repository_labels,
reply_to_review_comment,
search_similar_issues,
update_issue,
update_pull_request,
)
Expand Down Expand Up @@ -62,7 +65,10 @@ def _get_all_tools() -> list[Any]:
update_issue,
list_issues,
add_issue_comment,
add_labels_to_issue,
get_issue_comments,
search_similar_issues,
list_repository_labels,

# GitHub PR tools
create_pull_request,
Expand Down
Loading