The SWE Agent is an automated agent that can write new features for the project.
First, I create a GitHub issue describing the work I want the agent to complete.
When the GitHub issue is labeled with develop
, the agent will automatically run,
producing a pull request with the completed work.
Check out the full demo:
The agent is a Dagger function that automatically writes new features for the project. Using Dagger to solve this is perfect because the agent can use the same code that developers and CI systems already use to test the code.
In the dagger module under .dagger directory, there is a new function called Develop
.
The develop
function:
- Creates a Workspace for an LLM to read and write the files in the project and run tests
- Passes in the appropriate source and checker function to the workspace
- Give the LLM a prompt to complete a feature assignment
- Get back a directory with the completed work
To get a useful agentic flow out of this function, there's another function called DevelopPullRequest
that:
- Uses the GitHub API to get the assignment issue body
- Uses the
Develop
function to complete the assignment - Uses the GitHub API to create a pull request with the completed work
You can call the develop
function with Dagger to see the agent complete a given assignment. The develop
function takes an assignment as an argument and returns a Directory
(yes, like a filesystem). With that Directory, you can get in a terminal, inspect the files, or just export the files to your local machine.
The only dependency to run this agent is Dagger. Here are the installation instructions.
Once you have Dagger, fork or clone this repository:
git clone https://github.com/kpenfound/greetings-api
cd greetings-api
Then, get in a Dagger shell to interact with the module:
dagger
⋈ Run agent to complete the asssignment
In the snippet below, the agent will complete the assignment "Add a new greeting in Portuguese".
Because the develop
function returns a Directory, you can pipe it to the terminal
function to get a terminal in the directory.
develop "Add a new greeting in Portuguese" | terminal
⋈ Run develop to let the agent complete the assignment with different models.
develop "Add a new greeting in Portuguese" --model <any model, e.g. "gpt-4o"> | terminal