The shape here is a diamond followed by a loop. The folder is examples/benchmarks/04_swe_lancer_bounty.
The benchmark
SWE-Lancer (OpenAI) is 1,488 real freelance tasks from the Expensify app, priced in dollars from their Upwork postings, $1M in total. There are two task types. IC SWE tasks ask the model to write the change; they are graded by engineer-written Playwright end-to-end tests. SWE Manager tasks ask the model to read several freelancer proposals and pick the one the client chose. The public Diamond set is 502 tasks worth $500,800. Scores are reported as dollars earned.
The task used here is Diamond IC task 28565_1001, an id from the benchmark’s own README. The swarm plays both task types on it: proposals, a pick, an implementation, and the real tests.
Why this shape
This is the “N agents versus one, same information” comparison. The three proposers get an identical typed brief and have no tools, so the only difference between them is the model. The manager then does the SWE Manager task, and the implementer and QA do the IC SWE task.
┌─> proposer_claude ─┐
triager ──────┼─> proposer_gpt ────┼─> manager ──> implementer <──> qa
└─> proposer_local ──┘ patches / qa_report| Agent | Provider · model | Tools | Starts when |
|---|---|---|---|
triager | Claude · Sonnet | bash, read_file | swarm starts |
proposer_claude | Claude · Opus | none | triager done |
proposer_gpt | OpenAI · GPT | none | triager done |
proposer_local | Ollama · local coder | none | triager done |
manager | Claude · Opus | none | all three proposals done |
implementer | Claude · Sonnet | bash, read, write, edit | manager done |
qa | Claude · Sonnet | bash, read_file | manager done (depends_on), then woken by patches |
done_when = agent.qa.output.passed == true. The run’s score is agent.qa.output.payout_usd.
The swarm file
# SWE-Lancer: earn the payout on a real freelance software task.
#
# SWE-Lancer prices every task in dollars from its original Upwork posting and
# has two task types. IC SWE tasks: implement the change in the Expensify app
# so the engineer-written end-to-end tests pass. SWE Manager tasks: read
# several freelancer proposals and pick the one the client chose. This swarm
# does both on one task: three proposals from three different models, a
# manager that picks, an implementer that ships, and QA that runs the real
# tests.
#
# Shape: a diamond, then a loop.
#
# ┌─> proposer_claude ─┐
# triager ────┼─> proposer_gpt ────┼─> manager ──> implementer <──> qa
# └─> proposer_local ──┘ patches / qa_report
#
# The three proposers are separate blocks, not a for_each, because provider and
# model are fixed per block. That is how the same brief reaches three vendors
# at the same budget. The proposers have no tools, so the comparison is fair.
# The score of the run is agent.qa.output.payout_usd.
swarm "swe_lancer_28565" {
goal = "Earn the payout on SWE-Lancer Diamond task 28565_1001: ship the change in the Expensify app so the task's end-to-end tests pass"
done_when = agent.qa.output.passed == true
max_runtime = "8h"
max_cost_usd = 80
overseer = {
provider = provider.anthropic
model = "claude-sonnet-5"
}
}
provider "anthropic" {
source = "claude_agent_sdk"
api_key = "ANTHROPIC_API_KEY"
}
provider "openai" {
source = "openai_agents"
api_key = "OPENAI_API_KEY"
}
provider "local" {
source = "openai_compatible"
base_url = "http://localhost:11434/v1" # Ollama; any Chat Completions endpoint works
price = { input = 0, output = 0 } # runs locally; not in the built-in price table
}
topic "patches" { description = "Implementer: a patch is ready. Branch, diff stat, the behaviour change, the repro steps QA should follow" }
topic "qa_report" { description = "QA to implementer: the end-to-end test results for a patch, failing tests first, with the assertion and log lines" }
topic "human" { description = "Decisions the client would make: scope, ambiguous acceptance criteria, a tie between proposals" }
# Reads the task bundle and the codebase once, so every proposer gets the same brief.
agent "triager" {
provider = provider.anthropic
model = "claude-sonnet-5"
prompt = file("prompts/triager.md")
vars = {
task_id = "28565_1001"
task_dir = env("SWELANCER_TASK_DIR")
repo = env("SWELANCER_REPO_DIR")
}
tools = ["bash", "read_file"]
writes = [topic.human]
output = {
title = string
summary = string
repro_steps = list(string)
relevant_files = list(string)
acceptance = list(string)
payout_usd = number
}
}
# Three proposers, three vendors, one brief, no tools. The prompt file is
# shared; `who` is the only difference.
agent "proposer_claude" {
provider = provider.anthropic
model = "claude-opus-5"
prompt = file("prompts/proposer.md")
vars = { who = "proposer_claude" }
inputs = { brief = agent.triager.output }
output = { approach = string, files = list(string), risks = list(string), confidence = number }
}
agent "proposer_gpt" {
provider = provider.openai
model = "gpt-6.1-sol"
prompt = file("prompts/proposer.md")
vars = { who = "proposer_gpt" }
inputs = { brief = agent.triager.output }
output = { approach = string, files = list(string), risks = list(string), confidence = number }
}
agent "proposer_local" {
provider = provider.local
model = "qwen3-coder:32b"
prompt = file("prompts/proposer.md")
vars = { who = "proposer_local" }
inputs = { brief = agent.triager.output }
output = { approach = string, files = list(string), risks = list(string), confidence = number }
}
# The SWE Manager task: pick the proposal to fund. Four named inputs; the
# manager starts when all four agents are done.
agent "manager" {
provider = provider.anthropic
model = "claude-opus-5"
prompt = file("prompts/manager.md")
inputs = {
brief = agent.triager.output
claude = agent.proposer_claude.output
gpt = agent.proposer_gpt.output
ollama = agent.proposer_local.output
}
writes = [topic.human]
output = {
chosen = string
rationale = string
plan = list(string)
payout_usd = number
}
}
# The IC SWE task: implement the funded plan, iterate with QA on the board.
agent "implementer" {
provider = provider.anthropic
model = "claude-sonnet-5"
prompt = file("prompts/implementer.md")
vars = { repo = env("SWELANCER_REPO_DIR") }
tools = ["bash", "read_file", "write_file", "edit_file"]
inputs = {
brief = agent.triager.output
decision = agent.manager.output
}
writes = [topic.patches, topic.human]
watches = [topic.qa_report, topic.human]
max_turns = 40
}
# Runs the engineer-written end-to-end tests. depends_on orders it after the
# manager (nothing to test before there is a plan); inputs gives it the brief.
# Its finish decides the swarm.
agent "qa" {
provider = provider.anthropic
model = "claude-sonnet-5"
prompt = file("prompts/qa.md")
vars = {
task_id = "28565_1001"
task_dir = env("SWELANCER_TASK_DIR")
repo = env("SWELANCER_REPO_DIR")
}
tools = ["bash", "read_file"]
inputs = { brief = agent.triager.output }
depends_on = [agent.manager]
watches = [topic.patches]
writes = [topic.qa_report]
output = {
passed = bool
payout_usd = number
attempts = number
failing_tests = list(string)
}
max_turns = 20
}Key prompts
The manager is told that the benchmark’s real test is harder here, because the proposals are fresh and there is no client choice to match.
Your first turn carries four INPUTS: `brief` (the triager's) and three
proposals: `claude`, `gpt`, and `ollama`. In SWE-Lancer's manager tasks the
score is whether you pick the proposal the client chose. Here the test is
harder: the one you pick gets implemented, and QA runs the real end-to-end
tests on it.
...
Then decide. You may fold the best parts of two proposals into `plan`, but
`chosen` names one proposer and `rationale` says why in a paragraph a client
would accept. A tie is not a decision: if two are equal, publish both
summaries and your question to "human" for the record, then pick the one with
the smaller change.QA is the only agent that can end the swarm, and a person can end it early with the truthful score.
FINISH
When every end-to-end test passes, call finish with:
passed = true, payout_usd = brief.payout_usd, attempts, failing_tests = []
If a person tells you to stop (a message addressed to you on "human"), finish
with passed = false, payout_usd = 0, and the failing tests. The swarm then
ends without the payout, which is the truthful score.How a run unfolds
- The triager is the only agent without
inputs, so it starts alone. It reads the task bundle and the Expensify checkout once and finishes with a typed brief: title, summary, repro steps, relevant files, acceptance criteria, and the payout. - The brief satisfies the three proposers’
inputsand all three start at once, on three vendors. Each reads the same brief with no tools and finishes withapproach,files,risks, andconfidence. - When the third proposer is done, the manager’s four named
inputsare satisfied. It judges each proposal on whether it changes only the behavior described, stays inside the named files, handles real risks, and would merge without a rewrite. It finishes withchosen,rationale,plan, and the payout passed through unchanged. - The manager is Done, so the implementer starts with
briefanddecision, and QA starts because of itsdepends_on. QA has no patch yet and waits onpatches. - The implementer follows the plan, builds a change on a branch, and publishes to
patches. That wakes QA, which checks out the branch, runs the bundle’s Playwright command without editing tests, and publishes the result toqa_report, addressed to the implementer. - A failing report wakes the implementer, which fixes and publishes another patch. The loop continues up to the
max_turnsset on each (40 for the implementer, 20 for QA). - When every end-to-end test passes, QA calls
finishwithpassed = trueand the payout.done_whenbecomes true and the run ends. If QA is told to stop, it finishes withpassed = falseand a payout of 0.
DSL features shown
- Heterogeneous competitors at the same budget.
providerandmodelare fixed per block, so the three proposers are three blocks sharing one prompt file, withvars = { who = ... }as the only difference. Seeagent. - A diamond in the dependency graph: fan-out from the triager, fan-in at the manager with four named
inputs, then a chain. depends_onnext toinputson QA: the manager for ordering, the triager’s brief for data. See references and functions.- All three SDKs, including
openai_compatiblewithbase_urlfor a local model. Seeprovider. - A swarm whose score is a typed output field,
payout_usd.
Run it
# SWE-Lancer setup: the preparedness repo, the task image, and the task bundle extracted to a folder
export SWELANCER_TASK_DIR=/srv/swelancer/tasks/28565_1001 # issue text, price, e2e test command
export SWELANCER_REPO_DIR=/srv/swelancer/expensify # the app checkout from the task image
export ANTHROPIC_API_KEY=... OPENAI_API_KEY=... # in convoyd's environment
ollama pull qwen3-coder:32b
convoy validate
convoy run
convoy watch swe_lancer_28565
convoy say swe_lancer_28565 human "stop; take the partial" --to qaMachine assumptions
- SWE-Lancer normally runs inside its own Docker image with the internet off. Here the task bundle and the checkout are extracted to two paths the agents share, and QA runs the bundle’s test command. For a leaderboard-comparable number, run the official harness on the implementer’s branch afterwards.
- In the real benchmark the manager’s correct answer is the proposal the client chose. In this swarm the proposals are fresh, so the manager is graded the hard way: by whether the funded plan passes the tests.