Overview
The OpenHands PR Review workflow is a GitHub Actions workflow that:- Triggers automatically when PRs are opened or when you request a review
- Analyzes code changes in the context of your entire repository
- Posts inline comments directly on specific lines of code in the PR
- Provides fast feedback - typically within 2-3 minutes
How It Works
The PR review workflow uses the OpenHands Software Agent SDK to analyze your code changes:-
Trigger: The workflow runs when:
- A new non-draft PR is opened
- A draft PR is marked as ready for review
- The
review-thislabel is added to a PR openhands-agentis requested as a reviewer
-
Analysis: The agent receives the complete PR diff and uses two skills:
/codereviewor/codereview-roasted: Analyzes code for quality, security, and best practices/github-pr-review: Posts structured inline comments via the GitHub API
-
Output: Review comments are posted directly on the PR with:
- Priority labels (🔴 Critical, 🟠 Important, 🟡 Suggestion, 🟢 Nit)
- Specific line references
- Actionable suggestions with code examples
Review Styles
Choose between two review styles:| Style | Description | Best For |
|---|---|---|
Standard (/codereview) | Pragmatic, constructive feedback focusing on code quality, security, and best practices | Day-to-day code reviews |
Roasted (/codereview-roasted) | Linus Torvalds-style brutally honest review emphasizing “good taste”, data structures, and simplicity | Critical code paths, learning opportunities |
Quick Start
Add your LLM API key
Go to your repository’s Settings → Secrets and variables → Actions and add:
LLM_API_KEY: Your LLM API key (get one from OpenHands LLM Provider)
Create the review label
Create a
review-this label in your repository:- Go to Issues → Labels
- Click New label
- Name:
review-this - Description:
Trigger OpenHands PR review
Composite Action
The workflow uses a reusable composite action from the Software Agent SDK that handles all the setup automatically:- Checking out the SDK at the specified version
- Setting up Python and dependencies
- Running the PR review agent
- Uploading logs as artifacts
Action Inputs
| Input | Description | Required | Default |
|---|---|---|---|
llm-model | LLM model to use | Yes | - |
llm-base-url | LLM base URL (for custom endpoints) | No | '' |
review-style | Review style: standard or roasted | No | roasted |
sdk-version | Git ref for SDK (tag, branch, or commit SHA) | No | main |
sdk-repo | SDK repository (owner/repo) | No | OpenHands/software-agent-sdk |
llm-api-key | LLM API key | Yes | - |
github-token | GitHub token for API access | Yes | - |
Use
sdk-version to pin to a specific version tag (e.g., v1.0.0) for production stability, or use main to always get the latest features.Customization
Repository-Specific Review Guidelines
Create custom review guidelines for your repository by adding a skill file at.agents/skills/code-review.md:
The skill file must use
/codereview as the trigger to override the default review behavior. See the software-agent-sdk’s own code-review skill for a complete example.Workflow Configuration
Customize the workflow by modifying the action inputs:Trigger Customization
Modify when reviews are triggered by editing the workflow conditions:Security Considerations
The workflow usespull_request_target so the code review agent can work properly for PRs from forks. Only users with write access can trigger reviews via labels or reviewer requests.
Example Reviews
See real automated reviews in action on the OpenHands Software Agent SDK repository:| PR | Description | Review Highlights |
|---|---|---|
| #1927 | Composite GitHub Action refactor | Comprehensive review with 🔴 Critical, 🟠 Important, and 🟡 Suggestion labels |
| #1916 | Add example for reconstructing messages | Critical issues flagged with clear explanations |
| #1904 | Update code-review skill guidelines | APPROVED review highlighting key strengths |
| #1889 | Fix tmux race condition | Technical review of concurrency fix with dual-lock strategy analysis |
Troubleshooting
Review not triggering
Review not triggering
- Ensure the
LLM_API_KEYsecret is set correctly - Check that the label name matches exactly (
review-this) - Verify the workflow file is in
.github/workflows/ - Check the Actions tab for workflow run errors
Review comments not appearing
Review comments not appearing
- Ensure
GITHUB_TOKENhaspull-requests: writepermission - Check the workflow logs for API errors
- Verify the PR is not from a fork with restricted permissions
Review taking too long
Review taking too long
- Large PRs may take longer to analyze
- Consider splitting large PRs into smaller ones
- Check if the LLM API is experiencing delays
Related Resources
- PR Review Workflow Reference - Full workflow example and agent script
- Composite Action - Reusable GitHub Action for PR reviews
- Software Agent SDK - Build your own AI-powered workflows
- GitHub Integration - Set up GitHub integration for OpenHands Cloud
- Skills Documentation - Learn more about OpenHands skills

