SWE-agent Code Fixer

Deploy SWE-agent on Clore.ai — automate GitHub issue resolution and software engineering tasks using AI agents with Docker sandboxing, supporting Claude, GPT-4, and open-source LLMs.

Overview

SWE-agentarrow-up-right is an AI-powered software engineering agent that automatically resolves GitHub issues by letting a language model interact with a code repository through a terminal interface. Presented at NeurIPS 2024 and with over 15,000 GitHub stars, SWE-agent has become the leading open-source solution for automated bug fixing and code repair.

Unlike most tools in this documentation, SWE-agent does not require a GPU — it calls external LLM APIs (Claude, GPT-4, Gemini, or self-hosted models) to reason about code and generate fixes. What it does need is a reliable Docker environment for safe, sandboxed code execution. Clore.ai's CPU servers (or any rented instance with Docker) are a perfect fit.

Key features:

  • 🐛 Automated GitHub issue resolution with a single command

  • 🔒 Sandboxed execution inside Docker containers — safe to run arbitrary code

  • 🤖 Supports Claude, GPT-4, Gemini, OpenAI-compatible, and local models

  • 🌐 Web UI for monitoring agent progress

  • 🛡️ Cybersecurity mode for CTF challenges and penetration testing

  • 📊 SWE-bench compatible — tested against 300+ real GitHub issues

  • 🔧 Configurable agent behaviors via YAML config files


Requirements

Hardware Requirements

SWE-agent doesn't need a GPU — it uses API-based LLMs for reasoning:

Tier
CPU
RAM
Storage
Clore.ai Price

Minimum

4 cores

8 GB

30 GB SSD

~$0.03/hr

Recommended

8 cores

16 GB

60 GB SSD

~$0.06/hr

Heavy workloads

16 cores

32 GB

100 GB SSD

~$0.10/hr

With local LLM

GPU server

32 GB

100 GB SSD

~$0.20/hr

💡 Cost tip: SWE-agent is unusually cheap to run on Clore.ai since you don't need a GPU. The main cost is the LLM API calls (e.g., Claude Sonnet costs ~$0.003/1K tokens). A typical issue fix costs $0.50–$2.00 in API fees.

Software & API Requirements

Requirement
Details

Docker

Required for sandboxed code execution

LLM API Key

Anthropic, OpenAI, Google, or self-hosted

GitHub Token

For accessing private repos and creating PRs

Python 3.11+

For pip install sweagent method

LLM API Pricing Reference

Model
Input
Output
Typical run cost

Claude Sonnet 4

$3/M tokens

$15/M tokens

~$1.00–$2.00

GPT-4o

$5/M tokens

$15/M tokens

~$1.00–$3.00

GPT-4o mini

$0.15/M tokens

$0.60/M tokens

~$0.05–$0.20

Ollama (local)

Free

Free

Clore.ai hourly cost only


Quick Start

Step 1 — Rent a Server on Clore.ai

  1. Filter: Docker enabled — GPU is optional (CPU server is fine)

  2. Recommended image: ubuntu:22.04 or any Docker-enabled image

  3. Open ports: 22 (SSH), 7860 (SWE-agent Web UI)

  4. Minimum 16 GB RAM recommended for running Docker-in-Docker

Step 2 — Connect via SSH

Step 3 — Pull the SWE-agent Docker Image

Alternatively, build from source for the latest development version:

Step 4 — Set Up API Keys

Step 5 — Fix Your First GitHub Issue

Step 6 — Review the Output


Configuration

Basic Configuration File

Instead of long command-line flags, use a YAML config:

Web UI Mode

SWE-agent includes a Gradio-based web interface for interactive use:

Using Different LLM Providers

Batch Processing Multiple Issues


Docker-in-Docker Setup

SWE-agent runs code in nested Docker containers for security. This requires Docker socket access:

Security Considerations

Using a Pre-built Environment Image


Tips & Best Practices

🎯 Writing Effective Problem Statements

The quality of SWE-agent's fix depends heavily on the issue description:

Expected Behavior

Should return 0 when discount is 100%.

Relevant Code

See billing/calculator.py lines 45-67. EOF

docker run --rm --env-file /workspace/sweagent/.env -v /workspace/sweagent/output:/output -v /workspace/sweagent/issue.txt:/issue.txt -v /var/run/docker.sock:/var/run/docker.sock sweagent/swe-agent:latest python run.py --agent.model.name=claude-sonnet-4-20250514 --env.repo.github_url=https://github.com/USER/REPO --problem_statement.text_file=/issue.txt

🔄 Auto-PR Creation

📊 SWE-bench Evaluation

🛡️ Cybersecurity Mode


Troubleshooting

Docker socket permission denied

API key errors

Agent gets stuck in a loop

Out of memory during code execution

GitHub rate limiting


Further Reading

💡 Clore.ai + SWE-agent sweet spot: Rent a CPU-only server (4 cores, 16GB RAM) at ~$0.05/hr, run SWE-agent with Claude Sonnet 4, and fix GitHub issues for roughly $1–2 total per issue (API costs) plus a few cents of Clore.ai time. For teams with many issues, this beats hiring a developer for routine bug fixes by orders of magnitude.

Last updated

Was this helpful?