Agent Dev Teams, OpenHands and Private Coding Agents

More agents means more coordination. Isolate their work, schedule around shared files, test every merge and decide where your code is allowed to go.

BeginnerIntermediateExpert · 11 min read · Last updated:

In short

Give each agent its own working copy and branch, hand out tasks that do not overlap, and merge one at a time with the full test run after each. Add roles only when they earn their cost. For an organization, decide early where code and prompts travel, who may do what, how work is recorded and how you will tell whether it pays off.

What you will learn: team patterns, a runnable worktree and merge-queue demonstration, task scheduling, platforms such as OpenHands, private deployment choices and a rollout plan.
Prerequisites: Issue-to-Pull-Request, Debugging and TDD Workflows, Sandboxes, Safety and Security for Coding Agents and Single-Agent vs Multi-Agent Systems.

Versions used

Written in November 2026. The examples use Python's standard library and Git 2.43. Platform descriptions come from the linked project pages; we did not install the platforms.

Beginner When one agent is not enough

Reasons for more than one

ReasonGood signWarning sign
Independent tasks in parallelSeparate areas of the codeEverything touches the same files
A second opinionA fresh reviewer finds real faultsAgents agree with each other politely
Different permissionsA reader with web access, a writer withoutEveryone has every tool
Long investigationsA side search returns a short findingResults are as long as the search

Review capacity usually limits a team before agent capacity does. Five proposals an hour help nobody if your reviewers can read one.

Common roles

Plannersplits and orders work
Buildersone task, one branch each
Reviewerfresh context
Merge queue and ownertests, approval

Start with one builder and one reviewer. Add a planner when splitting work by hand becomes the bottleneck. See Supervisor and Orchestrator-Worker Patterns.

Intermediate Keeping agents out of each other's way

Worktrees and a merge queue

A Git worktree is an extra working folder attached to the same repository, with its own branch checked out. The script creates four, lets four scripted "agents" make changes, then merges them in turn. It needs Git, and sample.py from Coding Agent Architecture and Code Understanding.

"""Several agents on one repository, using real git worktrees."""
import os
import subprocess
import sys
import tempfile
from pathlib import Path

import sample

ENV = dict(os.environ, GIT_CONFIG_GLOBAL=os.devnull, GIT_CONFIG_NOSYSTEM="1",
           GIT_AUTHOR_NAME="demo", GIT_AUTHOR_EMAIL="demo@example.com",
           GIT_COMMITTER_NAME="demo", GIT_COMMITTER_EMAIL="demo@example.com")


def git(cwd, *args, check=True):
    return subprocess.run(["git", *args], cwd=cwd, env=ENV, check=check,
                          capture_output=True, text=True, timeout=30)


def tests(cwd):
    done = subprocess.run(
        [sys.executable, "-B", "-m", "unittest", "discover", "-s", "tests", "-t", "."],
        cwd=cwd, capture_output=True, text=True, timeout=30)
    return "pass" if done.returncode == 0 else "FAIL"


def edit(root, name, old, new):
    path = root / name
    path.write_text(path.read_text().replace(old, new) if old else new)


def rename(tree):
    for name in ("shop/money.py", "shop/cart.py"):
        edit(tree, name, "to_cents", "to_minor_units")


def refunds(tree):
    edit(tree, "shop/refund.py", None,
         "from shop.money import to_cents\n\n\ndef refund(amount):\n"
         "    return -to_cents(amount)\n")
    edit(tree, "tests/test_refund.py", None,
         "import unittest\n\nfrom shop.refund import refund\n\n\n"
         "class RefundTests(unittest.TestCase):\n"
         "    def test_refund(self):\n"
         "        self.assertEqual(refund(2.50), -250)\n")


def rounding(tree):
    edit(tree, "shop/money.py", "int(amount * 100)", "round(amount * 100)")


with tempfile.TemporaryDirectory() as folder:
    main = sample.create(Path(folder) / "main")
    (main / "tests/__init__.py").write_text("")
    (main / ".gitignore").write_text("__pycache__/\n")
    git(main, "init", "-q", "-b", "main")
    git(main, "add", "-A")
    git(main, "commit", "-qm", "start")
    # fix the known bug first, so later failures are caused by combining work
    rounding(main)
    git(main, "commit", "-qam", "fix rounding")
    print("main before agents      : tests", tests(main))

    jobs = {"rename": rename, "refunds": refunds,
            "ceil": lambda t: edit(t, "shop/money.py", "round(amount * 100)",
                                   "int(amount * 100 + 0.5)"),
            "decimals": lambda t: edit(t, "shop/money.py", "round(amount * 100)",
                                       "round(round(amount, 2) * 100)")}
    for name, change in jobs.items():
        tree = Path(folder) / name
        git(main, "worktree", "add", "-q", "-b", name, str(tree))
        change(tree)
        git(tree, "add", "-A")
        git(tree, "commit", "-qm", name)
        print(f"branch {name:17}: tests {tests(tree)} on its own")

    for name in jobs:
        merged = git(main, "merge", "--no-ff", "--no-commit", name, check=False)
        if merged.returncode:
            files = git(main, "diff", "--name-only", "--diff-filter=U").stdout.split()
            print(f"merge {name:18}: text conflict in {', '.join(files)}")
            git(main, "merge", "--abort")
        elif tests(main) == "FAIL":
            print(f"merge {name:18}: merges cleanly, tests FAIL, rejected")
            git(main, "merge", "--abort")
        else:
            git(main, "commit", "-qm", f"merge {name}")
            print(f"merge {name:18}: merged, tests pass")
    print("main after the queue    : tests", tests(main))

Output:

main before agents      : tests pass
branch rename           : tests pass on its own
branch refunds          : tests pass on its own
branch ceil             : tests pass on its own
branch decimals         : tests pass on its own
merge rename            : merged, tests pass
merge refunds           : merges cleanly, tests FAIL, rejected
merge ceil              : merged, tests pass
merge decimals          : text conflict in shop/money.py
main after the queue    : tests pass
OutcomeMeaning
Every branch passed aloneIsolated success says little about the combination
Clean merge, failing testsOne branch renamed a function another had started to use. Git saw no overlap
Clean merge of two edits to one fileThe changes were on different lines; tests judged the result
Text conflictTwo branches changed the same line; someone must choose
Main stayed greenThe queue tested each combination before accepting it
A worktree is not a sandbox

Worktrees share one repository's history and settings, and processes in them have the same system access. Use separate containers or machines when you need isolation.

Schedule around shared files

Preventing a collision is cheaper than resolving it. If each task declares the files it expects to change and what it depends on, a scheduler can form waves.

"""Group tasks into waves so that no two in a wave plan to change the same file."""

TASKS = {                      # task: (files it expects to change, tasks it needs)
    "fix rounding": ({"shop/money.py"}, set()),
    "add refunds": ({"shop/refund.py", "tests/test_refund.py"}, {"fix rounding"}),
    "rename helper": ({"shop/money.py", "shop/cart.py"}, {"add refunds"}),
    "tidy receipt": ({"shop/receipt.py"}, set()),
    "newsletter test": ({"tests/test_newsletter.py"}, set()),
    "cart discounts": ({"shop/cart.py"}, set()),
}


def waves(tasks, workers=3):
    done, plan = set(), []
    while len(done) < len(tasks):
        wave, claimed = [], set()
        for name, (files, needs) in tasks.items():
            if name not in done and needs <= done and not files & claimed \
                    and len(wave) < workers:
                wave.append(name)
                claimed |= files
        if not wave:
            raise ValueError("circular or unknown dependency")
        done |= set(wave)
        plan.append(wave)
    return plan


for number, wave in enumerate(waves(TASKS), 1):
    print(f"wave {number}: {', '.join(wave)}")

Output:

wave 1: fix rounding, tidy receipt, newsletter test
wave 2: add refunds, cart discounts
wave 3: rename helper

Declared files are a forecast. Check the actual diff against it, and still test every merge: the failing combination above involved different files.

Handoffs between agents

Pass onWhy
Goal and acceptance checkThe receiver can judge success
Branch and starting commitNo doubt about which code
Files in and out of scopeAvoids collisions
Decisions already madeAvoids reopening them
Command output, not only a summaryEvidence travels with the claim

Platforms: OpenHands as an example

Several products manage agents as a service. OpenHands is one open project. Its repository now describes a self-hosted control center that can run its own agent as well as Claude Code, Codex, Gemini and other agents that speak ACP, on local, Docker or virtual machine backends. Developers who want to build on it can use the Software Agent SDK, which is MIT licensed. An enterprise edition has its own release notes. Check each part's license and current features before you plan around them.

Ask of any platformWhy it matters
Where does each agent run?Sets the isolation boundary
Which models can it use?Cost, quality and data location
How are credentials supplied?Exposure if a session is compromised
What is recorded and exportable?Audit and investigation
How are limits enforced?Budget and runaway control
How do we leave?Instructions, history and integrations you keep

Running the queue

  • Update each branch to the latest main before testing it.
  • Reject, do not repair, inside the queue. Send the failure back to the owner with its output.
  • Merge small changes often, so branches drift less.
  • Put wide changes, such as renames and formatting, in their own wave with nothing else running.
  • Remove finished worktrees and branches, so stale copies are not mistaken for current work.

Hosted source control services offer merge queue features that do the testing step for you. Whichever you use, the rule is the same: the combination that reaches main is the combination that was tested.

What to watch in a running team

SignalSuggests
Frequent conflictsTasks overlap, or the code concentrates change in a few files
Clean merges that failMissing interface agreements between tasks
Growing review queueToo many builders for the reviewers
Long idle sessionsAgents waiting on questions nobody sees
Cost rising faster than merged workRetries, oversized context or unnecessary roles
Advanced Private and enterprise use

What "private" can mean

People use the word for quite different setups. Say which one you mean.

SetupCode leaves your control?You operate
Hosted product and hosted modelSent to the provider under its termsConfiguration
Self-hosted agent, hosted modelPrompts containing code still go to the model providerAgent runtime
Model in your cloud accountStays within the services you contract for; confirm regions and loggingRuntime and cloud setup
Self-hosted agent and open-weight modelCan stay inside your networkEverything, including capacity and updates

A self-hosted interface does not make the model private. Trace one request and list every place its contents travel, including telemetry, error reports, indexes and plugins. Model Routing, Fallbacks and Gateways describes a central point for model access, and Private, Air-Gapped and Sovereign Deployment covers closed environments.

Before self-hosting a model

  • Test quality on your own tasks; a weaker model may cost more in review than it saves.
  • Confirm tool calling and long context work in your serving software.
  • Size for peak use, since agents send many large requests.
  • Read the model license.
  • Plan who updates the model and the serving stack.

Governance that helps rather than blocks

AreaDecide
Approved toolsWhich products, models and tool servers are allowed
RepositoriesWhich may use agents, at which permission level
IdentityEach agent session traceable to a person or service
DataWhat must never be sent; retention periods
ReviewRequired approvals and protected paths
Intellectual propertyLegal advice on licenses and ownership
SpendingBudgets per team, with alerts
ExitHow to switch off quickly

Shared foundations

Team sessionseditors, terminals, issue triggers
Agent platformsandboxes, templates, limits
Model and tool gatewaysapproved access, logging, budgets
Source control and pipelineprotected branches, required checks

The bottom layer matters most. Protections enforced by source control and the pipeline hold whichever agent produced the change. See Agent Fleets and Internal Platforms and Agent Cost Model and Token Economics.

A rollout plan

PhaseScopeMove on when
TrialA few volunteers, low-risk repositories, a baseline recordedOutcomes and problems are understood
TeamShared instructions, templates and review rulesDefects and review load are acceptable
Background tasksSandboxed agents opening proposalsContainment has been tested
OrganizationPlatform, gateways, budgets, trainingReviewed regularly, with the option to step back
  • Record a baseline before the trial, or you cannot show change.
  • Train people to brief and review, not only to install the tool.
  • Protect time for newer developers to learn the code themselves.
  • Share instruction files and checks that worked.
  • Publish what is not allowed, with the reasons.

Keep people capable

A team still has to design, debug and explain its system when the agent is unavailable or wrong.

  • Ask authors to explain a change in their own words during review.
  • Give newer developers some tasks to write and debug themselves, with the agent as a tutor.
  • Rotate ownership of areas so knowledge does not collect in session histories.
  • Record design decisions in the repository, where people and agents both read them.
  • Rehearse working without the tool, so an outage is an inconvenience only.

Support and ownership

RoleOwns
Platform teamSandboxes, gateways, templates, upgrades
Security teamContainment tests, access rules, incident response
Engineering teamsInstruction files, checks, review and results
Procurement and legalContracts, data terms, licenses
An accountable leaderWhether the program continues, on evidence

Count the full cost

Add licenses, model usage, compute for sandboxes and builds, platform operation and, usually largest, review and rework time. Divide by merged changes that stayed merged. Compare with the baseline for the same kinds of task, using the measures in Code Review, Refactoring and Quality Measures.

Common mistakes

MistakeBetter
Many agents on one working folderOne working copy and branch each
Merging several branches at onceA queue that tests each combination
Calling a self-hosted front end privateTrace where prompts go
Scaling before review can keep upLimit work in progress
Rules that exist only in a documentEnforce them in source control and the pipeline

Questions people ask

How many agents should run at once?

No more than your reviewers and test capacity can absorb. Start with one or two and increase while quality and waiting time stay acceptable.

Can agents resolve their own merge conflicts?

They can propose a resolution. Require the full test run and a person's review, since a resolution can silently drop one side's intent.

Do we need a platform to start?

No. Worktrees or separate clones, a sandbox and protected branches are enough for a trial. A platform helps when many teams need the same controls.

Is self-hosting cheaper?

It depends on volume, hardware use and staff time. Compare cost per accepted change at your expected load, including idle capacity.

References

Next steps