# SWE-AF

> One API call spins up a whole AI engineering team — product manager, architect, coders, reviewers, testers — that plans, builds, verifies and opens the pull request

- Category: AI Coding / Autonomous Coding Agents
- Language: Python, Go
- Licence: Apache-2.0
- Repository: https://github.com/Agent-Field/SWE-AF
- Canonical page: https://ai-tldr.dev/tools/swe-af/

## In short

SWE-AF (pronounced "swee-AF") is an open-source autonomous software engineering runtime from the team behind AgentField. It sits in the Autonomous Coding Agents category of the AI Coding tools and is open-source, written in Python, Go and licensed Apache-2.0. To get started: install the AgentField control plane.

## Overview

SWE-AF (pronounced "swee-AF") is an open-source autonomous software engineering runtime from the team behind AgentField. Instead of wrapping a single coding loop, it runs a coordinated team of specialised agents: you send one request with a goal and a repository, and a product manager agent writes a PRD, an architect and tech lead design and review the approach, a sprint planner breaks the work into a dependency graph of issues, and coder, QA and reviewer agents implement each issue before a merger, integration tester and verifier check the result against the acceptance criteria. Pointed at a GitHub repo, it ends by pushing a branch and opening a pull request.

SWE-AF is not a standalone app — it is a node that runs on the AgentField control plane, which exposes it as the `swe-planner` (and the lighter `swe-fast`) REST endpoints and handles queueing, tracing and fan-out. Issues are scheduled by dependency level and coded in parallel, each in its own isolated git worktree. Three nested control loops adapt to difficulty: a coder retries on review feedback, an issue advisor can change approach, split the issue or accept it with typed technical debt, and a replanner restructures the remaining graph when failures escalate. Builds are checkpointed so an interrupted run can be resumed.

Models are assigned per role through one flat config map. The `claude_code` runtime drives Claude, `open_code` drives OpenCode with OpenRouter, OpenAI, Google or Anthropic model IDs, and `codex` drives the OpenAI Codex CLI — so a build can, for example, use a cheap model for most roles and a stronger one for the coder and QA. Besides full feature builds, an issue-level `implement_issue` entry point skips planning and runs just the coding loop on a branch, letting another coding harness such as Claude Code delegate well-scoped issues to it. The project is Apache-2.0 licensed and marked public beta; the node ships in both Python and Go implementations.

## What it does

- Role-based agent team: PM, architect, tech lead, sprint planner, issue writers, coders, QA, reviewers, merger, integration tester and verifier, each callable as its own endpoint
- Parallel execution of a dependency-sorted issue graph, each issue in an isolated git worktree to avoid branch collisions
- Adaptive control: inner retry loop, an issue advisor that re-scopes or splits failing work, and a replanner that restructures the remaining plan
- Per-role model routing across three runtimes — Claude Code, OpenCode (OpenRouter, OpenAI, Google, Anthropic) and the Codex CLI
- GitHub workflow that clones the repo, opens a PR and runs a post-PR CI gate with a bounded fix-and-repush loop that is forbidden from skipping tests
- Checkpointed builds with `resume_build`, optional cross-issue continual learning, and an issue-level `implement_issue` entry point for use as a sub-harness

## Getting started

SWE-AF runs as a node on an AgentField control plane. The quickest route is to install it into an existing control plane with the `af` CLI; the README also documents a one-click Railway deploy, Docker Compose, and a local Python install.

1. Install the AgentField control plane

   If you don't already run AgentField, install its `af` CLI and control plane with the official script.

```bash
curl -fsSL https://agentfield.ai/install.sh | bash
```

2. Install and run the SWE-AF node

   `af install` clones the repo, provisions an isolated environment and registers the `swe-planner` node. On first run you are prompted for one LLM provider key (ANTHROPIC_API_KEY or OPENROUTER_API_KEY); add GH_TOKEN if builds should clone private repos and open pull requests.

```bash
af install https://github.com/Agent-Field/SWE-AF
af run swe-planner
```

3. Kick off a build

   Send a goal and a repository. The `af` CLI streams live progress and prints the result.

```bash
af call swe-planner.build --in '{"goal": "Add JWT auth", "repo_url": "https://github.com/user/my-repo"}'
```

4. Pick a runtime and per-role models (optional)

   Or call the REST API directly. Set `runtime` to `claude_code`, `open_code` or `codex`, and override any role in `models`; `repo_path` works instead of `repo_url` for a local checkout.

```bash
curl -X POST http://localhost:8080/api/v1/execute/async/swe-planner.build \
  -H "Content-Type: application/json" \
  -d @- <<'JSON'
{
  "input": {
    "goal": "Refactor and harden auth + billing flows",
    "repo_url": "https://github.com/user/my-project",
    "config": {
      "runtime": "claude_code",
      "models": { "default": "sonnet", "coder": "opus", "qa": "opus" },
      "enable_learning": true
    }
  }
}
JSON
```

5. Or run it with Docker Compose

   Copy the example env file, uncomment exactly one provider key, start the stack, and scale workers if needed.

```bash
cp .env.example .env
docker compose up -d
docker compose up --scale swe-agent=3 -d
```

## When to use it

- Handing a multi-issue feature or refactor to an autonomous team and getting back a reviewed, tested pull request
- Coordinating one change across several repositories, such as an app plus a shared library, with primary and dependency roles
- Delegating fully scoped issues from Claude Code, Codex or OpenCode to cheaper models through the issue-level `implement_issue` endpoint
- Running many concurrent builds as a fleet of nodes on an AgentField control plane
