Post-Training for Long-Horizon Agents: Capability Gains, Cost Control, and Open-Weight Boundaries
This article examines how increased post-training compute and multi-domain reinforcement learning turn large models into agents capable of sustained, multi-step work—and why that same shift drives token budgets and cloud costs up quickly. It breaks down the four cost drivers (input, output, tooling, and latency tiers), explains the engineering changes required for effective long-horizon training and evaluation, and outlines practical strategies for runtime infrastructure, safety boundaries, and staged open-weight release decisions. Readers will gain a checklist for selecting, deploying, and budgeting agentic models without conflating capability with uncontrolled spend.
When heavily parameterized models reach production, users usually notice two things at once: complex tasks can finally be completed end to end, and their accounts are drained almost as quickly. Describing this simply as “the model got more expensive” misses the point. What actually changed is the nature of the task: from a single question-and-answer exchange to multi-turn planning, tool calling, environment feedback, and repeated reads and writes over long contexts. Every seemingly smooth output is backed by a longer reasoning trajectory and substantially more post-training investment.
Where the Capability Leap Comes From
The industry generally splits large-model capability into pre-training and post-training. Pre-training determines the model’s grasp of language, code, world knowledge, and general foundations. Post-training determines whether the model will keep acting toward a task goal over time, rather than producing output that merely looks plausible. The common thread in the current wave of upgrades is a large increase in post-training compute, combined with extending reinforcement learning from a handful of benchmark tasks to many downstream domains: programming, retrieval and research, structured analysis, 3D or design tool use, office workflow automation, and more.
Multi-domain joint reinforcement is not “mix all the data together and train another round.” In engineering terms, at least five things must change simultaneously.
First, rewards cannot be based only on whether the final answer is correct. In long-horizon tasks, intermediate steps may be legal but drift off target, or may reach success by a convoluted path. Rewards need layering: outcome rewards, process constraints, whether tool use complies with policy, and whether there are repeated ineffective calls.
Second, environments must be reproducible. If the versions and permissions of terminals, code repositories, data sandboxes, and external tools drift, the policy learns environmental noise rather than skill.
Third, long context cannot be achieved just by increasing the window size. The keys are retrieval, compression, discarding, and re-checking earlier information during training and inference, so the model does not forget constraints or repeat already-failed paths in the later portions of a task.
Fourth, scheduling must tolerate uneven long-running tasks. Some samples finish in seconds; others run for a long time and fail repeatedly with retries. A scheduler optimized for short requests will starve long tasks or saturate the cluster.
Fifth, environment quality checks must be independent of the training loop. Dirty environments, leaked answers, and non-executable tests can drive scores up while real capability stays flat.
The shared goal of these changes is to make models stronger in environments where they can “keep working,” not merely on static question banks.
Why Budgets Burn Down First
Spend typically flows through four channels, and they compound.
Input side: With million-token contexts, system prompts, repository fragments, historical trajectories, and tool returns re-enter the context repeatedly. Cache hits can significantly reduce the cost of repeated prefixes, but once a task branches, the prefix is invalidated and the uncached portion is billed at full input rates. In practice, split stable prefixes (roles, tool descriptions, project conventions) from volatile content to improve cache reuse.
Output side: To “explain the process,” agents tend to generate overly long plans, comments, and self-justifications. For code and operations tasks, verbosity is not just a cost issue—it can obscure the actual patch or command and increase human review effort. Limit default explanation length at the product layer and put detailed reasoning in collapsible traces rather than dumping it all into user-visible output.
Tool side: Every retrieval, execution, rendering, or read-back triggers another model call. Without stop conditions, the model can loop on the same error indefinitely. Set maximum step counts, repeated-call detection, and budget circuit breakers.
Speed side: High-throughput tiers with the same intelligence level typically use more inference resources to deliver lower latency, and the unit price is often higher. Interactive programming suits high-speed tiers; offline batch processing, overnight research, and waitable report generation are more cost-effective on standard tiers. Never use high-speed tiers for unattended long-running loops.
A simple budgeting habit: first use a small sample to estimate the input, output, and tool-call rounds per “successful task,” then multiply by a failure-retry factor. If the retry factor exceeds two, fix the environment and stop conditions first, rather than simply increasing the budget.
Code and Long-Horizon Tasks: Strengths and Blind Spots
Terminal- and repository-based tasks serve as litmus tests because they simultaneously examine planning, editing, execution, and correction based on error messages. Resource-constrained real environments are closer to actual engineering than “checking whether the patch looks about right.” Evaluation should follow these rules: each task has independent tests; the environment grants only the permissions needed to complete the task; and standard answers must not be left in the working directory.
Even when aggregate scores approach the top tier, models often have uneven skills. Common patterns include: strong on algorithm problems and single-file edits but weak on cross-module refactoring and migration; able to write new features but poor at minimal-change modifications; good at explanation but poor at narrowing the search space after a test failure. If an internal long-horizon code benchmark tracks only final pass rates, it hides mid-task abandonment, excessive changes, and tests being bypassed. More useful metrics are: first-attempt pass rate, average number of files modified, ratio of ineffective commands, and at which step human takeover occurs.
Verbosity is another kind of quality defect. For financial research, code review, and 3D tool use, users want actionable conclusions and traceable evidence, not longer narratives. The output contract can be written as a fixed structure: conclusion, evidence, changes, risks, and outstanding items. Long-form output that violates this contract should be penalized in evaluation, rather than rewarded for “being more detailed.”
A lightweight task-budget check might look like this:
budget = token_capfor step in run:budget -= estimate(step.input, step.output)if repeated(step.tool, window=3) or budget <= 0:stop("need human or smaller task")if tests_pass and diff_within_policy:return success
This logic is not the interface of any specific platform; it illustrates that the circuit breaker must live in the runtime, rather than relying on the model to voluntarily economize.
Managed Runtime: Treat “Running Overnight” as Infrastructure
A long-horizon agent and a chat window are not the same product. Chat suits humans in the loop; overnight tasks need an independent runtime, often called a task skeleton or managed environment. It handles process keep-alive, permission boundaries, tool allowlists, trajectory storage, failure retries, and handoffs between agents—it is not just another layer of fancier prompts.
When building this runtime, provision it as general cloud capabilities rather than binding it to one model brand: container platforms for isolated execution, object storage for trajectories and artifacts, message queues for subtask delivery, and logging, monitoring, and alerting for timeouts, permission denials, and abnormal retries. If teams build this runtime on a cloud platform such as Baidu AI Cloud, the priorities remain permission minimization, replayability, and cost visibility—not treating model scores as the deliverable.
Multi-agent collaboration should first define role boundaries. For example, one agent handles retrieval and citation, one edits code and runs tests, and one performs acceptance. Without an acceptance role, collaboration only amplifies verbosity and repeated calls. 24/7 operation also requires an escalation path to humans: consecutive failures, access to production credentials, or output about to be published externally should automatically pause in a pending-review state.
Open Weights: Safety and Capability Proliferation
Open weights lower the barrier to adoption, support private deployment and research reproduction, and accelerate the spread of capabilities into unknown scenarios. The trade-off should not be reduced to “open versus closed”; it is a composable set of release strategies.
On the capability side, release can be tiered: base conversational and general-code weights; post-trained long-horizon agent weights; and domain adaptations bound to specific tools and data. These carry different risks and do not need to be released on the same day under the same license. Delaying the release of complete weights creates a window for safety evaluation and abuse monitoring, but the window does not replace evaluation itself.
On the safety side, three categories of risk must be covered. First, refusal and redirection for directly harmful requests. Second, dangerous operations disguised as harmless steps through long-horizon tool calls—for example, unauthorized access, bulk scraping, or destructive changes. Third, weights being fine-tuned to bypass original alignment. After release, the original vendor cannot guarantee that downstream fine-tuning preserves the same boundaries, so release materials should state clearly that the weights do not carry a guarantee of “safety certification for all downstream scenarios,” and that users must perform their own scenario assessments.
Proliferation control can be implemented through release conditions rather than technical obscurity. For example: keep high-risk tool integrations disabled by default, provide auditable system prompts and policy templates, offer abuse-monitoring recommendations for bulk inference and agent runs, and apply different licenses to research reproduction versus commercial redistribution. What is truly sensitive is not the parameter count but the combination of “model + unrestricted tools + long autonomous runtime.”
When weighing an open release, look at two tables side by side: one of capability benefits (private deployment, reproducibility, customizability, supply-chain autonomy) and one of residual risks (protections removable via fine-tuning, tool-chain amplification, copies that cannot be recalled). If the benefits mainly come from reproducible research while the risks concentrate in autonomous tool use, release the base weights openly and defer or restrict agent-specific weights and the default tool package.
Selection and Adoption Checklist
Teams should not chase the narrative of “comprehensively approaching the strongest closed-source model”; instead, they should validate against task slices.
- Long-horizon code tasks: Use small but real tickets from your own repositories; track pass rate, scope of changes, and human modification time.
- Research tasks: Check whether citations are traceable; do not judge only on prose fluency.
- Speed and cost: Run the same prompt on both standard and high-speed tiers; compare latency, success rate, and cost per run; reserve the high-speed tier for paths where a human is waiting.
- Budgets: Give agents independent budgets and circuit breakers, and avoid sharing an uncapped pool with ordinary chat.
- Open usage: First evaluate refusal, unauthorized access, and call loops in an isolated environment before deciding whether to connect internal data.
Post-training pushes models toward agents that can keep working. Infrastructure and evaluation must evolve along with them. Faster output, longer context, and more open weights become stable engineering capability—rather than a burst of spend that quickly exhausts a budget—only when budgets, stop conditions, and safety boundaries are all in place.
