Why Enterprise AI Agents Need a Layered Architecture
This article explains why deploying AI agents in the enterprise is not a choice between model capabilities and an application layer, but a matter of separating responsibilities across layers. It breaks down the model, execution kernel, application and governance, and infrastructure layers, describes the four capabilities of an execution kernel and the four capabilities of an application and governance layer, and outlines why building everything in-house tends to fail. It also provides four acceptance criteria, a reference architecture, common anti-patterns, and a phased rollout approach for moving agents from demos to auditable production systems.
Why Enterprise AI Agents Need a Layered Architecture
1. The Real Question Is Not Whether to Use Agents, but Whether the Layers Are Separated
When teams introduce AI agents, they often ask the same question: now that we have model capabilities and an intelligent coding or agent runtime, do we still need to add an application orchestration and governance platform on top?
The conclusion comes first: this is not an either-or choice, but a matter of layering. What really causes projects to fail is usually not the wrong technology selection, but stuffing different responsibilities into the same layer—filling the runtime with business logic while the business side manually maintains prompts and knowledge chunking scripts. Engineers end up constantly firefighting, business stakeholders cannot participate, and the result is a system that “runs” but cannot be delivered.
Separating the system by responsibility makes the problem immediately clear:
| Layer | Core Responsibility | Primary Roles | Typical Symptoms of Failure |
|---|---|---|---|
| Model layer | Inference and generation capabilities | Algorithm/platform engineering | Fluctuating quality, insufficient context |
| Execution kernel layer | Tool invocation, sandboxing, trace recording | Developers | Out-of-control permissions, behavior that cannot be traced |
| Application and governance layer | Orchestration, knowledge retrieval, publishing, auditing | Product/business/internal control | Changing one sentence requires a release, errors cannot be reviewed |
| Infrastructure layer | Containers, storage, logs, monitoring | Ops/security | Data leaving the boundary, difficult scaling |
2. The Execution Kernel: Making Agents Able to Act
The execution kernel is developer-facing and is essentially a controlled runtime. It needs to solve four things:
- A unified abstraction for model calls: Hide protocol differences across inference services to make switching and canary releases easier.
- Tool execution and isolation: File reads and writes, command execution, and external API calls must run in a sandbox with timeouts, resource limits, and a network allowlist.
- Reproducible traces: Chain the input, tool arguments, return results, and latency of each step into a structured record. This is the only basis for later troubleshooting and evaluation.
- Recoverable failures: After an interruption, execution can resume from a checkpoint instead of rerunning from scratch.
An illustrative runtime configuration (pseudocode, structure only):
runtime:sandbox:cpu_limit: 2memory_limit: 4Ginetwork: allowlist # Only necessary domains/IPs are allowedtimeout_seconds: 60tools:- name: doc_searchrisk: read_only- name: file_writerisk: writeapproval: required # High-risk actions require human confirmationtrace:capture: [input, tool_args, output, latency]retention_days: 30
Relying only on the execution kernel quickly turns the effort “engineer-centric”: prompts are scattered across terminals and scripts, and finance, operations, and internal control cannot participate. Being able to run does not mean being able to deliver.
3. The Application and Governance Layer: Making Enterprises Confident to Use Agents
The application and governance layer is oriented toward low-code orchestration and enterprise delivery, and needs to fill in four types of capabilities:
- Visual orchestration: Describe flows with a directed acyclic graph, where nodes include model calls, conditional branches, knowledge retrieval, tool calls, human review, and message notifications. Business users can adjust flows by dragging and dropping without changing the code repository.
- Knowledge base and retrieval augmentation: After documents are uploaded, parsing, chunking, vectorization, and index building are completed automatically, and retrieval results are assembled into the context. The key is not “having retrieval,” but being able to configure chunking granularity, recall count, reranking strategy, and citation traceability.
- Multi-model access and switching: Declare model endpoints and parameters in a configuration-driven way, supporting routing by scenario (a long-context model for long-document summarization, a low-latency model for classification).
- Publishing and governance: Applications can be published as a chat interface or an API, with version management, canary releases, quotas, permissions, and audit logs.
To align in one sentence: the execution kernel gives agents the ability to act, while the application and governance layer gives the organization the ability to use and control them.
4. Why Building Everything In-House Easily Gets Out of Control
Building the full stack of capabilities in-house (vector database, chunking pipeline, retrieval service, frontend, authentication, logging, evaluation) is functionally feasible, but the cost structure is very poor:
- Timelines are measured in months, and the MVP stage gets bogged down by infrastructure;
- Knowledge lives only in the minds of a few individuals, reviews depend on memory, and it is lost when people leave;
- Without a unified evaluation set, quality cannot be quantified, and optimization becomes guesswork;
- Security reviews repeat, and the permission model and data classification have to be renegotiated every time.
5. Four Acceptance Criteria Enterprises Actually Need
To judge whether an architecture holds up, use four hard metrics:
- Business users can replace the knowledge base themselves and have it take effect immediately;
- Adjusting prompts or flows does not require a release;
- When an error occurs, you can trace “which document segment was referenced, which tool was called, and what the arguments were”;
- Data and model calls all stay within the intranet boundary.
6. A Reference Architecture for Implementation
Models run on a private inference service, execution goes through a controlled runtime, and the front end goes through the application orchestration layer, with all three layers deployed in a self-owned environment. Infrastructure can reuse general-purpose capabilities: a container platform hosts stateless services, object storage holds documents and trace archives, a message queue handles peak shaving and decoupling, and log services with monitoring and alerting handle observability.
Recommended deployment order: first get the minimal loop of “single tool + single knowledge base” working, then introduce human review nodes, and finally connect multiple applications and quota governance.
7. Common Anti-Patterns
- Writing business branches into the runtime, so every adjustment requires a code change;
- Having no chunking or citation strategy, giving irrelevant answers with no way to locate the cause;
- High-risk tools without approval, with write operations connecting directly to production;
- Recording only the final answer and not the intermediate trace, making review impossible;
- Adding the permission model only after launch, causing security rework.
8. Conclusion
Layering does not add complexity; it puts complexity in the right place. The execution kernel is responsible for “how to run safely,” and the application and governance layer is responsible for “how it is used and audited by the business.” In practice on platforms such as Baidu AI Cloud, the common approach is likewise to use containerization, private deployment, and observability as the foundation, moving agents from demos to deliverable, traceable production systems.
