Long-Horizon Agents: The Evolution Path Toward the Unattended Company

    This article examines the industry shift from human-AI collaboration toward end-to-end autonomous software delivery, with long-horizon agents and self-improving models emerging as the two central breakthroughs. It introduces a five-level autonomy ladder (L1 assistance through L5 unattended), breaks down the five capability layers of long-horizon agents (goal persistence, state and memory management, planning and replanning, context engineering, and verification), and reviews four paths of model self-improvement along with their risks. It also covers multi-agent orchestration patterns, reliability engineering practices, a capability map to underlying cloud and platform services, a three-phase adoption roadmap, an evaluation framework for proving long-horizon capability, and the key boundaries around accountability and verification. Readers will find practical guidance on building systems whose failures are recoverable before placing them on the production critical path.

    1. Industry Signals: Software Delivery Is Moving From Human-AI Collaboration to End-to-End Autonomy

    Several recent signals from the technical community point in the same direction. In a talk about the next stage of coding agents, the head of an AI coding tool vendor described exploring end-to-end, fully automated development with no human in the loop, where a team of autonomous agents closes the loop from requirement understanding to code delivery. Around the same period, a leading cloud vendor’s coding assistant product shipped agent teams plus multi-agent orchestration capabilities: a lead agent handles decomposition and task dispatch, multiple teammate agents execute in parallel, share a task list, and communicate and rework during execution. Industry discussion repeatedly points to two candidates for “the breakthrough of 2026”: long-horizon agents and self-improving large models. The former answers “can it keep working indefinitely,” and the latter answers “does it get better at the work over time.”

    These two are named together for a reason. Agents are already close to usable on short tasks: single-file refactoring, unit test generation, and defect localization can close the loop within minutes, with success rates high enough to enter production workflows. The real bottleneck is time scale. A real enterprise-level requirement often spans requirement clarification, solution design, coding, integration, canary release, observability, and rollback, taking anywhere from hours to weeks. The longer the task, the faster errors accumulate, the tighter the context constraints, and the higher the cost of a single mistake. So “long-horizon” is not an engineering optimization item but the watershed of autonomy.

    2. From “One-Person Company” to “Unattended Company”: An Autonomy Ladder Model

    Breaking the evolution path into measurable levels is more useful than debating “whether humans can be removed” in the abstract. Two dimensions can define the ladder: the human-AI division of labor and tolerable task duration.

    1. Assisted (L1): The agent completes, explains, and generates tests while a human confirms segment by segment. The benefit is mainly coding efficiency.
    2. Collaborative (L2): The agent takes on a complete subtask (such as implementing a module) while the human handles design and acceptance. Tasks fit within a single context window.
    3. Orchestrated (L3): A team of agents works together, with a lead handling planning and teammates handling execution, while the human only sets goals and constraints. Tasks can span multiple context windows.
    4. Autonomous (L4): Agents independently handle requirement clarification, solution trade-offs, coding and verification, and production observability, notifying humans only when anomalies are escalated. This corresponds to the “one-person company” form, where the human shifts from executor to rule maker and risk bearer.
    5. Unattended (L5): The full workflow runs as a closed loop within the agent system, and the human role becomes setting objective functions, auditing, and providing a fallback. This is the precise meaning of “unattended company”: not that there are no people, but that no human sits on the critical path.

    Worth noting is that the prerequisite for L5 is not a smarter model but predictable and recoverable failure modes. A system that can be trusted on the critical path must turn “failure” into an orchestrable event rather than an incident.

    3. Long-Horizon Agents: Capability Composition and Core Challenges

    A long-horizon agent is one that can maintain goal consistency, state continuity, and decision validity across cross-session, cross-context-window, and even cross-day or cross-week time scales. Its capabilities break down into five layers:

    • Goal Persistence: The task goal must not be lost when the context overflows. The goal needs to be compiled into a structured, versionable “task contract” rather than relying on model memory.
    • State & Memory: Distinguish short-term working memory, long-term semantic memory, episode memory, and a skill library. The core of long-horizon tasks is what to remember and what to forget.
    • Planning & Replanning: Long tasks cannot be planned all the way through in one pass; rolling replanning is required, and when a plan fails, the system must locate the smallest rollback unit.
    • Context Engineering: Not “stuffing in more tokens” but dynamically assembling the most relevant information for the current decision point, including retrieval, summarization, structured indexing, and compression strategies.
    • Verification: Each stage’s output must be programmatically verifiable (compiles, tests pass, contract satisfied); otherwise errors amplify exponentially along a long chain.

    A simplified long-horizon task loop:

    1. def long_horizon_loop(goal_contract, max_steps=1000):
    2. state = load_state()
    3. while not state.done and state.step < max_steps:
    4. # 1. Dynamically assemble context for the current decision point
    5. ctx = build_context(goal_contract, state,
    6. retrieve=memory.search(state.focus),
    7. summarize=compress(state.history))
    8. # 2. Generate the next action: call a tool or dispatch to a sub-agent
    9. action = agent.plan(ctx)
    10. # 3. Execute and record
    11. result = executor.run(action)
    12. # 4. Programmatic verification; on failure, trigger replanning instead of blind retry
    13. verdict = verifier.check(action, result, goal_contract)
    14. if not verdict.ok:
    15. state = replan(state, verdict.reason) # locate the smallest rollback unit
    16. memory.write(action, result, verdict)
    17. state = advance(state, verdict)
    18. # 5. Escalation: notify a human when confidence falls below threshold
    19. if verdict.confidence < state.escalate_threshold:
    20. escalate_to_human(state, verdict)
    21. return state

    The most critical design here is step 4: long-horizon tasks cannot rely on “the model judging for itself that it did it right.” There must be a verifier that is independent of the model and deterministic. This is also why, in long-horizon agent engineering practice, sandboxed environments, reproducible builds, and test gates determine success or failure more than “a stronger model.”

    4. Self-Improving Large Models: Why They Are Seen as the Most Promising

    A self-improving model is one that can use its own or the system’s operational experience to continuously reduce error rates and raise task success rates. Its promise lies in solving the fundamental dilemma of long-horizon agents: the data produced by long tasks far exceeds human labeling capacity, and if the system does not “learn” on its own, scale cannot be sustained.

    Self-improvement follows roughly four paths, in increasing difficulty:

    1. Memory- and retrieval-based improvement: Without changing parameters, write successful trajectories into long-term memory and retrieve them first for similar tasks next time. Low cost and fast results, but limited generalization.
    2. Trajectory Distillation: Distill successful multi-step execution trajectories into stronger prompting strategies, tool-selection strategies, or planning templates. This is “policy-level self-improvement.”
    3. Automated Preference Alignment: Construct preference pairs from the system’s internal success/failure signals and run preference optimization so the model favors correct paths on similar tasks.
    4. Parameter-Level Self-Improvement: A closed loop of self-generated data, self-evaluation, and self-correction that continuously updates parameters. The greatest potential, but the highest demands on data quality, anti-collapse mechanisms, and compute.

    The most dangerous failure mode of self-improvement is self-reinforcing bias: the system repeatedly trains itself on the same batch of preferences, narrowing the distribution and hardening errors. Engineering must introduce three constraints: diversity sources (different strategies, different subtask sampling), independent review (a different model or deterministic rules acting as judge), and regression benchmarks (keeping a fixed held-out evaluation set to prevent “getting worse with more practice”).

    5. Multi-Agent Orchestration: Parallelism Is a Means, Not an End

    The value of a multi-agent team is not “running multiple models at the same time” but slicing a long task into parallel, independently verifiable subtasks. Three orchestration patterns are common in practice:

    • Lead-Teammate: The lead handles goal decomposition, dispatch, and conflict merging; teammates each own independent subtasks and share a task list and artifacts. Suited to engineering tasks with clear module boundaries.
    • Generator-Critic: Generator and critic are separated, review feedback is structured, and targeted rework is triggered. Suited to high-quality outputs.
    • Pipeline: Stages are chained (analysis → design → implementation → verification → documentation), with each stage’s output feeding the next. Suited to long workflows with clear stages.

    Three engineering cautions apply. First, shared context does not mean sharing everything; full sharing causes context pollution and information overload, so the right approach is to pull by task need. Second, budgets and termination conditions are mandatory, or multiple agents fall into meaningless mutual confirmation (observable waste). Third, conflict resolution rules must be defined upfront, for example which artifact wins on a write conflict to the same file, and this must be settled at the orchestration layer rather than left for models to negotiate.

    6. Reliability Engineering: Turning “Failure” Into an Orchestrable Event

    To get a system onto the critical path, reliability design matters more than capability design. The recommended minimum practice set:

    1. Sandboxed execution: All code execution and command calls happen in an isolated environment, with no external network by default and credentials at least privilege, injected on demand.
    2. Layered verification gates: Static checks → unit tests → integration tests → contract validation; failure at any layer rolls back to the nearest checkpoint.
    3. Idempotence and recoverability: Design each action to be replayable, persist checkpoints, and let long tasks resume from any interruption point.
    4. Cost and latency budgets: Set token, call-count, and duration limits per subtask; on exceeding them, degrade or escalate to a human.
    5. Full-chain observability: Record plans, actions, tool calls, verification results, and artifact diffs to form an auditable execution log.
    6. Audit and compliance: Keep traces of key decisions and require two-person confirmation for sensitive operations (a human or an independent review agent).

    A minimal tool-call and budget-control example:

    1. @dataclass
    2. class Budget:
    3. max_steps: int = 200
    4. max_tool_calls: int = 500
    5. max_wall_clock: timedelta = timedelta(hours=4)
    6. def check(self, state) -> bool:
    7. return (state.steps < self.max_steps
    8. and state.tool_calls < self.max_tool_calls
    9. and state.elapsed < self.max_wall_clock)
    10. def guarded_call(tool, args, state, budget):
    11. if not budget.check(state):
    12. raise BudgetExceeded("Degrade: hand off to a human or produce a stage report")
    13. result = tool.run_in_sandbox(args, timeout=120)
    14. state.record(tool.name, args, result)
    15. return result

    7. Capability Map: What Underpinnings an Autonomous System Needs

    Mapping the above capabilities onto general cloud and platform capabilities yields a clear support checklist (all general capability categories, with no vendor-specific interfaces):

    Autonomy Capability Required Support Description
    Isolated execution and build Container platform / function compute / sandbox runtime Provides a reproducible, isolated, elastically scalable execution environment
    State persistence Object storage / block storage / relational database Stores checkpoints, task contracts, and execution logs
    Long-task async orchestration Message queue / workflow orchestration Decouples stages and supports retries and dead-letter handling
    Memory and knowledge retrieval Vector retrieval service / search service The recall layer for long-term memory and the skill library
    Artifacts and versioning Artifact repository / image registry / code hosting Versions artifacts to support rollback and audit
    Observability and alerting Logging service / monitoring and alerting / tracing Locates “which step started to drift” in a long task
    Cost governance Metering and billing / quota management Controls resource and call costs of long-horizon tasks

    Within Baidu AI Cloud’s capability framework, these general categories are typically realized as a combination of containers and function compute for isolated execution, object storage for state and checkpoints, message queues for stage decoupling, and logging and monitoring services for full-chain observability, with quotas and permission systems converging cost and security boundaries. It should be emphasized that the capability boundaries, quotas, and billing rules of specific products are subject to the official documentation, and hands-on validation should be done before engineering selection.

    8. Adoption Roadmap: A Realistic Schedule in Three Phases

    Phase 1 (0-3 months): Single agent plus strong verification. Pick a scenario with clear boundaries and low verification cost (such as unit test completion, defect fixing, or documentation sync), and first wire up the sandbox, checkpoints, and verification gates. This phase does not chase an automation rate; it only pursues locatable failures.

    Phase 2 (3-9 months): Orchestrated (L3). Introduce lead-teammate orchestration and a shared task list, slicing tasks into parallel subtasks. Focus on building observability and budget control, and watch whether “parallel gains” are eaten by “coordination costs” - the most common counterintuitive result in multi-agent adoption.

    Phase 3 (9+ months): Autonomous (L4) to Unattended (L5). Introduce a self-improvement loop (memory and trajectory distillation first, then consider parameter-level), and establish regression benchmarks and a human escalation channel. The core metric now shifts from “task completion rate” to mean time between human-free runs (MTBF-human-free) and the cost of recovering from a single failure.

    9. Evaluation System: How to Prove “Long-Horizon” Actually Holds

    Evaluating long-horizon agents differs greatly from conventional model evaluation. Four categories of metrics are recommended:

    • Task-level success rate (bucketed by task duration): Report success rates separately for tasks under 10 minutes, 1-4 hours, and over 1 day, and observe the decay curve. A cliff drop in success rate for tasks over 1 day indicates a structural defect in state management or verification.
    • Error accumulation rate: Errors introduced per step, reflecting the quality of context management and verification.
    • Recovery capability: Mean recovery steps and recovery success rate after injecting faults (build failures, dependency conflicts, environment anomalies).
    • Cost and human intervention rate: Token and call cost per task and human interventions per hundred steps, directly corresponding to “whether it is truly unattended.”

    At the same time, keep a fixed held-out evaluation set for regression detection during self-improvement, to avoid capability drift during self-training.

    10. Risks and Boundaries: Do Not Deify “Unattended”

    Three issues must be faced soberly:

    First, accountability cannot be eliminated by technology. When an autonomous system makes a decision with business impact, the human remains the ultimate accountable party, so audit trails and escalation channels are a hard requirement, not an option.

    Second, the capability ceiling of long tasks is bounded by the verifier, not the generator. If a domain cannot verify correctness at low cost (such as the end-to-end experience of complex interactive systems), autonomy in that scenario will inevitably progress more slowly than in automatically verifiable scenarios.

    Third, self-improvement has a ceiling and a collapse risk. Self-improvement lacking external diversity input and independent review will, over the long run, converge into “self-confirmation,” with diminishing or even negative returns. Therefore, self-improvement must be bound to three things: external data, real feedback, and fixed benchmarks.

    11. Conclusion: From “Humans With Tools” to “Humans Setting Goals”

    From “one-person company” to “unattended company,” the essence is not reducing headcount but moving humans off the task’s critical path: humans set goals, constraints, and acceptance criteria, while the system executes, self-checks, and recovers. Long-horizon agents determine how far this path can go, self-improving large models determine whether it goes fast enough, and multi-agent orchestration, reliability engineering, and observability systems determine whether it goes steadily.

    For development teams, the most pragmatic action now is to pick a programmatically verifiable scenario, make the four things solid - sandbox, checkpoints, verification gates, and full-chain observability - and then gradually extend task duration through orchestration. Only when “recoverable failure” becomes a default property of the system is autonomy truly qualified to enter the production critical path.