Multi-Agent Collaborative Development: Engineering Practices for Building Software Tools from Scratch

    A practical guide to multi-agent software development: how to decompose tasks, orchestrate planner, executor, verifier, and reviewer roles, run parallel work in isolated workspaces, and build verification and quality-gate loops that make LLM-generated code reliable. Includes architecture patterns, task decomposition principles, retry policies, common risks, and adoption advice for engineering teams.

    Multi-Agent Collaborative Development: Engineering Practices for Building Software Tools from Scratch

    1. Background

    Software development involves a large amount of repetitive work: building UIs, integrating APIs, writing sample tests, and completing documentation. As large language models have grown stronger at coding and reasoning, a new working style has matured: break a large goal into many subtasks, assign each to a separate agent, and coordinate them through a scheduling layer. This approach differs from one-shot conversational generation — it works more like a small engineering team.

    When a single model handles long tasks, three problems commonly appear. First, early constraints tend to get lost in long contexts. Second, code style and naming conventions become inconsistent across stages. Third, models struggle to objectively verify their own output. The value of a multi-agent structure is that it splits context into smaller scopes, so each agent handles clearly defined inputs and outputs, while tests and reviews converge the results into a usable state.

    2. Basic Architecture

    A typical multi-agent development system includes four roles:

    • Planner: reads the requirements document and produces a task list with dependencies.
    • Executor: picks up a single task and writes or modifies code in an isolated workspace.
    • Verifier: runs unit tests, static checks, and integration tests, and outputs structured verification results.
    • Reviewer: reviews changes against the requirements spec and the code diff, and decides whether to merge.

    A scheduling layer sits above these roles. It maintains the state of each task (pending, running, passed, failed) and controls how many executors run concurrently. Here is illustrative code for task state and readiness checks:

    1. Task:
    2. task_id # unique task identifier
    3. spec # task description and acceptance criteria
    4. depends_on # list of task_ids of prerequisite tasks
    5. status # pending / running / passed / failed
    6. function ready_tasks(tasks):
    7. done = { t.task_id for t in tasks if t.status == "passed" }
    8. return [ t for t in tasks
    9. if t.status == "pending" and set(t.depends_on) <= done ]

    Each round, the scheduling layer picks up ready tasks and assigns them to idle executors. Only tasks whose dependencies have all passed enter execution. This prevents code from being written against unfinished interfaces.

    3. Principles of Task Decomposition

    Task decomposition quality directly determines output quality. In practice, four principles help.

    Clear boundaries. Every task needs explicit inputs, outputs, and acceptance criteria. For example, “Implement a file list component that supports sorting by name and passes the five given test cases” is far easier to verify than “Build a file management feature.” Vague boundaries force executors to fill in assumptions, and those assumptions often conflict with other modules.

    Moderate granularity. A single task’s changes should be reviewable in one pass — typically a few hundred lines or fewer. Tasks that are too large make failures hard to localize; tasks that are too small make scheduling and merging overhead exceed actual coding time.

    Explicit dependencies. Interfaces should be defined before implementations. A recommended practice is to have the planner first produce interface definition files — function signatures, data structures, and error codes — and then let different executors implement their own modules. The interface files serve as the single source of truth that all executors follow.

    Avoid shared mutable state. Two executors should never modify the same file simultaneously. If unavoidable, serialize those tasks or split the shared part into a separate task.

    4. Parallel Execution and Workspace Isolation

    Parallelism is the main source of efficiency gains in multi-agent systems, but it also introduces conflicts. The recommended approach is to give each executor its own working branch or directory, so executors only change code within their own workspace.

    Merging is serialized and handled by the scheduling layer. Before each merge, the system re-runs the relevant tests against the latest main branch. If code conflicts appear, the system should not let an agent directly overwrite another’s changes. Instead, it should generate a conflict report, attach both sides’ intent descriptions, and return everything to the planner for a new decision. The reason: conflicts usually reflect inconsistent understanding of interfaces, and plain text merging cannot solve that.

    5. The Test and Review Loop

    Generators tend to be overly optimistic about their own output, so verification must be independent of generation. Verification should be split into three layers:

    1. Unit tests: check the behavior of functions and modules, covering normal paths and edge cases.
    2. Integration tests: check whether interfaces between modules match.
    3. End-to-end scenarios: simulate real usage flows, such as “open a file, edit it, save it, reopen it, and confirm the content matches.”

    Verification results should be returned in a structured form: pass/fail status, names of failing cases, and summaries of key logs. Unstructured, lengthy logs increase the cost of subsequent fixes. Failed tasks enter a repair loop with a maximum retry count:

    1. MAX_RETRIES = 3
    2. function process_task(task, implement, verify):
    3. for attempt in 1..MAX_RETRIES:
    4. patch = implement(task, feedback = last_report)
    5. report = verify(patch)
    6. if report.passed:
    7. return "passed"
    8. last_report = report
    9. return "needs_review"

    Tasks that exceed the retry limit are escalated to humans rather than looping forever. This rule effectively controls cost and promptly exposes ambiguities in the requirements themselves.

    6. Quality Gates and Human Involvement

    Before merging to the main branch, the system should enforce explicit quality gates. Common gates include:

    • The project compiles or builds completely.
    • All tests on critical paths pass, meeting an agreed coverage floor.
    • Static analysis reports no high-severity warnings.
    • The reviewer gives an approval.

    Human involvement should focus on high-risk checkpoints rather than line-by-line review of all output. Typical checkpoints include requirement changes, architectural decisions, permissions and identity-related code, data migration scripts, and modules touching security boundaries. Placing human effort at these points keeps critical decisions reliable while maintaining high throughput.

    7. Typical Application Scenarios

    Scenario 1: Small tools for a specific team. Examples include internal image processing tools, video editing assistants, or data dashboards. The difficulty here is translating users’ habits into clear interaction specifications. In practice, first compile a list of common operations — frequency, inputs and outputs, and shortcuts — then have the system generate the UI and command mappings from it. Final acceptance should use real work tasks, not demo cases.

    Scenario 2: Low-level system prototypes. Building an operating system prototype from an empty directory requires partitioning the kernel, memory management, file storage, device drivers, graphical interface, and installer into modules. Projects of this scale and dependency depth are well suited for testing a multi-agent system’s long-horizon coordination. Their value lies mainly in learning and validation; they should not be used directly in production, since security, stability, and hardware compatibility take years to accumulate.

    Scenario 3: Formal verification. Mathematical proofs can be transcribed into a form a computer can check step by step. Agents split lemmas and write proof steps, while an independent checker determines whether each step holds. The key here is the source of trustworthiness: the reliability of the final conclusion comes from the checker, not the model generating the proof. Therefore, the checker itself must be thoroughly validated and kept independent of the generation pipeline.

    8. Limitations and Risks

    Multi-agent development is not free of costs. The main risks include:

    • Context drift. In long-running tasks, interface agreements may gradually deviate from the original design after multiple rounds of changes. Use versioned interface documents as the sole reference and check interface consistency before every merge.
    • Testing blind spots. If tests and implementations are written by the same type of agent, both may share the same misunderstanding. Key acceptance cases should be written by humans or an independent process.
    • Cost and time. Parallel execution significantly increases model calls and compute consumption. Set budget caps based on task value and record the actual cost of each task.
    • Security risks. Generated code may contain injection vulnerabilities, insecure default configurations, or dependencies with known CVEs. Use it alongside static scanning, dependency auditing, and code review.
    • Licensing and compliance. Generated code may conflict with third-party library license terms. Before adding a new dependency, check its license type and keep the necessary provenance records.

    9. Adoption Recommendations

    Teams introducing a multi-agent development workflow can proceed in these steps:

    1. Pilot with small modules. Choose modules with clear boundaries and few dependencies, such as data format conversion or form validation, to verify that the workflow itself is reliable.
    2. Build the acceptance case library first. Before letting agents write code, have humans prepare a set of acceptance cases covering the main scenarios. This set defines the system’s quality floor.
    3. Keep complete decision logs. Record every task’s inputs, outputs, verification results, and failure reasons. The logs serve both for retrospectives and for improving task templates.
    4. Increase concurrency gradually. Only after confirming merge conflicts are manageable should you increase the number of concurrently running executors.
    5. Regularly review failure patterns. Track the types of failed tasks — interface mismatches, missed edge cases, insufficient tests — and use the findings to refine planning prompts and task templates.

    The core of multi-agent development is making the engineering process explicit: tasks must have boundaries, dependencies must be recorded, and results must be independently verified. The clearer the process design, the easier the agents’ output is to inspect and control.