Engineering Long-Horizon Tasks: From Multi-Agent Collaboration to Formal Verification

    This article examines how AI coding systems can move beyond single-response generation toward sustained engineering delivery. It discusses why operating system prototypes expose coordination and dependency challenges, how multi-agent systems should organize planning, execution, verification, and integration responsibilities, and why long-running tasks require explicit persistent state and recovery mechanisms. It also covers the additional proof burden of production migration, the distinction between generating a proof idea, producing a reviewable argument, and passing formal verification, as well as practical metrics for evaluating results and cost. Finally, it outlines a risk-controlled adoption path for enterprises that starts with small, verifiable closed loops rather than full codebase autonomy.

    1. The Technical Focus Is Shifting from Single Responses to Continuous Delivery

    Evaluating intelligent coding capability used to mean asking whether a model could complete a function, explain an error, or fix a defect. Today, the more important question is whether a system can continue advancing complex engineering work under conditions where requirements are not fully clear, code keeps changing, and tools may fail, and then deliver results that can be independently verified.

    The source material describes long-cycle tasks such as multi-agent construction of an operating system prototype and migration of production services. These accounts are instructive, but their scale, duration, and performance figures lack complete experimental conditions. They should not be treated directly as engineering conclusions that already hold universally.

    In particular, two types of information need to be distinguished. One type is technical methods that can be transferred to real projects, such as task decomposition, parallel execution, and automated verification. The other type is results that depend on a specific environment, such as the completion time of a task, the number of participating agents, and performance improvement multiples. The former can be analyzed. The latter need to be checked against the test environment, code scope, human effort, and acceptance records.

    Understanding long-horizon capability therefore requires more than asking “how strong is the model?” It also requires asking:

    • Can the work objective be decomposed into tasks with acceptance criteria?
    • How do multiple executors maintain interface consistency?
    • How does the system detect failures and recover?
    • Who confirms the final result, and against what standard?

    These questions determine whether agents can move from demonstrations to delivery.

    2. Why an Operating System Prototype Is a Representative Engineering Task

    Operating system development involves multiple layers, including processor state management, memory management, interrupt handling, device access, file organization, and user interaction. It requires not only code generation but also different modules running together under strict constraints.

    For example, the storage module and the file system must agree on read and write units, error return conventions, and caching strategy. Input devices and the interactive interface need a unified event format. The kernel and applications need clear permission boundaries and resource access rules.

    The difficulty of such tasks lies less in code volume than in dependencies. A change to a low-level interface may affect multiple upper-layer components. A concurrency error may appear only under a specific execution order.

    “It can boot” is therefore only the most basic acceptance result. It does not mean the system is mature or usable. A more complete evaluation should be divided into at least four layers:

    Layer 1: Build and startup.
    Can the code be repeatedly built in the declared environment, and can the system reliably enter the expected state?

    Layer 2: Basic functionality.
    Do storage, input, networking, and interaction have defined test scopes, rather than succeeding only in a single demonstration?

    Layer 3: Exceptions and recovery.
    When facing invalid input, resource exhaustion, device errors, or unexpected interruption, can the system maintain consistency or exit safely?

    Layer 4: Security and maintenance.
    Is permission isolation reasonable? Are critical operations audited? Can problems be located? Is subsequent modification likely to introduce regressions?

    The value of an operating system prototype is that it exposes the coordination problems of complex projects. It should not replace full quality evaluation with a single successful boot.

    3. The Key to Multi-Agent Collaboration Is Organization, Not Count

    Increasing the number of agents does not necessarily increase delivery speed. If tasks are highly coupled, large-scale parallel execution can instead lead to interface conflicts, duplicate implementation, and integration congestion.

    A workable collaboration system usually needs several types of responsibility.

    1. Planning responsibility: turn goals into a dependency graph

    The planner first needs to define the delivery scope, then split the project into work units with inputs, outputs, and acceptance conditions.

    For example, “implement file storage” is still too broad. It can be further divided into block device abstraction, directory organization, file read and write, exception handling, and consistency testing. Each task should state what it depends on, which areas it modifies, and what result it produces.

    The ideal splitting standard is not that tasks should be as small as possible, but that each piece of work can be completed within a limited context and checked independently.

    2. Execution responsibility: implement within a controlled scope

    Executors should receive the minimum sufficient information, including requirement descriptions, interface contracts, relevant code, and test entry points.

    Each agent should not be allowed by default to modify the entire codebase arbitrarily. Shared interfaces, build configuration, and security-sensitive areas should have stricter modification procedures; otherwise, local optimization may break global constraints.

    3. Verification responsibility: inspect results, not accept self-reports

    “Already completed” is only the executor’s status declaration, not acceptance evidence.

    Verification should check code diffs, run logs, test results, and boundary cases. For important modules, a relatively independent review process can also re-analyze the correspondence between requirements and implementation.

    But independent review is not an absolute guarantee. Different agents may share similar blind spots, so deterministic checks, human review, and real execution results must be combined.

    4. Integration responsibility: maintain global consistency

    The integrator handles interface changes, merge conflicts, and cross-module issues, and controls the size of changes entering the mainline.

    For projects with many low-level dependencies, it is usually more robust to establish a minimal runnable loop first and then add functionality incrementally, rather than letting modules develop independently for a long time and assembling them all at the end.

    4. Long Tasks Must Have Recoverable Execution Mechanisms

    Continuous execution over several days should not be understood as one session maintaining correct reasoning throughout. In real environments, tool calls may time out, execution processes may exit, context may be lost, and external dependencies may change.

    A long-task system therefore needs to persist key state explicitly rather than hoping the model remembers all history.

    The following information should be recorded:

    • Current objectives and acceptance criteria;
    • Completed tasks and their verification evidence;
    • Unresolved issues;
    • Current code version and build artifacts;
    • Interface decisions and reasons for changes;
    • Failed operations, retry counts, and remaining budget;
    • Items requiring human approval.

    Task state can follow a schematic flow such as:

    Pending → Running → Pending verification → Passed
    Running → Failed, pending handling → Retry or replan
    Pending verification → Verification failed → Return for repair

    This is only a general process example, not a fixed interface for any particular system.

    Two engineering principles are easy to overlook.

    First, retry is not recovery. If an operation produces external side effects, such as sending notifications, modifying permissions, or deleting resources, repeating it may create new problems. Such operations need explicit deduplication, confirmation, or compensation mechanisms.

    Second, checkpoints must be verifiable. Saving only a “summary of current progress” is not enough to restore the engineering situation; the corresponding code version, test status, and necessary artifacts must also be saved.

    5. From Code Generation to Production Migration, an Additional Burden of Proof Is Required

    Migrating an existing service to another implementation approach is often used to demonstrate intelligent coding capability. But the difficulty of production migration is not translating syntax; it is preserving behavior and controlling release risk.

    1. Define “behavioral equivalence” first

    An unchanged external interface does not mean the service behavior is fully consistent. The following also need to be checked:

    • Whether error types and exception handling are consistent;
    • Whether timeout, cancellation, and retry semantics are preserved;
    • Whether there are differences in time, numeric, and string processing;
    • Whether concurrent execution changes the order of results;
    • Whether configuration, logging, and monitoring information remain complete.

    These details are often more likely to cause production incidents than the main business logic.

    2. Performance improvements must state their measurement basis

    Startup time, request latency, throughput, and memory usage are different metrics. A significant improvement in one metric does not automatically imply an equivalent improvement in overall performance.

    For example, faster startup may come from reduced dependency loading, a shorter initialization path, or a changed runtime environment, not only from a change in implementation language. A rigorous report should specify hardware conditions, workload type, number of test runs, cache state, and statistical method.

    3. The rollout process must be reversible

    A more reliable migration path is to establish a behavioral baseline for the old implementation, compare the new implementation offline, and then gradually validate real workload behavior where permissions and data compliance allow.

    Stop conditions should be defined in advance, such as abnormal error rates, degraded latency, or inconsistent results. Rollback mechanisms should also be rehearsed, not merely written into a plan.

    Agents can take on implementation and testing work, but authorization and responsibility for production changes cannot be omitted because of that.

    6. Mathematical Proof Tasks Must Distinguish Three Levels

    The original title mentions completing a famous mathematical theorem proof within a limited time, but the body does not provide corresponding proof materials, verification process, or independent review basis. It therefore cannot be claimed on that basis that the relevant task has been completed.

    A more rigorous way to discuss agent mathematical capability is to distinguish the following three levels.

    The first level is generating a proof idea.
    The system provides a derivation route or a natural-language argument. Such results may be instructive, but they may also omit conditions, confuse definitions, or contain logical gaps.

    The second level is forming a complete reviewable argument.
    The proof needs to clearly state the definitions, lemmas, and premises used, ensuring that every step can be checked by a professional.

    The third level is passing formal verification.
    The proposition and derivation are expressed as strict formal objects and checked by a proof checker according to given rules.

    Even when formal verification is passed, it is still necessary to confirm whether the formalized proposition accurately corresponds to the original problem, which axioms and external assumptions were used, and whether the proof depends on existing results.

    Therefore, “generated a seemingly complete proof,” “filled in several steps of an existing proof,” and “independently completed a full formal proof” are three statements that cannot be used interchangeably.

    7. How to Evaluate Results and Cost

    A single benchmark cannot cover real engineering tasks. A more useful evaluation system should consider task outcomes, resource consumption, and human intervention at the same time.

    At minimum, the following should be recorded:

    • Delivery success rate: the proportion of tasks that meet predefined acceptance criteria;
    • End-to-end time: the time from submitting a requirement to accepting the result;
    • Human intervention: time spent by people clarifying, reviewing, and repairing;
    • Rework and regression: cases where changes are returned or introduce new problems;
    • Unit effective delivery cost: the total cost actually invested to obtain an acceptable result.

    Cost includes not only inference calls but also tool execution, test environments, storage, review, and failed retries.

    There are also limits to increasing concurrency. As the number of executors grows, coordination and integration overhead often rises. When downstream verification capacity is insufficient, more agents merely generate a longer review queue.

    A reasonable strategy is therefore usually to allocate resources according to task risk: clear, low-risk tasks use a lighter process; cross-module design and complex failure analysis receive stronger reasoning; high-privilege operations add human approval and independent verification.

    The optimization goal should be “obtain acceptable delivery at an acceptable cost,” not simply pursuing the highest reasoning intensity or the largest concurrency.

    8. Enterprise Adoption Should Start with Small Closed Loops

    Enterprises should not begin by letting agents take over an entire codebase. A more reliable entry point is tasks with clear boundaries, automatically checkable results, and limited failure impact, such as adding tests, fixing local defects, and performing controlled refactoring.

    Initial practice can follow this sequence:

    1. Select a representative task set and define success and failure criteria.
    2. Establish an isolated execution environment and restrict network, credential, and file access.
    3. Fix the requirement, testing, and review process, and record all operations.
    4. Compare agent results with existing human processes.
    5. Analyze failure causes before deciding whether to expand the task scope.

    Permission control is especially important. Being able to read code does not mean an agent should have production release permission; being able to generate a data processing script does not mean it should have direct access to sensitive data.

    Content from documents, web pages, or code comments may also contain instructions that attempt to change the task objective. The system should treat external material as data to be analyzed, not as automatically accepted operational authorization.

    Conclusion: Long-Horizon Capability Must Ultimately Become Verifiable Delivery

    The technical value of multi-agent collaboration is not to let more executors generate more code at the same time. It is whether complex objectives can be transformed into a stable, traceable, and recoverable engineering process.

    An operating system prototype tests module coordination. Production migration tests behavioral equivalence and release governance. Mathematical proof tests the completeness and checkability of arguments. All three scenarios point to one principle: the generation process may be uncertain, but acceptance criteria must be as explicit as possible.

    For developers and enterprises, what is more worth building is not the illusion of unsupervised “full automation,” but a delivery system that starts from clear objectives, relies on verification evidence, and is bounded by permissions and budgets. Only when results can be repeatedly built, independently checked, and safely recovered after failure do long-horizon agents truly have sustainable engineering value.