Qoder Cloud Agents in Practice: How RocketMQ LiteTopic Supports Large-Scale, Long-Running Agent Tasks
Qoder Cloud Agents (QCA) is a serverless cloud service for hosting and executing Agents. Qoder Cloud Agents officially released version 1.0 on September 16 and now handles more than ten million calls per month. Business applications submit objectives and context through the Agents API; QCA orchestrates model inference and tool execution, saves task progress, and returns process events and task results to the applications.

As Agents move from standalone experiments on personal computers to cloud services that handle production workloads, the central question changes: How can tasks keep running while execution resources are reserved for the steps that actually require computation?
A complete Agent task may involve model inference, tool calls, and human confirmation. After completing the current stage, the task may need to wait for an external result or additional user input. During this wait, the current execution instance may no longer be computing, but the task state must still be retained so execution can continue once the required conditions are met.
This article presents QCA's brain–hands separation architecture based on RocketMQ LiteTopic: model inference and tool execution are separated, with events handing work off so that execution resources operate on demand.

01 Challenges in Running Qoder Cloud Agents' Long-Running Tasks at Scale
1. Three Business Scenarios, One Shared Need for Continuous Execution
QCA serves three typical business scenarios:
- Agent assistants: Triggered by user requests, they deliver structured results through multistep queries and analysis—for example, investment research assistants and personal assistants;
- High-concurrency, long-running tasks: Continuously driven by business records, they identify issues and then hand them to a team for review—for example, customer service quality inspection and alert operations;
- Expert methodologies as services: Experts' methods are organized into Skills that teams can invoke and validate against shared standards.
Although these tasks differ in how they are triggered and executed, as their scale grows they all require the platform to reliably support continuously running work.

2. Task Duration, In-Flight Concurrency, and Event Rate
Assessing the pressure of running Agents at scale requires three distinct capacity metrics: task duration, in-flight concurrency, and event rate. Task duration is how long a task takes from start to completion; in-flight concurrency is the number of sessions that remain unfinished at a given time; and event rate is the number of requests or events generated per unit of time.
When tasks run for a long time and new tasks continue to arrive, ingress QPS diverges from the load the platform actually carries. Even if there are few new requests at any instant, unfinished tasks can accumulate into a large number of in-flight sessions. Some sessions are computing, while others are waiting for tool results or human input. As tasks advance, they continue to generate model commands, tool results, and progress notifications. The end of an ingress request does not mean the task is complete; subsequent work continues.
The platform therefore cannot estimate capacity from ingress QPS alone. It must also account for task duration, the number of in-flight sessions, and events generated within tasks. The platform must use limited execution capacity for current computation steps while continuously retaining the state of many in-flight tasks.

3. Decoupling Session State from Compute Resources
With many in-flight sessions at different stages, the key is not to bind one execution instance permanently to the same task, but to separate the task lifecycle from the compute lifecycle:
- The session holds the context and task progress that must be retained continuously;
- The execution instance completes the current segment of computation.
If a session remains bound to one execution instance, that instance cannot take on other tasks even after the current step has finished and is merely awaiting user confirmation. With step-level handoff, the platform allocates execution capacity only when computation is required. When a task begins waiting, the platform retains its progress and releases the execution capacity. When new input or an external result arrives, a new execution round is created, and an available instance takes over the subsequent steps.
Waiting still has a cost: session state, retained files, and foundational platform resources all incur overhead. Managing state retention separately from compute occupancy allows the platform to preserve a task's waiting state while using the released execution capacity for other work.

02 QCA's Brain–Hands Separation Architecture Based on RocketMQ LiteTopic
After separating the task lifecycle from the compute lifecycle, the next challenge is to hand model and tool steps off in an orderly manner and let different execution resources take over on demand.
QCA uses RocketMQ LiteTopic to organize task channels, separating model inference from tool execution and handing work off through events so that execution resources operate on demand.
1. Agent Runtime Coordination with Separate Model and Tool Execution Pools
In this brain–hands separation architecture, each component has a distinct responsibility:
- Agent Runtime: The coordinator that advances tasks. Based on which results are currently available and which dependencies have been satisfied, it determines whether to invoke the model next or dispatch a tool.
- Model execution pool: Handles the current model step. Model commands are delivered by message to an available instance. When inference is complete, the instance returns the model result, which may contain one or more tool requests.
- Tool executor: Handles the current tool step. It invokes remote APIs, Model Context Protocol (MCP) services, or a Sandbox on demand, and returns tool results directly to the Runtime.
- Shared persistent state: Stores history, progress, and results. Even after an individual computation ends, task facts remain available so that a subsequent instance can continue execution from them.
- RocketMQ: Asynchronously hands off model commands, model results, and tool instructions. Tool results return directly to the Runtime, which merges them, checks dependencies, and determines subsequent actions.

Once responsibilities are separated, the engineering challenges center on three areas:
1. Resumable state: When another instance takes over, it must be able to reconstruct the context required by the current step;
2. Ordered handoff: Independent branches can run in parallel, but shared results must be merged according to their dependencies;
3. Controllable execution: Work can wait when quotas are temporarily insufficient, and exceptions can be traced to a specific step.
A distributed design changes how resources are occupied and tasks are handed off; it does not automatically shorten an individual model inference or tool call. Independent execution pools can manage capacity separately, but state recovery, dependency merging, and execution policies also introduce complexity.
2. LiteTopic's Fine-Grained Business Channel Mechanism
RocketMQ LiteTopic is a lightweight channel mechanism for carrying fine-grained business messages. A Parent Topic is configured in advance to centrally manage a category of work, while the application creates LiteTopic channels according to business rules. Messages within a channel are processed in order, different channels can run in parallel, and there is no need to maintain a separate conventional Topic for every short-lived task.
This matches the workload characteristics of long-running Agents. A task's execution path unfolds continuously at runtime: the model may generate new tool requests, spawn independent branches, or wait for external events that could not be known before execution. If all tasks share a small number of channels, a long step or capacity wait in one channel may affect other tasks. Maintaining a separate conventional Topic for every short-lived task, however, would increase management overhead.
In this architecture, LiteTopic carries fine-grained business handoffs between task steps. Shared execution pools take over computation steps according to available capacity, so the number of channels does not need to correspond one-to-one with the number of execution instances. Models and tools can also use separate execution pools according to their responsibilities.
The application defines channel boundaries, LiteTopic provides ordered message handoff within each channel, and execution pools run the computation steps. For example, multibranch scenarios can assign a channel to each branch; Webhook callbacks can assign a channel to each Endpoint, providing ordered processing for the same receiver and parallel processing across different receivers.

3. Shared Message Bodies and Lightweight Consumption Indexes
Each fine-grained LiteTopic channel does not correspond to an independent copy of the message body. Even when a message targets multiple LiteTopics, its body is written to the CommitLog only once; Multi-Dispatch creates a consumption index for each target LiteTopic without copying the body.
Conventional consumption queues locate messages by Topic and Queue, whereas LiteTopic organizes consumption positions using a RocksDB-based KV index. This creates a two-tier model: the parent Topic is configured in advance, LiteTopic consumption indexes are created on demand, message bodies remain shared, and channel expiration and reclamation are managed through configuration.
Compared with maintaining a conventional Topic for every short-lived task, this approach reduces the management overhead of fine-grained business channels and is better suited to scenarios in which tasks are created continuously.

4. Suspend Defers the Current Consumption Attempt for the Corresponding Channel
With LiteTopic in place, consumers must also control when they take over work. After receiving a message, a consumer first checks capacity. If the quota is insufficient, it returns Suspend, deferring the current consumption attempt for the corresponding channel and retrying on a later delivery. If capacity is available, it executes the current step, produces that step's complete result, and acknowledges successful consumption.
Suspend pauses only the current consumption attempt for the corresponding channel; other independent channels can still be processed in parallel. Pending messages remain in the messaging system, and consumer instances can continue serving tasks that are currently executable.
Quota settings, task priorities, and retry timing are still determined by application policy. The messaging system provides handoff and consumption control, while execution policies must be formulated around business constraints.

03 Asynchronous Execution Flow for Complex QCA Tasks
1. Message Relay Between Models and Tools
In one complete execution round:
- The Runtime first publishes a model command, which RocketMQ delivers to the model execution pool;
- The model completes the current step. Its returned result may contain one or more tool requests, and RocketMQ hands the model result back to the Runtime;
- The Runtime merges the model result, registers dependencies, and then publishes tool instructions, which RocketMQ delivers to the tool executor;
- When tool execution finishes, the result is returned directly to the Runtime;
- Once all dependencies are satisfied, the Runtime generates the next model command and continues inference with the tool results.
The entire process uses relay-style execution: task progress is continuously saved, execution resources handle only the current step, and subsequent steps are scheduled by the Runtime.

2. How Complex Scenarios Advance
Complex scenarios use the same handoff mechanism: execution instances can change between computation steps, while persistent state retains task relationships and progress.
- Multibranch collaboration: Model commands for each branch are independently consumed and executed in parallel by the model execution pool. Results return to the Runtime, which merges them by session; subsequent steps proceed once all dependencies are satisfied.
- Collaboration and cancellation: Collaboration messages enter a persistent Mailbox and are processed when the task reaches a boundary at which it can accept new messages. Cancellation is delivered through an independent control notification: the cancellation state is updated first, and then the related execution is terminated.
- Webhook callbacks: A LiteTopic is created for each receiving Endpoint, providing ordered processing for the same receiver and parallel processing across different receivers, while also constraining timeout and retry budgets.
- Suspension and resumption: When a task waits for a user, tool, or sub-Agent, the Runtime first saves its progress and dispatches subsequent steps after the relevant event returns.

3. On-Demand Sandbox Execution and Persistent Task Progress
After model inference and tool execution are separated, a Sandbox can also be used on demand. Pure model inference is handled by the model execution pool; remote API and MCP calls are initiated by the tool executor and run by the corresponding remote services; a Sandbox is prepared only when isolated code or file tools are needed.
The extent of prewarming, reuse, reclamation, and recovery after suspension depends on policy and backend capabilities. Retaining files does not mean the original process can be restored exactly as it was. The core value of using a Sandbox on demand is to reduce waiting time during which a Sandbox need not be occupied—not to guarantee lossless restoration of the execution environment.
Across the complete architecture, task facts are held in persistent storage: a database stores session and task state, while object storage stores files and artifacts. Ephemeral control signals such as cancellation and process previews are used for control and observability, not as the primary store of task facts. Ingress, coordination, handoff, execution, and persistent state each have distinct responsibilities and together form the execution foundation.
Whether to adopt this separation should be evaluated against task duration, the proportion of time spent waiting, state recovery requirements, whether ordering boundaries can be divided by business unit, and whether the benefits of capacity isolation can offset the complexity of a distributed system.

Conclusion: Keep Tasks Running and Compute on Demand
This QCA × RocketMQ LiteTopic implementation does not attempt to shorten an individual model inference or tool call. Instead, it addresses how long-running tasks can continue to advance: task facts are retained, model and tool steps can be handed off, independent branches can run in parallel, and only the relevant channel is deferred when capacity is insufficient. RocketMQ carries the stateful portion of cloud Agents, allowing Agent compute clusters to remain stateless and rapidly scale horizontally, supporting greater concurrency and capacity.
Through persistent state, asynchronous handoff, and fine-grained consumption control, this implementation preserves the progress of waiting tasks while allowing available instances to continue taking on steps that genuinely require computation.
If you are building a similar architecture for running long-running Agents, we welcome further discussion of LiteTopic implementation practices and the boundaries of its applicability.
📖 Learn about the RocketMQ for AI solution
Read previous post:
Qoder × AgentLoop: As Agent Adoption Scales, How Can Sensitive Data Protection Keep Pace?
-
-
Alibaba Cloud Native Community
845 posts | 61 followers
Follow
Comments
-
-
Alibaba Cloud Native Community
845 posts | 61 followers
Follow
Related Products
-
Qoder
From Assisted to Autonomous — Adapting to Every Programming Need
Learn More -
Token Plan
Build more, spend less. One plan, every modality.
Learn More -
QwenWork
QwenWork is dedicated to helping employees strengthen their professional competitiveness in the AI era and to enabling enterprises to improve organizational effectiveness.
Learn More -
DeepSeek
DeepSeek-V4.1-Flash is the lightweight flagship of DeepSeek's new architecture family, packing 552B total MoE parameters to deliver flagship-surpassing intelligence across key benchmarks.
Learn More
More Posts by Alibaba Cloud Native Community
- Qoder × AgentLoop: As Agent Adoption Scales, How Can Sensitive Data Protection Keep Pace?
- From HTTP 200 to the First Valid Output: How AI SSE Synthetic Monitoring Quantifies the Streaming Experience
- 2026 Agent Developer Survey Report | Alibaba Cloud AI Agent Handbook
- Routine Work Stays Local, Hard Turns Go to the Cloud: A Test Run with Qwen3.8-27B, the d3 Decision Model and Qwen4-Max
- RocketMQ for AI: LiteTopic-Based Agent Asynchronous Communication Architecture and Production Practice
- The Data Foundation for Agent Self-Improvement: Alibaba Cloud SLS Session Store
- QwenWork × AgentBridge: Connecting Enterprise Data and Bringing Intelligent Analysis Within Reach
- AgentTeams 1.2.8: A Brand-New Workbench and Website—Start Team Collaboration with One Click
- From Generation to Decision: An Empirical Evaluation of Decision Models for AgenticOps