AI Agent Architecture Evolution: From Executors to Self-Improving Systems

    This article examines the architectural limitations that emerge when gateway-first AI agent systems scale from technical demos to millions of non-technical users. It breaks down three core gaps—missing observability, hardcoded skills without feedback loops, and single-node runtimes that cannot handle multi-tenancy—and outlines a practical migration path covering state machine modeling, skill versioning and evaluation, and cloud-hosted runtime components. Readers will find concrete examples of state definitions, skill contracts, and the order in which each capability should be built.

    1. The Problem: When Agents Move from Demo to Millions of Users

    Over the past two years, agent systems have moved quickly from technical demos into real production environments. A common shape is a “gateway-first” heavy orchestration engine: a long-running resident service process at the bottom, instant messaging tools as the interaction layer on top, and a plugin system connecting to external systems below. Its core competitiveness lies in the plugin ecosystem and message routing.

    This architecture performed well with early users, who were mostly developers or technically minded operators. Take cross-border e-commerce operations as an example. Previously, someone had to visit multiple overseas sites on a schedule to collect competitor prices and then consolidate them into a table by hand. After the change, the agent could run a daily collection job, normalize fields, merge and deduplicate rows, and deliver the result to a work mailbox. All the user had to do was obtain a “web scraping plugin” and an “email sending plugin” from the open source community, complete a one-time configuration, and then issue natural language instructions in the chat window.

    The problem appears when the user base jumps from thousands to millions, and most of those users have no command line experience. The architecture’s weaknesses are amplified almost immediately.

    2. Weakness One: Missing Observability Creates “Black Box Anxiety”

    The gateway-first architecture carries an implicit assumption: users can understand the underlying runtime state. But a chat window only carries the semantics of “conversation.” The intermediate states of task execution—queuing, retrying, plugin load failures, network timeouts—all sink into terminal logs.

    A typical scenario follows. When a task stalls, the user cannot tell whether the agent is still reasoning, waiting on an external API response, or whether the process has already exited abnormally. Scrolling stack traces in a terminal are nearly unreadable for non-technical users, so they give up on self-service troubleshooting and turn to paid support, usually in the form of “uninstall and reinstall.”

    This is fundamentally a gap in observability design, not a gap in capability. Engineering practice should model the execution process explicitly as a queryable state machine:

    1. PENDING -> RUNNING -> WAITING_EXTERNAL -> RETRYING -> SUCCEEDED
    2. \-> FAILED(reason, retryable) -> COMPENSATING

    Three supporting capabilities are all required:

    • Structured logging: every task emits trace_id, current stage, elapsed time, and retry count, with fixed fields that can be aggregated;
    • Metrics and alerting: set thresholds for failure rate, end-to-end latency, and plugin cold start time, and push anomalies proactively instead of waiting for users to ask;
    • A user-facing state projection: map the internal state machine to one sentence of natural language progress (“Collecting site 2 of 5, about 40 seconds remaining”), and clearly distinguish “recoverable automatically” from “requires human intervention.”

    3. Weakness Two: Skills Are Hardcoded, So the System Cannot Grow

    In the gateway-first paradigm, capabilities are declared statically as individual skill description files, contributed by the community and installed manually. This has two consequences. First, the capability boundary equals the installed list, and it breaks as soon as the environment changes. Second, so-called “turning a colleague into a skill” actually freezes human experience into text that cannot evolve, so organizational knowledge never accumulates or iterates.

    Growth requires upgrading “skills” from static files into assets with a feedback loop:

    1. Skill registration and version governance: annotate each skill with input/output contracts, dependencies, permission scope, and a version number, with support for canary rollout and rollback;
    2. Execution trace retention: record both successful and failed samples to build a reusable experience library;
    3. Reflection and rewriting: failed tasks trigger root cause analysis and produce candidate improvements (prompt adjustments, parameter fixes, process splitting), which are promoted to an official version only after passing offline evaluation;
    4. Human-in-the-loop confirmation: high-risk rewrites must be reviewed by a human to avoid self-reinforcing errors.

    A sample skill contract can be expressed like this:

    1. skill: price_crawl
    2. version: 1.3.0
    3. input: {targets: list[url], schedule: cron}
    4. output: {rows: list[dict], report: uri}
    5. permissions: [net_outbound, mail_send]
    6. eval: {success_rate_min: 0.95, latency_p95_max: 90s}

    4. Weakness Three: A Single Resident Process Cannot Carry the Load

    A resident service plus a local plugin directory works on a personal machine. Under multi-tenancy and high concurrency, it quickly hits resource and isolation limits: plugin dependency conflicts, permission overreach, single points of failure, and state that cannot be shared across instances.

    The reasonable direction is to move the runtime into a cloud-hosted form and assemble it from general-purpose capabilities:

    • A container platform hosts the stateless orchestration layer and scales elastically per task;
    • Object storage holds skill packages and outputs, providing versioning and cross-instance sharing;
    • A message queue buffers tasks and smooths peaks, keeping retry semantics idempotent;
    • Log services and monitoring alerts provide a unified observability foundation;
    • Keys and permissions are managed by a unified configuration and credential mechanism, with plugins authorized under least privilege.

    Baidu AI Cloud is typically used in these scenarios to provide the general-purpose foundation described above, letting developers focus on orchestration logic and skill quality rather than operational details.

    5. Suggested Implementation Path

    1. Fix observability first: unify tracing and state projection so users can see what is happening;
    2. Then govern plugins: contracts, versioning, and least privilege so the system stays stable;
    3. Then introduce the feedback loop: trace retention plus offline evaluation so skills can be changed;
    4. Finally migrate to a hosted runtime: only once elasticity and isolation are in place does “scaling up” become realistic.

    6. Conclusion

    The gateway-first architecture is not a wrong choice; it does have real advantages in the plugin ecosystem and message routing. The real dividing line is whether observability and growth are addressed. Whoever makes the execution process transparent, turns skills into assets, and makes the runtime cloud native is closer to the shape of the next-generation agent platform—moving from an executor that only follows instructions to a collaborator that can correct itself and keep accumulating experience.