Multi-Agent Team Architecture: Balancing Parallel Sessions and Long-Term Memory
This article examines the shift in multi-agent teaming from a single executor completing a task in one session to an architecture with upper-level orchestration and parallel lower-level execution. It analyzes the trade-off between parallel execution and context continuity, then discusses message ownership, Router/Worker separation, threaded subscriptions, work item delivery, and cross-session long-term memory. It also outlines practical engineering considerations for building multi-agent teams that can run tasks in parallel while keeping decisions connected across sessions.
Multi-agent teaming is moving from “a single executor completes a task in one session” toward an architecture with upper-level orchestration and parallel lower-level execution. Splitting tasks can improve execution efficiency, but it introduces a new engineering problem: the more finely tasks are divided and the more sessions are created, the harder it becomes to connect context across tasks and sessions. This article focuses on that trade-off and discusses message routing, threaded subscriptions, work item delivery, and cross-session long-term memory in multi-agent teaming.
1. Starting Point: Layered Executors and Message Ownership
A common language analogy can help illustrate the problem: in English, superscripts and subscripts indicate different levels. Mapped to an agent system, a child executor adds a layer below the main executor and handles more specific subtasks. An upper-level orchestrator adds a layer above the executor that does the work, receiving messages, dispatching tasks, and coordinating relationships across tasks. The hierarchy itself is not complex. The complexity lies in which layer a message should enter, who should process it, and how the result should return to the original conversation.
A typical internal case can be abstracted as follows: a developer asks an executor in a collaboration group to modify code according to Plan A. After the executor submits a merge request, the developer says in a code review comment, “Let’s use Plan B instead.” A human immediately understands that this comment is revising the previous decision. The system, however, first needs to map the request in the group to the merge request at hand, and then deliver the new plan to the executor that is modifying the code. If the two messages enter different sessions, the developer has to restate the earlier context. If all messages are placed in one session, the executor can see how the plan was determined and later changed, but code logs, user instructions, and execution results become mixed together, and tasks can only be processed in a queue.
Therefore, the first design decision in multi-agent teaming is not “how many executors to add,” but how to define message ownership and context boundaries: which messages belong to the same task, which belong to the same decision chain, which are simply new tasks, and which require coordination across multiple tasks.
2. Benefits and Costs of Session Splitting
The direct benefit of session splitting is parallelism. When each task gets its own session, code changes, log analysis, and result preparation can run separately without blocking one another. But splitting also causes context breaks: if two tasks involve the same decision, or if the user adds a comment in a different place, someone needs to deliver the message to the right session. In many cases, that someone is the developer with several windows open.
The trade-off can be summarized as follows: when sessions are split, tasks can run in parallel; the more they are split, the harder it becomes to reconnect the original context. The table below lists typical trade-offs at different levels of splitting granularity:
| Splitting granularity | Advantages | Risks | Suitable scenarios |
|---|---|---|---|
| All messages enter a single session | Continuous context and a complete decision chain | Tasks queue, and logs are mixed with instructions | A single task with a strong dependency on continuous discussion |
| An independent session for each task | High parallelism and execution isolation | Cross-task decisions are hard to synchronize, and users must supply prior context | Weakly coupled tasks |
| Upper-level orchestration plus independent lower-level sessions | Balances parallelism and coordination | Requires routing, threading, and memory mechanisms | Multi-task collaboration and cross-object messages |
The problem is therefore not simply whether to “split” or “not split,” but how to assign parallel execution and context continuity to different layers.
3. Router/Worker: Separating Parallel Execution from Coordination
A common architecture uses an upper-level Router to receive messages, dispatch tasks, and coordinate across tasks, while lower-level Workers operate in independent sessions. Users continue to make requests in collaboration groups and add comments in code reviews, and the system finds the Worker responsible for the matter in the background. In this way, the Worker can keep its execution context relatively clean, while the Router maintains relationships between tasks.
However, the Router must not become a bottleneck for all messages. If every code review comment has to pass through the Router before being forwarded, the time saved by parallel Worker execution may be spent waiting for messages. The Router’s responsibilities should therefore focus on identifying new tasks, assigning tasks, and handling matters that require cross-task coordination. Follow-up messages that already belong to an execution thread should go directly to the corresponding Worker whenever possible.
A simplified pseudocode example can express this division of responsibilities:
def handle_message(msg):thread = match_thread(msg) # identify thread by task, object, topicif thread and thread.subscriber:thread.subscriber.receive(msg) # follow-up messages go directly to executorreturntask = router.classify(msg) # new task or coordination requestworker = router.assign(task)worker.bind_context(build_context(task, thread))worker.subscribe(thread)worker.receive(msg)
The key point of this pseudocode is not the specific implementation, but the responsibility boundary: the Router handles “first-time dispatch” and “cross-task coordination,” while the Worker handles “execution in an independent session and consumption of follow-up messages in its assigned thread.”
4. Threaded Subscriptions: Reducing Routing and Forwarding Overhead
To reduce the Router’s forwarding load, messages under the same merge request or collaboration topic can be organized into threads. The first message is dispatched by the Router. After a Worker takes over and subscribes to the thread, new comments under that merge request can be delivered directly to it. The Router mainly handles new tasks and matters that require coordination across several work items.
Threaded subscriptions provide three benefits. First, messages have a stable owning object, such as a merge request, an issue, or a collaboration topic. Second, a Worker can continuously consume follow-up comments without going through the upper layer each time. Third, the Router can step away from high-frequency message forwarding and focus on task creation and cross-thread coordination.
However, threading only addresses continuity within the same object. If a merge request has already been merged and, a week later, the user says in a new session, “Use the plan we decided last time,” the system still needs to know which project and discussion the sentence refers to, and which plan was ultimately chosen at that time. This leads to the problem of cross-session long-term memory.
5. Work Items: From Conversation to Deliverable Results
After an authorized user makes a request, the system can create a work item, execute it in an independent session and directory, and then return the result to the original conversation, for example by submitting a merge request. A work item is the intermediate layer connecting “conversation” and “execution”: it turns a natural-language request into a trackable task entity and records the owner, execution session, associated thread, artifacts, and status.
A work item should carry at least four types of information: the source of the request and the authorization scope, the associated threads and objects, key decisions made during execution, and the final deliverables. In this way, when the user asks about progress in the original conversation, the system can return to the work item instead of guessing the context again. When multiple Workers run in parallel, the Router can also use work item relationships to determine which tasks share the same decision.
6. Cross-Session Long-Term Memory: What to Retain and When to Recall
The Router can maintain relationships between tasks, and each Worker can retain the context needed for execution. But after a session ends, which decisions are worth retaining and when they should be recalled in the future remain questions for cross-session long-term memory. Long-term memory should not be understood as “storing all chat history.” Instead, it should be designed in layers:
- Short-term context within a session: instructions, logs, and execution results for the current task, with emphasis on completeness and immediacy.
- Task-level context: work item status, associated threads, and artifact locations, with emphasis on traceability.
- Project-level decision log: plan choices, reasons for changes, and key constraints, with emphasis on auditability.
- User and authorization policies: which users can initiate actions and which operations require confirmation, with emphasis on permission boundaries.
Recall should also combine entities, time, task relationships, and decision similarity. For example, when the user says, “Use the plan we decided last time,” the system needs to first locate the project and discussion, then confirm the decision corresponding to “last time,” and if necessary ask the user for confirmation rather than executing directly. The difficulty of cross-session long-term memory is not only storage, but also recall timing, permission control, and explainability. From an architectural evolution perspective, this capability is becoming a key direction for multi-agent teaming, but its implementation still requires careful handling of retention scope and audit requirements.
7. Engineering Implementation Recommendations
First, define thread boundaries before defining session boundaries. Threads handle message continuity within the same object, while sessions handle execution isolation; the two should not be conflated. Second, the Router should perform only necessary coordination and avoid centralizing the forwarding of all messages. Third, work items should become first-class entities so that results can return to the original conversation. Fourth, long-term memory should carry sources and confidence levels, and users should be allowed to confirm recalled information. Fifth, permissions and auditing should run through the entire process of message routing, work item execution, and memory recall.
8. Conclusion
The core of multi-agent teaming is not running more executors at the same time, but establishing a manageable structure between parallel execution and context continuity. Router/Worker layering separates coordination from execution, threaded subscriptions reduce forwarding overhead, work items turn conversations into deliverable results, and cross-session long-term memory retrieves key decisions after a session ends. Only by combining these mechanisms can multi-agent teams both run fast and stay connected.
