Two Approaches to AI Coding Agents: External Governance vs. Model-Native Autonomy
This article examines the two primary architectural approaches for building AI-powered coding agents: the external governance framework and the model-native agent paradigm. Rather than judging capabilities based solely on code generation speed or output quality, it proposes a comprehensive evaluation framework centered on control granularity, task closure, security governance, and operational cost. The analysis covers three implementation patterns—external governance frameworks, fixed dual-agent designs, and dynamic master–sub multi-agent systems—along with practical considerations for security, observability, failure recovery, and cost control. The article concludes with a selection matrix and an engineering checklist, arguing that a hybrid approach is often the most pragmatic choice for real-world teams.
Two Approaches to AI Coding Agents: External Governance vs. Model-Native Autonomy
When evaluating AI-powered coding tools, it is insufficient to look only at whether they can generate code and how fast they do it, nor is it fair to draw conclusions simply by comparing them against each other in a generic sense. What truly determines the caliber of such tools is their ability to close the loop on real engineering tasks, manage permissions, recover from failures, maintain auditability, and keep costs under control within an actual development environment.
Broadly speaking, the industry has converged on two architectural approaches:
- The external governance framework, which treats the large language model (LLM) as a code generation and reasoning component, with an external orchestration system managing the human–machine boundary, phase transitions, and tool permissions.
- The model-native agent approach, which internalizes planning, tool selection, and execution feedback into the model itself, allowing the model to decide when to reason, when to invoke tools, and when to decompose tasks.
These two approaches are not simply “advanced” versus “outdated.” They represent different allocations of control. The external governance route leans toward “humans manage AI, processes manage AI,” emphasizing that every step must be interruptible, approvable, and traceable. The model-native route leans toward “AI manages itself,” emphasizing goal-driven behavior, dynamic decomposition, and end-to-end task closure.
When evaluating either approach, one should consider control granularity, task closure capability, flexibility, security governance, context management, observability, cost, and failure recovery.
1. Evaluation Framework: Control First, Task Closure Second
The first question to ask about any AI coding agent is: who holds decision-making authority?
In the external governance approach, the LLM is typically responsible only for understanding requirements, generating proposals, or producing code snippets. The actual progression of phases is controlled by an independent orchestration layer. This layer decides whether planning comes before execution, whether tests run after changes, whether to retry after failures, and which files are readable or writable.
The advantage is clear behavioral boundaries. The downside is potential rigidity: when a task spans multiple phases or requires unconventional tool combinations, the orchestration logic must be manually extended.
In the model-native approach, the primary agent is granted a more complete task closure capability by default: it plans, selects tools, and adjusts strategies based on execution results. When facing complex tasks, it can spawn sub-agents on demand, each with its own context and tool permissions. The primary agent then decides whether sub-agents run in series, in parallel, or through weighted voting.
The advantage is flexibility—these agents can handle non-standard tasks. The disadvantage is that it places greater demands on model capability, runtime governance, and cost control. Without proper guardrails, the agent may generate unnecessarily complex structures.
Therefore, “quality” should not be measured by single-shot generation performance alone, but by whether the agent can reliably complete high-value tasks within a given governance constraint. A controllable but rigid solution suits high-risk, audit-heavy scenarios. A flexible but cost-volatile solution suits exploratory, complex refactoring tasks. In practice, the two approaches are more likely to be complementary than mutually exclusive.
2. External Governance Framework: Putting the Model Inside an Auditable Pipeline
The core idea of the external governance framework is: the model thinks and writes; the framework manages and controls.
The LLM is embedded within a standalone orchestration system. The system invokes the model in predefined phases: first read-only analysis, then proposal generation, then code modification, then test execution, and finally result summarization. Each phase has explicit inputs, outputs, and permission boundaries. This is equivalent to assigning a project manager to the LLM—one that decides when the model should think, when it should act, and how to roll back when things go wrong.
Strengths:
- Controllability and explainability. Because phases are fixed, logs are naturally generated step by step. Failures are easy to localize—whether the issue lies in requirement understanding, proposal design, or code modification.
- Permissions are easy to narrow. The planning phase gets read-only access; the execution phase gets write and command privileges.
- For tasks involving core codebases, production configurations, or sensitive data, the “review before execute” workflow aligns well with engineering governance norms.
Weaknesses:
- Limited flexibility. All roles and phases are predefined; they cannot be dynamically generated based on the task.
- Tasks that require iterative exploration, cross-module refactoring, or varied tool combinations may cause the fixed pipeline to stall, requiring manual intervention.
This approach is better suited for tasks with clear boundaries, higher risk, and approval gates, rather than open-ended complex exploration.
Pseudo-code illustration:
planning_agent = create_agent(role="planner", permissions=["read-only"])execution_agent = create_agent(role="executor", permissions=["write", "run-tests"])proposal = planning_agent.analyze_task(requirement)if user_requests_changes:pause_and_wait_for_approval(proposal)for each step in proposal:if user_interrupted:save_state_and_exit()execution_agent.execute_step(step)execution_agent.run_tests()if tests_failed:rollback_to_latest_snapshot_and_log_reason()
3. Fixed Dual-Agent Design: Separating Thinking from Doing
The fixed dual-agent design is a representative implementation of the external governance approach. It splits “thinking” and “doing” into two independent agent processes:
- The planning agent has read-only permissions. It examines code, writes proposals, and performs architectural design—but cannot modify any file.
- The execution agent has execution-only permissions. It implements changes according to the approved proposal and runs tests, but cannot alter the plan on its own.
The two agents exchange information through the file system or structured artifacts. The user can interrupt and modify the workflow at any point.
Key value: permission isolation and clear review checkpoints.
- The planning phase cannot accidentally modify code.
- The execution phase cannot unilaterally change the plan.
- Responsibility boundaries are unambiguous.
For teams that require “proposal first, review second, execute third,” this forced separation significantly reduces the risk of unintended modifications. It also simplifies failure recovery: both proposals and execution results are explicit artifacts, making rollback and auditing straightforward.
Limitation: all roles are predefined, so adaptation is limited. For tasks that require iterative exploration and modification, or collaboration among multiple specialized sub-agents, a fixed dual-agent setup may not be flexible enough.
This design suits scenarios where compliance requirements are high, change impact is significant, and human approval is mandatory. It is less suitable for fully open-ended, rapid-prototyping exploration tasks.
4. Dynamic Master–Sub Multi-Agent: Handing Orchestration to the Model
The model-native agent approach emphasizes goal-driven execution.
In normal operation, a single general-purpose master agent handles both planning and execution. When a task becomes complex, the master agent can spawn sub-agents on demand. Each sub-agent receives its own independent context and tool permissions. Beyond that, the master agent can define how sub-agents collaborate: serially, in parallel, through voting, or via layered aggregation. Roles are not predefined—they are tailored on the fly to the task at hand.
Advantages:
- Extreme flexibility. For tasks involving cross-module refactoring, multi-proposal comparison, parallel retrieval, or complex fault diagnosis, dynamic sub-agents can decompose a large task into smaller contexts, reducing mutual interference and enabling parallel work within scoped permissions.
- The master agent aggregates results and makes the final decision, which in theory can solve many non-standard problems.
Risks:
- Structural over-complexity. Dynamic generation may produce unnecessary sub-agents and context overhead.
- Permission sprawl. If sub-agents inherit excessive tool permissions, the blast radius of mistakes expands.
- Debugging difficulty. When failures occur, you must trace not only the final output but also the agent tree, tool invocation chain, and decision rationale.
- Cost volatility. Complex tasks can consume significant reasoning and context resources.
Because of these risks, dynamic multi-agent systems must be paired with budget limits, maximum depth constraints, concurrency caps, tool whitelists, and full audit logging. Otherwise, flexibility becomes unpredictability.
Pseudo-code illustration:
master_agent = create_agent(role="generalist", permissions=["read-only", "limited-write", "controlled-tools"])if task_complexity > preset_threshold:subtask_list = master_agent.design_subtasks(task)sub_agents = []for each subtask in subtask_list:sub_agent = master_agent.create_sub_agent(context=subtask.independent_context,permissions=least_privilege(subtask))sub_agents.append(sub_agent)result = master_agent.orchestrate(sub_agents, strategy="serial-or-parallel")else:result = master_agent.execute_directly(task)
5. Security Governance: Least Privilege and Runtime Policy Are Both Essential
Regardless of which route is chosen, security governance cannot rely on prompt engineering alone.
External governance frameworks naturally support least privilege: planning is read-only, execution is write-enabled, testing is isolated, and critical operations require approval.
Model-native agents require an additional runtime policy layer, including:
- Tool whitelists
- File access scoping
- Command sandboxing
- Sub-agent permission inheritance rules
- Second-level confirmation for sensitive operations
- Network access restrictions
- Full audit logging
When operating in managed cloud environments (such as Baidu AI Cloud), teams can integrate with general-purpose logging services, monitoring and alerting systems, and key management capabilities to strengthen audit and security. However, security capabilities should be described as general engineering practices, not tied to specific vendor interfaces. Core principle: the model can decide what to do, but the system must decide to what extent it is allowed to do it. A dynamic multi-agent system without runtime policy should never be granted direct access to high-privilege environments.
6. Context, State, and Failure Recovery
External governance frameworks typically exchange state through the file system or structured artifacts. Phases are clear, snapshots are possible, and rollback is straightforward. In a fixed dual-agent design, the proposal file and execution log themselves form a natural audit trail.
The downside is that cross-phase information transfer may be insufficient; teams must manually design the artifact format to avoid information loss.
Model-native agents use independent sub-agent contexts to reduce interference, but this introduces the need for additional aggregation protocols, conflict resolution mechanisms, and state compaction strategies. Without these, sub-agents may work in isolation and the master agent may lose critical constraints during aggregation.
Failure recovery is also more complex in the model-native approach: you need to record the agent tree, each tool invocation, context snapshots, and budget consumption to determine whether a failure warrants a retry, a rollback, or a fresh plan.
7. Observability, Debugging, and Cost
Because phases are fixed, logs and metrics in an external governance framework are naturally grouped by phase. Debugging can be localized to planning, execution, or testing steps.
In a model-native approach, observability requires tracking the agent tree, tool call chains, context propagation, and decision rationale. Without this, failures are difficult to reproduce.
Regarding cost:
- External governance tends to have predictable call counts, but may require multiple round trips between phases.
- Model-native agents may close tasks in a single pass, but complex tasks can spawn too many sub-agents, driving up inference and context costs.
Teams should set task complexity thresholds, maximum sub-agent counts, concurrency caps, and budget alerts as part of the engineering design.
8. Selection Matrix and Hybrid Architecture
| Scenario | Recommended Approach |
|---|---|
| High risk, strict compliance, core codebase, human approval required | External governance framework or fixed dual-agent design |
| Exploratory refactoring, multi-proposal comparison, rapid prototyping, complex fault diagnosis | Model-native dynamic multi-agent system |
In practice, the most pragmatic solution is a hybrid architecture:
- The outer layer uses a governance framework to handle permissions, approvals, budget, and auditing.
- The inner layer allows the master agent to spawn sub-agents on demand to complete complex local subtasks.
This configuration preserves controllability while gaining flexibility.
9. Engineering Implementation Checklist
- Task classification. Low-risk tasks may execute automatically; high-risk tasks must pass a mandatory planning review.
- Phase-based permission narrowing. Executing agents and sub-agents must follow the principle of least privilege.
- Write operational isolation. All write operations should go through sandboxes or version control; critical commands require approval.
- Budget and depth limits. Set constraints to prevent dynamic structures from spiraling out of control.
- Comprehensive logging. Record the agent tree, tool invocations, context snapshots, and cost attribution.
- Closure quality evaluation. Use regression tests and manual spot checks to assess task closure quality, not just generation speed.
10. Conclusion
Returning to the question of “capability differences”: it is not accurate to claim that one route is categorically inferior to the other.
- The strength of the external governance route lies in controllability, auditability, and governability.
- The strength of the model-native route lies in flexibility, end-to-end closure, and dynamic adaptation.
What teams must choose is not “which is stronger,” but rather “which allocation of control is more appropriate given the task risk, compliance requirements, and iteration velocity at hand.”
For most engineering teams, a hybrid architecture—external governance as an outer shell with internal dynamic agents—is often a more robust choice than committing to either extreme.
