<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/11.3-github-ai-automation -->

# GitHub AI Automation

- .github/ISSUE_TEMPLATE/bug_report.md
- .github/actions/claude-code-action/action.yml
- .github/actions/claude-issue-triage-action/action.yml
- .github/actions/gemini/action.yml
- .github/workflows/auto-issue-comment.yml
- .github/workflows/auto-pr-comment.yml
- .github/workflows/claude-issue-triage.yml
- .github/workflows/claude.yml
- .github/workflows/docker-publish.yml
- .github/workflows/gemini-issue-automated-triage.yml
- .github/workflows/gemini-issue-review.yml
- .github/workflows/gemini-pr-review.yml
- src/praisonai-agents/autoagents-tavily.py
- src/praisonai-agents/praisonaiagents/agents/autoagents.py
- src/praisonai-agents/praisonaiagents/llm/model_capabilities.py

This document describes the AI-powered automation system for GitHub workflows in the PraisonAI repository. The system uses two AI models-Claude and Gemini-to automatically review issues and pull requests, make code modifications, apply labels, and create fix branches with minimal human intervention.

For information about the broader CI/CD pipeline and testing infrastructure, see [CI/CD Pipeline](/MervinPraison/PraisonAI/11.2-cicd-pipeline). For details on the testing framework that these AI systems help maintain, see [Testing Framework](/MervinPraison/PraisonAI/11.1-testing-framework).

## System Overview

The GitHub AI automation system consists of dual AI assistants that monitor repository activity and respond to specific triggers. The system enables autonomous code review, issue resolution, and pull request modifications without requiring manual intervention.

```

```

**Sources:** [.github/workflows/claude.yml1-160](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L1-L160) [.github/workflows/gemini-pr-review.yml1-248](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L1-L248) [.github/workflows/gemini-issue-review.yml1-203](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L1-L203) [.github/workflows/auto-issue-comment.yml1-26](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-issue-comment.yml#L1-L26) [.github/workflows/auto-pr-comment.yml1-23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-pr-comment.yml#L1-L23)

## Trigger Mechanisms

The system responds to multiple trigger types, each activating different AI workflows based on context and user intent.

**Sources:** [.github/workflows/claude.yml3-11](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L3-L11) [.github/workflows/gemini-pr-review.yml4-22](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L4-L22) [.github/workflows/gemini-issue-review.yml5-23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L5-L23) [.github/workflows/gemini-issue-automated-triage.yml4-15](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-automated-triage.yml#L4-L15)

### Bot Protection

The Claude workflow includes bot protection to prevent infinite loops and unwanted triggers:

```

```

This filter blocks most bot accounts while allowing `github-actions[bot]` for feedback loops.

**Sources:** [.github/workflows/claude.yml16-20](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L16-L20)

## Claude Workflows

### Claude Assistant Workflow

The `claude.yml` workflow provides the primary Claude integration, responding to mentions and automatically triggered comments across issues and pull requests.

```

```

**Key Configuration:**

- Authentication: Uses CLAUDE_ACCESS_TOKEN secret and GitHub token
- Timeout: 30 minutes per execution
- Trigger phrase: @claude
- Allowed tools: Bash commands (git, python, pip, pytest, gh), file operations, MCP GitHub tools

**Sources:** [.github/workflows/claude.yml1-160](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L1-L160) [.github/actions/claude-code-action/action.yml1-256](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/claude-code-action/action.yml#L1-L256)

### Feedback Loop Mechanism

After Claude completes a review, the `post-review-comment` job automatically posts a follow-up request for additional review:

```

```

The follow-up comment specifically requests:

- Review of changes made in the branch
- Verification against requirements
- Additional fixes if issues remain
- Performance impact assessment

**Sources:** [.github/workflows/claude.yml59-160](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L59-L160)

### Auto-Comment Workflows

Two workflows automatically trigger Claude on new issues and pull requests:

#### auto-issue-comment.yml

Immediately posts a comment when an issue is opened:

```
@claude review this issue and do a detailed analysis and fix this if the existing code 
doesn't have the solution implemented. Making sure it has backward compatibility, no 
existing features removed. After making those changes, again review the applied changes. 
Use @web to search if you dont know any information or to find the latest documentation 
or to find the latest version. Run the code if you think you need to run it to test it. 
Minimal code change to start with if required any changes. MAINLY IT SHOULD NOT IMPACT 
ON THE CURRENT SPEED OF EXECUTION of existing features, not increasing the overhead. 
**Please create a PR using gh tool with your changes**.
```

**Sources:** [.github/workflows/auto-issue-comment.yml1-26](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-issue-comment.yml#L1-L26)

#### auto-pr-comment.yml

Immediately posts a similar comment when a pull request is opened:

**Sources:** [.github/workflows/auto-pr-comment.yml1-23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-pr-comment.yml#L1-L23)

### MCP Tools Integration

Claude uses the GitHub MCP (Model Context Protocol) Server to interact with repository resources:

```

```

Available MCP tools:

- mcp__github__get_issue - Retrieve issue details
- mcp__github__get_issue_comments - Read issue comments
- mcp__github__update_issue - Modify issues (labels, status)

**Sources:** [.github/actions/claude-code-action/action.yml68-84](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/claude-code-action/action.yml#L68-L84) [.github/workflows/claude.yml54-57](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L54-L57)

## Gemini Workflows

### Gemini PR Review Workflow

The `gemini-pr-review.yml` workflow performs in-place modifications to pull request branches using a structured 7-step process.

```

```

**Critical Workflow Design:**

The workflow explicitly instructs Gemini to NOT create new branches, but to modify the existing PR branch:

```
STEP 2: If Code Improvements Are Needed
**IMPORTANT:** DO NOT create a new branch! Work on the EXISTING PR branch.
- Use: `git fetch origin` to get latest changes
- Get PR branch name: `gh pr view ${PR_NUMBER} --json headRefName`
- Switch to PR branch: `git checkout BRANCH_NAME`
- Use: `git pull origin BRANCH_NAME` to get latest PR changes
```

**Sources:** [.github/workflows/gemini-pr-review.yml1-248](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L1-L248)

### Review Output Format

Gemini structures reviews using a standardized markdown format:

Sections are conditionally included only if relevant issues exist.

**Sources:** [.github/workflows/gemini-pr-review.yml206-247](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L206-L247)

### Gemini Issue Review Workflow

The `gemini-issue-review.yml` workflow resolves GitHub issues by creating fix branches and pull requests.

```

```

**Branch Naming Convention:**

All Gemini-created branches use the prefix `gemini/issue-{ISSUE_NUMBER}-{description}`:

```

```

**PR Creation Command:**

```

```

**Sources:** [.github/workflows/gemini-issue-review.yml1-203](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L1-L203)

### Gemini Issue Triage Workflow

The `gemini-issue-automated-triage.yml` workflow automatically applies labels to issues using AI analysis.

**Trigger:** `@gemini triage` in issue comment

**Core Tools:**

```

```

**Triage Process:**

1. List available labels: gh label list --limit 100
2. Analyze issue title and body
3. Select relevant labels (kind/ , area/ , priority/*)
4. Apply labels: gh issue edit ISSUE_NUMBER --add-label "label1,label2"

**Key Constraint:** Only uses existing repository labels; does not create new ones.

**Sources:** [.github/workflows/gemini-issue-automated-triage.yml1-76](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-automated-triage.yml#L1-L76)

## Tool Access Matrix

Both AI systems have access to overlapping but distinct tool sets:

**Sources:** [.github/workflows/claude.yml38-57](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L38-L57) [.github/workflows/gemini-pr-review.yml109-137](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L109-L137) [.github/workflows/gemini-issue-review.yml166-196](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L166-L196)

## Authentication and Permissions

### Token Management

The workflows use multiple authentication mechanisms:

```

```

**Sources:** [.github/workflows/claude.yml35-36](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L35-L36) [.github/workflows/gemini-pr-review.yml31-36](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L31-L36) [.github/workflows/gemini-issue-review.yml28-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L28-L33)

### Permission Requirements

**Sources:** [.github/workflows/claude.yml22-26](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L22-L26) [.github/workflows/gemini-pr-review.yml25-29](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L25-L29) [.github/workflows/gemini-issue-review.yml8-11](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L8-L11)

## Gemini CLI Configuration

The Gemini workflows use a custom composite action located at `.github/actions/gemini/action.yml`.

### Settings Configuration

Gemini behavior is controlled via `settings.json`:

```

```

**Key Parameters:**

- version: Can be npm version ( 0.1.8-rc.0 ), latest , branch name, or commit hash
- GEMINI_API_KEY: API key for Gemini model access
- OTLP_GCP_WIF_PROVIDER: Workload Identity Federation for telemetry
- OTLP_GOOGLE_CLOUD_PROJECT: GCP project for telemetry data

**Sources:** [.github/actions/gemini/action.yml1-81](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/gemini/action.yml#L1-L81)

### Installation Logic

The action supports multiple installation sources:

```

```

**Sources:** [.github/actions/gemini/action.yml54-61](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/gemini/action.yml#L54-L61)

## Security Considerations

### Input Sanitization

The workflows protect against script injection (GHSL-2025-093) by passing user-controlled inputs via environment variables:

```

```

This prevents injection attacks when processing issue titles, comment bodies, or PR descriptions.

**Sources:** [.github/workflows/gemini-pr-review.yml58-81](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L58-L81) [.github/workflows/gemini-issue-review.yml49-75](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L49-L75) [.github/actions/claude-code-action/action.yml89-104](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/claude-code-action/action.yml#L89-L104)

### Author Association Checks

Gemini workflows enforce authorization levels:

```

```

Only repository owners, members, and collaborators can trigger Gemini workflows.

**Sources:** [.github/workflows/gemini-pr-review.yml20-22](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L20-L22) [.github/workflows/gemini-issue-review.yml21-23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L21-L23)

## Timeout and Concurrency Controls

### Timeout Settings

**Sources:** [.github/workflows/claude.yml57](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L57-L57) [.github/workflows/gemini-pr-review.yml23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L23-L23) [.github/workflows/gemini-issue-automated-triage.yml16](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-automated-triage.yml#L16-L16)

### Concurrency Control

The triage workflow prevents concurrent executions on the same issue:

```

```

**Sources:** [.github/workflows/gemini-issue-automated-triage.yml21-23](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-automated-triage.yml#L21-L23)

## Execution Flow Examples

### Issue Fix Flow (Gemini)

```

```

**Sources:** [.github/workflows/gemini-issue-review.yml88-162](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L88-L162)

### PR Review Flow (Gemini)

```

```

**Sources:** [.github/workflows/gemini-pr-review.yml144-186](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L144-L186)

## Performance Optimization

### Key Performance Constraints

Both workflows include explicit instructions to avoid performance degradation:

```
MAINLY IT SHOULD NOT IMPACT ON THE CURRENT SPEED OF EXECUTION of existing features, 
not increasing the overhead.
```

This directive appears in:

- Auto-issue comments
- Auto-PR comments
- Post-review follow-up comments

**Sources:** [.github/workflows/auto-issue-comment.yml25](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-issue-comment.yml#L25-L25) [.github/workflows/auto-pr-comment.yml22](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-pr-comment.yml#L22-L22) [.github/workflows/claude.yml156](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L156-L156)

### Minimal Code Changes

The workflows emphasize minimal modifications:

- "Minimal code change to start with if required any changes"
- "Make focused, targeted improvements to the PR"
- "Make focused, targeted changes to fix the issue"

**Sources:** [.github/workflows/auto-issue-comment.yml25](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/auto-issue-comment.yml#L25-L25) [.github/workflows/gemini-pr-review.yml172](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L172-L172) [.github/workflows/gemini-issue-review.yml113](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L113-L113)

## Custom Instructions and Prompts

### Direct Prompts

Both actions support custom prompts for specialized workflows:

**Claude:**

```

```

**Gemini:**

```

```

**Sources:** [.github/actions/claude-code-action/action.yml57-59](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/claude-code-action/action.yml#L57-L59) [.github/actions/gemini/action.yml6-9](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/gemini/action.yml#L6-L9)

### Custom Instructions

Claude supports additional custom instructions that merge with base prompts:

```

```

**Sources:** [.github/actions/claude-code-action/action.yml45-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/claude-code-action/action.yml#L45-L47)

## Telemetry and Observability

### Gemini Telemetry

Gemini workflows can send telemetry to Google Cloud Platform:

```

```

Requires GCP authentication via Workload Identity Federation:

```

```

**Sources:** [.github/actions/gemini/action.yml44-51](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/gemini/action.yml#L44-L51) [.github/workflows/gemini-issue-review.yml197-201](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-issue-review.yml#L197-L201)

## Extending the System

### Adding New Workflows

To create a new AI-powered workflow:

1. Choose AI system: Claude (for code-heavy tasks with MCP) or Gemini (for structured multi-step processes)
2. Define triggers: Use GitHub event filters and authorization checks
3. Create prompt: Structure the AI instructions with clear steps
4. Configure tools: Whitelist only necessary bash commands and file operations
5. Add safety checks: Include bot protection and permission validation
6. Set timeouts: Configure appropriate time limits

### Tool Whitelisting

Tools must be explicitly allowed in workflow configuration:

**Claude format:**

```

```

**Gemini format:**

```

```

**Sources:** [.github/workflows/claude.yml38-57](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/claude.yml#L38-L57) [.github/workflows/gemini-pr-review.yml109-137](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/gemini-pr-review.yml#L109-L137)

### MCP Server Integration

Claude workflows can add custom MCP servers for specialized capabilities:

```

```

This allows integration with any MCP-compatible tool beyond the GitHub MCP server.

**Sources:** [.github/actions/claude-code-action/action.yml49-52](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/actions/claude-code-action/action.yml#L49-L52)
