Enterprise AI Agent Architecture: Four Structural Boundaries to Build On
This article explains four architectural boundaries for building an enterprise-grade AI agent platform: a single agent domain model with pluggable capabilities, three independent version tracks, six layers with enforced one-way dependencies, and a five-level state ID scheme backed by a dual-aggregate data layer. It includes the reasoning behind each boundary, sample schema and dependency layout, and the cost and governance problems these constraints prevent.
Introduction: Why Agent Platforms Drift Into Disorder
When teams deploy AI agents inside an enterprise, almost all of them go through the same cycle of scope creep. In week one, the business side only wants an internal Q&A window that can search policy documents and look up runtime logs. By week three, the monitoring, alerting, and ticketing teams want that entry point embedded in their existing console, automatically carrying the current application name, cluster identifier, and ticket context when it opens. In week five, engineering and release teams ask for open interfaces or an SDK with zero framework intrusion, so they can call the agent for risk assessment at change gates. By week seven, frontline developers and operators want the same controlled operations capabilities and code repositories available inside their local AI coding tools, without switching browsers.
If you take these requests one by one out of inertia, split them into four separate product lines, and then create mutually disconnected entities in the backend following whatever concept is currently popular — a “Q&A agent,” a “knowledge retrieval agent,” an “orchestration agent,” a “tool service agent” — then within three months you will inevitably face fragmented permission systems, gray-release rules that each go their own way, tool parameters that must be synchronized across four places after a single change, and a monthly token bill that cannot be reconciled.
What determines whether a system ends up solid or turns into a swamp is usually not some clever runtime trick, but the static skeleton laid down on day one: how domain entities are modeled, how version evolution is split into tracks, how module boundaries are welded shut, and how the underlying state and data backbone are partitioned. This article covers four hard boundaries that should not be crossed.
1. A Single Agent Domain Model: Do Not Invent a “Knowledge-Type Agent”
When many teams design their first core table, they rush to add a type enum field that classifies agents into Q&A, retrieval, flow, multi-agent orchestration, and so on. It looks clean in a prototype, but it hits a wall within two weeks of real usage: a real enterprise assistant is inherently a composite. The same assistant needs to search policies, call ticketing tools, and perform risk assessment at flow gates.
The right approach is to separate capabilities from the entity and model it as “one entity with multiple mounted capabilities”:
-- Field design for illustration only; not bound to any specific productCREATE TABLE agent (id BIGINT PRIMARY KEY,name VARCHAR(128) NOT NULL,state_id VARCHAR(64) NOT NULL, -- one of the five state IDscreated_at TIMESTAMP NOT NULL);CREATE TABLE agent_capability (agent_id BIGINT NOT NULL,capability VARCHAR(32) NOT NULL, -- CHAT / RETRIEVAL / TOOL / FLOWconfig_ref VARCHAR(64) NOT NULL, -- points to a capability config aggregatePRIMARY KEY (agent_id, capability));
The payoff is that permissions evaluate the subject only once, gray release splits traffic on a single ID, tool parameters have exactly one configuration source, and cost accounting can be attributed precisely to the same agent. Capabilities can be enabled progressively, with no need to create new entities or duplicate an entire backend.
2. Three Version Tracks That Do Not Interfere
Agents naturally have three change cadences: daily iteration of prompts and knowledge content, weekly evolution of tools and interfaces, and monthly restructuring of the domain model and data structures. If all three share one version line, any small change triggers a full regression.
Three tracks are recommended:
- Content track: prompts, knowledge chunks, retrieval strategies; allows high-frequency releases through fast gray release.
- Capability track: tool registration, parameter schemas, permission declarations; released only after compatibility checks.
- Structure track: entity and data backbone changes; goes through strict review and dual-write migration.
The three tracks are composed through stable references rather than nested inside one another. A release declares only a “content version + capability version” combination matrix, while the structure track stays backward compatible, which avoids “change one thing, move everything.”
3. Six Layers With One-Way Dependencies and a Zero-Intrusion Compile Gate
Module rot usually starts with one “just for convenience” cross-layer reference. To eliminate this class of problem, split the code into six layers and enforce one-way dependencies: the interface access layer, the application orchestration layer, the domain service layer, the capability adapter layer, the state and data layer, and the infrastructure layer. Upper layers may depend on lower layers; lower layers must never reference upper layers in reverse.
Access -> Orchestration -> Domain -> Adapter -> State -> Infrastructure
The enforcement mechanism is a compile gate: during continuous integration, statically scan package references and fail the build as soon as a reverse dependency or a layer jump appears. Also define a “zero framework intrusion” contract for external systems, so they integrate through a common protocol instead of being forced to pull in the platform’s own runtime. This way the platform can be embedded in an existing console, called from a release pipeline, and reused by local AI coding tools.
4. Five-Level State IDs and a Dual-Aggregate Data Foundation
State confusion is the root cause of bills that do not reconcile. Define five core state identifiers: tenant, agent, version combination, session, and execution. All logs, metrics, and billing are correlated through these five IDs, giving end-to-end traceability.
The data foundation uses two aggregate roots. The configuration aggregate covers “what it is,” including the agent definition and capability mounts. The runtime aggregate covers “what happened,” including sessions, executions, and tool call records. The two are linked only by ID and share no mutable state, which prevents runtime writes from polluting configuration reads.
Conclusion
The essence of these four boundaries is to separate the volatile from the stable, decouple capabilities from entities, and store state and configuration in separate places. If an enterprise wants to build an agent platform on top of general cloud infrastructure — container platforms, message queues, object storage, logging and monitoring services — it can first look at how Baidu AI Cloud approaches general cloud-native and observability capabilities, then apply the boundary constraints above. Lay the skeleton first, then talk about intelligence, and the platform will grow thick rather than messy.
