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.
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.
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.
Reasons for more than one
| Reason | Good sign | Warning sign |
|---|---|---|
| Independent tasks in parallel | Separate areas of the code | Everything touches the same files |
| A second opinion | A fresh reviewer finds real faults | Agents agree with each other politely |
| Different permissions | A reader with web access, a writer without | Everyone has every tool |
| Long investigations | A side search returns a short finding | Results 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
Start with one builder and one reviewer. Add a planner when splitting work by hand becomes the bottleneck. See Supervisor and Orchestrator-Worker Patterns.
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
| Outcome | Meaning |
|---|---|
| Every branch passed alone | Isolated success says little about the combination |
| Clean merge, failing tests | One branch renamed a function another had started to use. Git saw no overlap |
| Clean merge of two edits to one file | The changes were on different lines; tests judged the result |
| Text conflict | Two branches changed the same line; someone must choose |
| Main stayed green | The queue tested each combination before accepting it |
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 on | Why |
|---|---|
| Goal and acceptance check | The receiver can judge success |
| Branch and starting commit | No doubt about which code |
| Files in and out of scope | Avoids collisions |
| Decisions already made | Avoids reopening them |
| Command output, not only a summary | Evidence 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 platform | Why 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
| Signal | Suggests |
|---|---|
| Frequent conflicts | Tasks overlap, or the code concentrates change in a few files |
| Clean merges that fail | Missing interface agreements between tasks |
| Growing review queue | Too many builders for the reviewers |
| Long idle sessions | Agents waiting on questions nobody sees |
| Cost rising faster than merged work | Retries, oversized context or unnecessary roles |
What "private" can mean
People use the word for quite different setups. Say which one you mean.
| Setup | Code leaves your control? | You operate |
|---|---|---|
| Hosted product and hosted model | Sent to the provider under its terms | Configuration |
| Self-hosted agent, hosted model | Prompts containing code still go to the model provider | Agent runtime |
| Model in your cloud account | Stays within the services you contract for; confirm regions and logging | Runtime and cloud setup |
| Self-hosted agent and open-weight model | Can stay inside your network | Everything, 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
| Area | Decide |
|---|---|
| Approved tools | Which products, models and tool servers are allowed |
| Repositories | Which may use agents, at which permission level |
| Identity | Each agent session traceable to a person or service |
| Data | What must never be sent; retention periods |
| Review | Required approvals and protected paths |
| Intellectual property | Legal advice on licenses and ownership |
| Spending | Budgets per team, with alerts |
| Exit | How to switch off quickly |
Shared foundations
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
| Phase | Scope | Move on when |
|---|---|---|
| Trial | A few volunteers, low-risk repositories, a baseline recorded | Outcomes and problems are understood |
| Team | Shared instructions, templates and review rules | Defects and review load are acceptable |
| Background tasks | Sandboxed agents opening proposals | Containment has been tested |
| Organization | Platform, gateways, budgets, training | Reviewed 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
| Role | Owns |
|---|---|
| Platform team | Sandboxes, gateways, templates, upgrades |
| Security team | Containment tests, access rules, incident response |
| Engineering teams | Instruction files, checks, review and results |
| Procurement and legal | Contracts, data terms, licenses |
| An accountable leader | Whether 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
| Mistake | Better |
|---|---|
| Many agents on one working folder | One working copy and branch each |
| Merging several branches at once | A queue that tests each combination |
| Calling a self-hosted front end private | Trace where prompts go |
| Scaling before review can keep up | Limit work in progress |
| Rules that exist only in a document | Enforce 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
- Git worktree documentation
- OpenHands repository
- OpenHands Software Agent SDK
- Paper on the OpenHands Software Agent SDK
- OpenHands Enterprise release notes
Next steps
Lab: Least Privilege, Authentication and RBAC
Practice containment.
Agent Fleets and Internal Platforms
Build shared foundations.
Securing, Evaluating and Running Multi-Agent Systems
Operate several agents reliably.