SWE Kit: PR Review Agent
Build a PR Review agent with SWE Kit
Overview
SWE Development Kit (swekit) is a powerful framework for building Software Engineering agents using Composio’s tooling ecosystem. This example demonstrates how to build a Pull Request (PR) Review Agent using SWE Development Kit (swekit). The PR Review Agent uses Composio’s tooling ecosystem to help automate and enhance the PR review process.
Getting Started
Installation
Begin by installing the core packages:
For additional functionality, install packages for your preferred framework (e.g., CrewAI):
Connect your Github Account
To utilize Github Issues as a task source, link your Github account as follows:
There are two ways to provide the GitHub access token for git clone:
- Set the environment variable
GITHUB_ACCESS_TOKEN='<git_access_token>'
. - Use the GitHub account connected to your toolset entity. However, this method has limitations:
- The agent won’t be able to push or create PRs.
- You need to set
export ALLOW_CLONE_WITHOUT_REPO='true'
.
Option 1 is recommended for full functionality.
Create a New Agent
Generate your agent’s scaffolding:
Scaffold support for other frameworks coming soon!
This process will establish a new agent at pr_review_agent
with essential files:
main.py
: The main script to execute the agentagent.py
: The agent’s core definitionprompts.py
: Prompts to guide the agent’s actionsbenchmark.py
: A runner for the SWE-Bench benchmarksinput.py
: A helper file to take inputs from the usertools.py
: A file to add custom tools to the agent
Start Docker Server
To use Docker as the default workspace environment, ensure your Docker server is running
If you prefer to run the agent locally without Docker (Unsafe), modify the workspace configuration in agent.py
by setting the WorkspaceType.Docker()
to WorkspaceType.Host()
.
Run the Agent
To activate the agent, proceed to its directory and execute:
You will be prompted to specify the repository and issue for the agent to address.
Was this page helpful?