AI Agent Architecture: From Instruction Execution to Self-Improving Systems

    This article examines the shift in AI agent design from fixed, instruction-driven workflow orchestration toward systems that accumulate reusable experience over time. It compares both routes, explains why low-friction onboarding and long-term adaptability are complementary, and covers model decoupling, skill governance, phased adoption, and key risks such as unpredictability, experience pollution, cost drift, and explainability. Developers will find practical guidance on verification loops, permission scoping, and observability needed to run the closed loop in their own environments.

    AI Agent Architecture: From Instruction Execution to Self-Improving Systems

    A recent open-source agent project passed 55,000 stars in two months. It was released in late February, added 6,400 stars in a single day in early April, and has stayed near the top of global open-source rankings since.

    The usage patterns matter more than the numbers. Some developers were still debugging its interactive interface at 3 a.m., remarking that “this thing is actually growing.” Others invested real time migrating existing workflows onto it.

    Taken together, these signals do not mean “one tool won.” They point to a structural shift on the demand side: users no longer want an automation script that runs a fixed process. They want a collaborator whose capabilities accumulate through use. That is the real battleground of the route debate.

    2. The Core Difference Between the Two Routes

    Route A: Instruction-Driven Workflow Orchestration

    The conventional approach breaks a task into nodes, then fixes the flow with conditional branches, loops, and exception handling. Its strengths are determinism, auditability, and straightforward regression testing. The weaknesses are equally clear: the flow fails as soon as it steps outside predefined boundaries, and maintenance cost grows non-linearly with the number of branches.

    Illustrative description (not a specific product interface):

    1. Task input -> Intent classification -> Branch A/B/C -> Tool call -> Result validation -> Output
    2. ↑ New scenarios require manually added branches

    Route B: Growth-Oriented Agents with Accumulating Capability

    The core of this route is not “more tools” but turning experience into reusable assets. It typically has four layers:

    1. Perception layer: Unifies context and tool descriptions so the model knows what it can do and what is currently missing.
    2. Decision layer: The model plans the steps instead of a human enumerating paths in advance.
    3. Execution layer: Invokes general capabilities such as retrieval, code execution, file read/write, and browser automation.
    4. Consolidation layer: Abstracts successful trajectories into skills, writes failed trajectories into reflection records, and builds a searchable experience base.

    The decisive difference is the fourth layer. Without it, the agent starts from zero in every session. With it, the Nth task can reuse solutions from the previous N-1 tasks. That is the engineering meaning of “growing.”

    3. Why Out-of-the-Box and Self-Improving Are Not in Conflict

    A shared trait of breakout projects is that they keep complexity internal: a single install command handles dependency setup, configuration initialization, and default skill loading. Dozens of built-in tools and nearly a hundred skills are available, and the first launch is already conversational. This solves the cold-start problem: users do not need to read three documents before running their first task.

    Self-improvement addresses what happens after a warm start. The two are complementary along a timeline:

    • The cold-start phase pursues low friction: usable defaults, rollback on failure, readable logs.
    • The long-term usage phase pursues a high ceiling: customizable skills, exportable experience, constrained behavior.

    Two traps to avoid in engineering: hard-coding all behavior for the sake of low friction, which makes later consolidation impossible; or exposing too many switches for flexibility, which makes new users give up on day one.

    4. Model Decoupling: Why Avoiding Vendor Lock-In Is a Hard Requirement

    Supporting more than 200 models and switching between cloud inference services and local inference engines with a single command is a design whose value is often underestimated. In substance, it demotes “the model” to a replaceable component, yielding three benefits:

    1. Cost control: Simple tasks run on small or local models, complex reasoning on large models, with scheduling layered by task.
    2. Risk distribution: When a single service is rate-limited or unstable, traffic can switch to a backup channel quickly to preserve availability.
    3. Compliance fit: Sensitive-data scenarios can move to local deployment so data never leaves the internal network.

    A corresponding abstraction for configuration:

    1. model_routing:
    2. default: provider_a_large
    3. fallback: [provider_b_large, local_small]
    4. rules:
    5. - when: task_type == "simple_extraction"
    6. use: local_small
    7. - when: contains_pii == true
    8. use: local_small

    5. Skill System: Turning Experience into Assets

    Skills should be governed like code, not piled up as loose prompt fragments. A recommended minimum standard:

    • Metadata: Name, applicable scenarios, input/output schema, required permissions.
    • Testability: Each skill ships with sample inputs and expected outputs, included in continuous integration.
    • Least privilege: File, network, and execution permissions granted on demand, denied by default.
    • Versioning and rollback: Skill changes carry version numbers, with fallback to the last stable version when something breaks.

    The consolidation loop can be simplified as:

    1. Execution trajectory -> Success/failure判定 -> Abstract into skill or reflection entry -> Retrieval and reuse -> Effect evaluation

    The judgment step is the most frequently overlooked. Without objective validation (unit tests, rule checks, manual sampling), what gets consolidated may be wrong experience, and it will reinforce itself.

    6. Implementation: A Phased Approach

    Phase 1: Single-point validation. Pick a task with clear boundaries and automatic validation (such as log categorization or document extraction), run it for two to three weeks, and record success rate and human intervention rate.

    Phase 2: Controlled expansion. Introduce a skill repository and permission system,固化 validated skills as team assets, and connect logging and monitoring with alerting to baseline call volume, failure rate, and latency.

    Phase 3: Platformization. Connect the agent to a unified message queue and container platform to make tasks asynchronous and elastically scalable; configure object storage to retain trajectories and artifacts for auditing and replay.

    An illustrative minimal runnable skeleton:

    1. def run(task):
    2. plan = planner(task) # Plan the steps
    3. for step in plan:
    4. result = executor(step) # Call tools under controlled permissions
    5. if not verify(result): # Objective validation
    6. reflect(task, step, result) # Write reflection
    7. return fallback(task)
    8. remember(step, result) # Consolidate experience
    9. return result

    7. Risks and Boundaries

    • Uncontrollability: Autonomous planning causes path divergence, so sandboxes, timeouts, and resource quotas are mandatory backstops.
    • Experience pollution: Wrong experience gets reused repeatedly, so skill hit rates need periodic evaluation and low-performing entries must be retired.
    • Cost drift: Multi-step reasoning multiplies calls, so budget caps and tiered degradation policies are required.
    • Explainability: Retaining complete trajectories and decision rationale is the prerequisite for troubleshooting and compliance audits.

    8. Conclusion

    The significance of 55,000 stars is not the ranking but the turning point it marks: agent competitiveness is shifting from “how complete the process coverage is” to “how fast experience accumulates.” For developers, the pragmatic path is to get the loop running with low friction first, then fill in the three pieces of infrastructure: consolidation, permissions, and observability. If an organization wants to land this capability in its own environment, it can build on general-purpose capabilities such as the container platform, object storage, logging, and monitoring with alerting offered by Baidu AI Cloud, governing both models and skills as replaceable components. The final answer to the route debate depends on whose iteration curve is steeper.