Long-Horizon Agent Models at Trillion-Parameter Scale: Post-Training and Engineering Practice

    This article explains how trillion-parameter long-horizon agent models are built and deployed. It covers post-training compute and reinforcement learning across many domains, long-context inference with million-token windows, sandboxed task execution with checkpoints and rollback, evaluation metrics for task-level success, and cost and governance practices for production use.

    As large language models move from single-turn question answering to sustained task execution, long-horizon agents are becoming a key test of a model’s engineering capability. Tasks such as code generation, 3D tool calling, financial research, and terminal operations often require a model to keep state across million-token contexts, decompose goals, call tools, verify results, and roll back and retry after failures. These abilities are hard to gain by scaling pretraining alone. They depend on post-training compute, broader reinforcement learning (RL) coverage, long-context inference optimization, and an infrastructure loop made up of sandboxes, scheduling, evaluation, and managed services.

    A recent capability upgrade in a class of trillion-parameter models reflects this trend. The model reaches the trillion-parameter scale and supports million-token contexts. It puts particular emphasis on code, 3D creation, financial research, and long-horizon agent capabilities, and it comes with a high-speed version and a managed agent service. Setting aside specific product names, the technical approach behind it is worth examining in detail.

    1. Capability Upgrade: Post-Training Compute and RL Domain Expansion

    Gains in long-horizon agent capability first show up in the post-training stage. Pretraining determines a model’s basic knowledge and language ability. Post-training determines whether the model can follow complex instructions, use tools, stay consistent over long tasks, and avoid drifting off course in multi-step work. Increasing post-training compute and extending RL to hundreds of downstream domains effectively expands the coverage of “verifiable task environments.”

    More post-training compute usually means more rounds of trajectory sampling, finer-grained reward modeling, stricter result verification, and joint training on more domain data. Extending RL to hundreds of domains requires a training system that can manage sampling costs, reward sparsity, and task difficulty distributions across different environments. Without environment quality checks, low-quality tasks amplify reward noise. The model may then learn to take shortcuts instead of solving problems.

    Three engineering points matter most:

    1. Task curriculum and sampling strategy: Task difficulty varies widely across domains. Sampling should be stratified by success rate, step count, and tool-call complexity, so that simple tasks do not dominate training.
    2. Verifiable rewards and process constraints: Code tasks can be verified with test cases, and terminal tasks can be verified with state checks. Financial research tasks require citation consistency, correct calculations, and format constraints. Process rewards should penalize reasoning that is long but ineffective.
    3. Preventing forgetting and keeping capabilities balanced: Large-scale RL can make a model lopsided. Mixing in foundational data, applying length penalties, and retaining general instruction data help prevent declines in general Q&A and short-task performance after gains in code or agent tasks.

    This is why over-specialization and verbosity remain ongoing concerns for these models. Long tasks naturally encourage a model to write more, think more, and call more tools. Production environments, however, care more about cost per task and first-pass success rate. During post-training, metrics such as effective step ratio, tool-call success rate, and human takeover rate should be part of the optimization target, not just final answer accuracy.

    2. Long-Context Inference: Million-Token Windows Require More Than Memory

    The value of a million-token context lies in holding long documents, code repositories, task histories, and tool outputs. But as context grows, inference cost, latency, and attention noise become harder to control. Practical deployments usually combine several techniques: prefix caching, tiered caching, context compression, retrieval augmentation, segmented summarization, and externalized state.

    A common design is to bill cache hits and cache misses separately. Cache hits significantly reduce the cost of repeated context, which suits multi-turn conversations, polling in long tasks, and fixed knowledge bases. Cache misses mean the model must re-encode the long context, which costs more. For this reason, teams should not treat a million-token window as free capacity. They should set context governance policies:

    • Apply prefix caching to stable system prompts, tool descriptions, and knowledge snippets.
    • Summarize historical trajectories in segments, keeping only key decisions and failure causes.
    • Use reference IDs for large tool outputs and fetch them on demand instead of loading everything into the context.
    • Set checkpoints in long tasks and persist state to external storage, rather than appending conversation history indefinitely.

    The high-speed version also shows that inference services are being tiered. The standard version suits difficult, long-horizon, and batch tasks. The high-speed version uses continuous batching, parallel decoding, operator fusion, and memory optimization to increase output speed while keeping intelligence largely intact. It is better suited to interactive programming, real-time terminal operations, and agent pipelines with frequent polling. Enterprises should choose a model tier based on task value rather than sending every request to the highest-end configuration.

    3. Sandboxes and Scheduling: The Foundation for Running Long-Horizon Agents

    The biggest difference between a long-horizon agent and a regular API call is that the agent keeps taking actions that change its environment. Code execution, file operations, browser operations, and 3D tool calls all need isolated sandboxes. A sandbox must provide resource quotas, timeout controls, network access policies, snapshot recovery, and audit logs. The scheduling system must support task queuing, priorities, concurrency control, and failover.

    A workable long-horizon task state machine usually includes planning, execution, observation, verification, rollback, and checkpointing. The following pseudocode, which does not depend on any specific product, illustrates the loop:

    1. task = {
    2. goal: "Complete a multi-step code fix and verify it",
    3. context_ref: "long_context_handle",
    4. max_steps: 200,
    5. sandbox: {cpu: 4, memory_gb: 16, timeout_s: 3600},
    6. checkpoint_every: 10
    7. }
    8. while not task.done and task.steps < task.max_steps:
    9. state = load_checkpoint(task)
    10. plan = model.plan(goal=task.goal, state=state, tools=available_tools)
    11. action = validate_action(plan.next_action)
    12. result = sandbox.execute(action)
    13. check = verifier.check(result, task.goal)
    14. save_trace(task, action, result, check)
    15. if check.failed:
    16. task = rollback_to_last_checkpoint(task)
    17. else:
    18. save_checkpoint(task)

    This pseudocode highlights three engineering principles: every action must be validated, every result must be verified, and every failure must be recoverable. For tasks that run around the clock, multi-agent collaboration and task sharding are also needed. A planning agent decomposes the goal, an execution agent makes tool calls, a review agent checks results, and a scheduler handles timeouts and resource reclamation. The value of a managed agent service is that it provides the execution framework, state storage, sandboxes, and observability as cloud infrastructure. This lowers the barrier for enterprises that would otherwise need to build their own long-running environments.

    At the infrastructure layer, teams can combine general-purpose services from Baidu AI Cloud, such as its container platform, object storage, log service, and monitoring and alerting, to build sandbox execution, state persistence, and an observability loop. The key is not the number of components. Each task should have a unique identifier, a complete trajectory, a resource record, and a documented failure reason.

    4. Evaluation: From Single-Point Scores to Task-Level Pass Rates

    Long-horizon agents cannot be evaluated on single-turn answers alone. Programming tasks in real terminal environments usually require the agent to complete complex operations under constrained resources, and each task comes with dedicated tests. These evaluations are closer to production conditions because they measure code comprehension, command execution, error recovery, and result verification together.

    When building an evaluation system, enterprises should cover at least the following metrics:

    • Task pass rate: Track first-attempt pass rate and pass rate after multiple retries separately.
    • Average steps and effective-step ratio: Identify verbose or ineffective tool calls.
    • Resource consumption: CPU, memory, duration, and token cost.
    • Rollback rate and human takeover rate: Measure the stability of autonomous execution.
    • Safety violation rate: Unauthorized access, dangerous commands, and data leakage risks.
    • Long-horizon consistency: Whether the goal drifts after crossing checkpoints.

    Public benchmark scores are useful only as a reference. For production, combine offline benchmarks, online shadow traffic, and small-traffic A/B tests, and evaluate each business task family separately. For code tasks, focus on test pass rates and regression risk. For financial research tasks, focus on data citations, calculation steps, and whether conclusions can be traced back to their sources. For 3D tool-calling tasks, focus on parameter validity and asset consistency.

    5. Service Forms and Cost Governance

    Models of this type usually offer a standard API, a high-speed API, and a managed agent service. The standard version bills cached input, uncached input, and output separately. The high-speed version costs more but offers better throughput. Enterprises should set up a model routing strategy: send high-value, complex tasks to the standard version, send high-frequency interactive tasks to the high-speed version, and handle batch offline tasks through asynchronous queues with cache reuse.

    Cost governance can start in four areas. First, compress system prompts and tool descriptions to raise the cache hit rate. Second, set maximum step counts and budget caps for long tasks to prevent endless retries. Third, store large files, logs, and intermediate artifacts in object storage and pass references instead of contents. Fourth, build cost dashboards by task, tenant, and model tier so that abnormal calls are detected quickly.

    6. Implementation Recommendations and Governance Checklist

    A layered architecture is recommended. The access layer handles authentication and rate limiting. The orchestration layer manages the task state machine. The model layer handles planning and tool selection. The sandbox layer isolates execution. The state layer stores checkpoints and trajectories. The observability layer provides logs, metrics, and alerts. The governance layer enforces security policies and cost quotas. Before launch, select one or two verifiable scenarios and build a closed loop, then expand to other domains gradually.

    The governance checklist includes the following: all tool calls must be allowlisted; dangerous operations must require secondary confirmation; long tasks must have timeouts and budgets; failed trajectories must be replayable; model outputs must pass a result verifier; sensitive data must not enter unauthorized sandboxes; and managed agent services must clearly define tenant isolation and audit boundaries.

    Overall, competition among trillion-parameter long-horizon agent models has shifted from parameter count to systems work: post-training environments, inference systems, sandbox scheduling, and evaluation and governance. Only when a model’s capabilities sit inside an engineering loop that is verifiable, recoverable, and observable can a long-horizon agent move from demonstration to production.