Two Agent Architectures in AI Coding Tools: Model-Native vs. External Control Frameworks

    This article compares two dominant agent architectures in AI coding tools: the model-native agent route and the external control framework route. It explains how each one differs in control, predictability, flexibility, and permission governance, and breaks down two common implementations of the external route: fixed-role dual agents and dynamically generated master-subordinate multi-agent systems. A side-by-side comparison and practical selection guidance help teams choose the right architecture for production changes, exploratory work, and hybrid setups.

    1. Why Agent Architecture Matters More Than the Model

    As AI coding tools evolve quickly, a common pattern is emerging: the capability gap between foundation models is narrowing, while the real difference in user experience comes from the agent architecture built around the model. The same model, wrapped in different scheduling and permission designs, can behave either as a “fully human-directed automation script” or as an “autonomous executor that figures things out once given a goal.”

    This article abstracts two technical routes widely seen in the industry: the model-native agent route and the external control framework route. It then takes a closer look at two typical implementations of the latter: fixed-role dual agents and dynamically generated master-subordinate multi-agent systems.

    2. The Mental Model Behind the Two Routes

    A simple way to build intuition: one route is “humans manage the AI,” and the other is “the AI manages itself.”

    • External control framework route: Control stays with the human. Users can precisely constrain each step, and the model behaves more like a “code generator.” A separate, auditable scheduling layer decides when to think, when to execute, and how to roll back on errors.
    • Model-native agent route: Control stays with the model. Users only describe the final goal, and the model decides which capabilities to invoke and in what order. It is like attaching hands and feet directly to the “brain,” with scheduling logic internalized in the model’s behavior and no separate external scheduler.

    Neither route is inherently better. The real trade-off is between controllability and autonomy.

    3. Route One: How Model-Native Agents Work and Where They Fall Short

    The core idea is to bake capabilities such as tool calling, task decomposition, and reflection-and-retry directly into the model through training and alignment.

    The advantages are clear: short chains, coherent context, and natural interaction. The model has the most complete information when deciding the next step and is less likely to get stuck due to rigid rules in an external scheduling layer.

    The costs are equally clear: behavior is less predictable, and the same input may not produce the same path. Permission boundaries rely on the model’s own restraint, so engineering safeguards such as sandboxes, read-only mounts, and command allowlists are needed as a fallback. Cost and step counts are also hard to estimate.

    4. Route Two: Two Implementations of the External Control Framework

    4.1 Fixed-Role Dual Agents

    This approach fully separates “thinking” from “doing” into two independent processes:

    • Planning agent: Read-only permissions. It reads code, writes plans, and handles architecture design, but cannot modify any files.
    • Execution agent: Execution-only permissions. It modifies code and runs tests according to the plan, but has no authority to change the plan on its own.

    The two exchange artifacts through the file system (plan documents, task lists, diff summaries), and the user can step in to revise at any stage. Roles are predefined and cannot be generated dynamically.

    1. User goal
    2. -> Planning agent (read-only) produces plan.md
    3. -> Human review / revision
    4. -> Execution agent (read/write + execute) produces patch + test report
    5. -> On failure, roll back to the planning agent with the failure logs

    The strengths are high controllability, least-privilege permissions, and easy auditing and team collaboration. The weakness is limited flexibility: for cross-module, open-ended problems, the plan can easily become rigid.

    4.2 Dynamically Generated Master-Subordinate Multi-Agent Systems

    By default, there is a single, all-capable master agent that plans and executes on its own. When facing a complex task, the master agent writes code on the fly to create specialized sub-agents. Each sub-agent has an independent context and a restricted toolset, and can orchestrate collaboration itself (serial, parallel, or voting).

    1. # Example: the master agent dynamically spawns restricted sub-agents at runtime
    2. sub = spawn_agent(
    3. role="test_writer",
    4. tools=["read_file", "write_test", "run_test"], # least privilege
    5. context=task.slice("tests/"),
    6. )
    7. result = orchestrate(parallel=[sub, other_sub], strategy="vote")

    The strength is extreme flexibility, making it suitable for exploratory tasks with unclear structure. The weakness is that it may generate redundant structures, consume extra tokens, and make debugging and reproduction harder.

    5. Comparison Across Key Dimensions

    Dimension Model-Native Fixed Dual Agents Dynamic Multi-Agent
    Control Model Human Model (constrained by framework)
    Predictability Low High Medium
    Flexibility High Low Very high
    Permission governance Relies on external fallback Naturally least-privilege Requires runtime checks
    Cost control Weak Strong Medium-to-weak
    Suitable tasks Goal-driven iteration Production changes, compliance scenarios Exploration, cross-repo refactoring

    6. Selection Guidance and Implementation Essentials

    1. Prioritize controllability for production changes: For online configuration, database migrations, and permission-related code, choose fixed-role separation and enforce a mandatory human review gate.
    2. Prioritize flexibility during exploration: For technical research and getting familiar with an unfamiliar codebase, use dynamic multi-agent systems to gain coverage.
    3. Always add engineering safeguards regardless of the route: Container sandboxes, a read-only root file system, command allowlists, full operation logs, and rollback-able snapshots.
    4. Drive optimization with an observability loop: Feed each task’s step count, failure points, and number of human interventions into logging services and monitoring alerts to enable quantifiable improvement.
    5. A hybrid architecture is often best: Use fixed roles at the outer layer to guarantee boundaries, and allow dynamic spawning within specific sub-tasks at the inner layer, balancing safety and efficiency.

    7. Conclusion

    Choosing an architecture is essentially choosing a governance model: deciding who bears the responsibility for decisions. Understanding these two routes and their implementation forms matters more for long-term engineering returns than chasing a single model’s benchmark score. In engineering practice on platforms such as Baidu AI Cloud, combining least-privilege permissions, full-chain observability, and elastic compute is the reliable path to bringing intelligent coding into production environments.