From Centralized Routing to Closed-Loop Learning: AI Assistant Architecture Evolution

    This article compares two mainstream AI agent architectures: centralized message-routing assistants and closed-loop learning agents. It examines their request flows, structural strengths and weaknesses, memory and tooling design, migration cost and portability, scenario-based selection criteria, implementation risks, and a vendor-neutral cloud deployment combination. Readers will gain a practical framework for deciding whether an assistant architecture is worth adopting and how to keep migration and replacement costs low.

    1. Starting Point: Assistants Rise Fast and Fade Fast

    Over the past two years, the AI assistant space has repeated a familiar cycle: a project gains traction through a very low installation barrier, the community quickly produces many similar implementations, and then attention fades. For developers, this rhythm creates a practical question: is it worth paying migration costs for “yet another assistant”?

    Whether a new architecture deserves investment should not depend on its marketing language. It should depend on whether it solves the structural defects of the previous generation of solutions. This article abstracts the two mainstream agent architectures currently in use, compares them, and offers actionable guidance on selection and deployment.

    2. Paradigm One: Centralized Message-Routing Assistant

    The core of this architecture is a message-routing layer. It receives messages from various instant messaging platforms, email, or web endpoints, performs unified parsing, calls a large model, and then routes the model output and tool execution results back to the original channel.

    Its request chain can be summarized as:

    1. Message ingress → Message parsing → Context assembly → Model call → Tool execution → Response routing → Message egress

    The advantages are clear:

    • The chain is short and semantically clear; during troubleshooting, instrumentation at each segment can locate the problem.
    • It integrates naturally with existing collaboration channels and has low retrofit cost.
    • The stateless design makes horizontal scaling simple, and instances can be restarted at will.

    The defects are equally clear: each conversation turn has an independent context, and tool execution ends when the turn ends. Nothing is retained. When the user makes a similar request the second time, the system still starts from zero. Preferences that were corrected once, pitfalls that were encountered, and scripts that were validated are all destroyed with the session. This means the capability growth curve is flat: spending more time using the system does not translate into a stronger task completion rate.

    3. Paradigm Two: Closed-Loop Learning Agent

    The new generation of architecture redefines “conversation” as a loop with persistent state, rather than a stateless request. Its skeleton usually consists of three parts:

    1. ┌──────────────────────────────────────────────┐
    2. │ Agent Main Loop (Conversation Orchestration │
    3. │ and Decision-Making) │
    4. └──────────────────────────────────────────────┘
    5. │ │ │
    6. ▼ ▼ ▼
    7. Prompt Builder Tool Registry Session Store
    8. (Dynamic (Capability (Persistence +
    9. Assembly) List) Retrieval)

    3.1 Prompt Builder: Turning “Memory” into Context

    The prompt is no longer a fixed template. Before each request, it is dynamically assembled according to the current task: system constraints + long-term preferences + relevant historical snippets + available tool descriptions. The key is to inject only relevant snippets; otherwise, the context will be crowded by irrelevant memories, and both cost and latency will worsen.

    3.2 Tool Registry: Pluggable Capabilities

    Tools are declared as registry entries with a name, purpose description, parameter schema, and permission boundary. The main loop exposes them to the model on demand. Tool sets are usually grouped by scenario (file operations, retrieval, network access, code execution, etc.) and can be trimmed by session or by user. This avoids the higher selection error rate caused by “stuffing all tools into the prompt at once.”

    Illustrative registration structure:

    1. def register(name, description, schema, handler, group="general"):
    2. TOOLS[name] = {
    3. "desc": description,
    4. "schema": schema,
    5. "handler": handler,
    6. "group": group,
    7. }
    8. def build_prompt(user_id, task):
    9. return "\n".join([
    10. SYSTEM_CONSTRAINTS,
    11. load_preferences(user_id), # long-term preferences
    12. recall_relevant(task, top_k=5), # relevant historical snippets
    13. render_tool_specs(groups_for(task)),# trimmed tool list
    14. ])

    3.3 Session Storage: Full-Text Search + Structured Records

    The persistence layer often uses an embedded relational database together with a full-text search index. It writes each conversation turn, tool call, and result to disk and supports keyword recall. For scenarios with higher semantic recall requirements, vector retrieval can be added as a supplement. From an engineering perspective, dual-channel parallelism is recommended: keyword search handles exact hits (error codes, file names, function names), vector search handles fuzzy semantic matching, and the results are then fused and deduplicated.

    3.4 Where the Loop Closes

    The loop is closed by a “review write” at the end of a task: explicit user corrections, failure causes, and reusable steps are extracted into structured entries and written back to the memory store. When the next similar task begins, this content flows back into the context through the prompt builder, forming a positive feedback cycle of “execution—feedback—retention—re-execution.”

    4. Migration Cost: Portability Should Be an Architecture Metric

    Whether a new architecture is accepted depends heavily on exit and entry costs. A well-designed agent system should decouple user assets from the runtime environment, so that configuration, memory, skills, and credentials can be exported and imported in a declarative way, with migration completed by a single command.

    Portability design points:

    • Separate configuration and data: Parameter files, the memory store, and the skills directory should be independent, making version management and backup easier.
    • Plaintext declarative configuration: Readable, diffable, and suitable for version control.
    • Credentials not stored in the database: Keys should be stored only as references (such as environment variables or secret manager handles). Migration moves references, not plaintext.
    • Capabilities as files: A skill is a directory. Adding a capability means adding a file, without changing the main loop.

    It is worth noting that cross-architecture migration is almost never semantically equivalent: a routing-based system has no memory layer, so migration is essentially “initialization” rather than “transfer.” A reasonable expectation is that configuration and credentials can be migrated, while historical context must be accumulated again.

    5. Selection Advice: Choose by Scenario, Not by Hype

    Scenario characteristic More suitable paradigm Reason
    Short interactions such as customer service, notifications, and approvals Centralized routing Stateless, easy to scale, good observability
    Personal long-term assistant and repetitive tasks Closed-loop learning Memory retention brings increasing marginal returns
    Strong compliance requirements and data cannot leave the domain Either paradigm, but private deployment is required The key is deployment form, not architecture
    Multi-team collaboration Routing + shared memory layer Balances isolation and knowledge reuse

    For ordinary users, the criterion is simple: if usage is “one-off question answering,” the benefits of a closed loop are limited; if there are many repetitive tasks that require remembering preferences, the memory layer is where the real value lies.

    6. Four Risk Categories That Must Be Handled During Implementation

    1. Credential security: Keys should go through environment variables or a secret management service and must not be written into the memory store or logs. Memory files should be treated as sensitive data and stored encrypted.
    2. Memory pollution: Validate and deduplicate before writing. For conflicting entries, retain timestamps and sources to prevent incorrect conclusions from being repeatedly recalled and amplified.
    3. Least privilege: Authorize tools by group. Restrict file and network access to directory and domain allowlists. Run code in an isolated sandbox.
    4. Cost and observability: Set an upper limit on prompt length. Record token consumption and tool latency for each turn. Configure logging services and monitoring alerts. Use real metrics rather than gut feeling to judge architecture quality.

    7. General Cloud Deployment Combination

    For long-term stable operation, a vendor-neutral general capability combination is recommended: a container platform hosts the main loop and tool sandboxes; object storage saves backups of the memory store and skill packages; a message queue smooths peaks and decouples channel access; logging and monitoring handle tracing and anomaly detection; credentials are managed by a dedicated secret hosting capability. This combination applies to both architectures. The difference is that a closed-loop system needs additional capacity and backup planning for persistent storage.

    8. Conclusion

    The dividing line in architecture competition is not whether installation takes one command. It is whether the system can turn usage into its own capability. Centralized routing wins on simplicity and reliability, while closed-loop learning wins on long-term compounding. The rational approach is to first clarify whether tasks are repetitive and whether preferences need to be remembered, then choose the paradigm. At the same time, credential isolation, least privilege, and observability should be incorporated into the design from the beginning, keeping migration and replacement within a low-cost range.