Four Architectural Pillars for Building Enterprise-Grade AI Agents
This article explains how to build a durable enterprise AI agent platform by fixing its static architecture on day one instead of splitting delivery forms into separate product lines. It covers four core boundaries: a single agent domain model that separates capabilities from delivery channels, three version tracks for operational, platform, and architectural changes, six layers with one-way dependencies enforced by a build gate, and a five-level state identification scheme backed by a dual-aggregate data foundation. The goal is to avoid fragmented permission models, inconsistent gray-release rules, duplicated tool configurations, and misaligned token costs.
Introduction: Agent Platforms Often Fail at the First Table
Rolling out AI agents inside an enterprise tends to follow the same pattern. In week one, the business team just wants an internal web Q&A window that can search policy documents and query runtime logs. By week three, the monitoring, alerting, and ticketing teams want the entry point embedded in a corner of their existing systems, automatically carrying the current page’s application name, cluster ID, and ticket context when opened. In week five, the engineering and release teams ask for an open API or a local SDK with zero framework intrusion, so they can call the agent for risk assessment at change-release checkpoints. By week seven, frontline developers say they spend most of the day in local coding tools and do not want to switch back and forth between a browser and an IDE; they want to reuse the internal, controlled operations capabilities and code repositories directly.
If you react to each request in turn and turn these four demands into four independent product lines, then create separate, disconnected entities in the backend around popular concepts such as a “Q&A agent,” a “knowledge retrieval agent,” a “workflow orchestration agent,” and a “tool service agent,” three months will bring four predictable outcomes: the permission model splits into multiple versions, gray-release rules diverge, every tool parameter change has to be synchronized in four places, and token costs cannot be reconciled at month end. What really determines the long-term shape of the system is not a clever runtime trick but the static skeleton you set on day one. This article focuses on four hard boundaries: a single agent domain model, three version tracks, six layers with one-way dependencies and a build gate, and five core state identifiers with a dual-aggregate data foundation.
1. Do Not Classify by “Form”: How One Entity Carries Four Delivery Modes
When many teams design the core main table, their first instinct is to add a type enum field that lists Q&A, retrieval, orchestration, and tool service as mutually exclusive values. This classification looks clean in a prototype, but it hits a wall within two weeks of real business use: a real enterprise assistant is inherently a composite. It needs to search policy documents, perform risk assessment at workflow checkpoints, and call controlled operations capabilities from local coding tools. The type is composite, but the enum is mutually exclusive, so the only option is to keep adding combination values until the enum explodes.
A more robust approach is to decouple “capability” from “form.” The domain entity keeps a single agent subject that answers three questions: who it is (identity and permission boundary), what it can do (the set of mounted capabilities), and how it is reached (delivery channels). Capabilities are modeled as an independent list, including knowledge retrieval, tool invocation, workflow orchestration, and sub-agent collaboration. Channels are also modeled independently, including web, embedded widget, open API, and local coding tool integration. The subject has many-to-many relationships with capabilities and channels, so adding a new delivery mode does not require changing the main table structure.
A schematic structure looks like this:
Agent(id, name, owner, permission_scope, state)AgentCapability(agent_id, capability_type, config_ref, enabled)AgentChannel(agent_id, channel_type, tenant_binding, gray_rule_ref)
The direct benefits are that permissions are evaluated in one place, gray-release rules are maintained as a single set, tool parameters have only one configuration source, and cost accounting can be aggregated uniformly by subject. The test is simple: if adding a new business demand requires changing the main table structure, the abstraction is still stuck at the form layer and needs to be raised further.
2. Three Version Tracks: Keep Evolution from Stepping on Itself
A single entity solves “no duplication”; version tracks solve “no mutual breakage.” In practice, changes should be split into at least three categories with completely different cadences: operational changes to prompts and knowledge configuration, which may iterate several times a day; platform changes to capability integrations and tool parameters, which follow a weekly gray-release rhythm; and architectural changes to the domain model and data structures, which are assessed monthly and require a migration plan.
The three tracks must be physically isolated in storage and release paths. Operational changes go through a configuration center with second-level rollback. Platform changes go through capability registration and version management, with callers explicitly declaring the version they need. Architectural changes go through database migration and a dual-write transition, and are forbidden from shipping in the same batch as configuration changes. If all three share one pipeline, a single prompt tweak can trigger a full regression, and the team will eventually choose “not to change anything,” at which point the architecture ossifies.
When implementing this, tag every change with its track and enforce it in the gate: architectural changes must include rollback and data compatibility notes, platform changes must declare a version compatibility range, and operational changes must be restorable with one click. The value of version tracks is not a nicer process but keeping different frequencies of evolution from stepping on each other.
3. Six Layers with One-Way Dependencies and a Zero-Framework Build Gate
Module boundaries cannot be held by documentation; they must be held by dependency direction. The recommended layers, from bottom to top, are: the infrastructure tool layer (wrappers for common capabilities such as model access, object storage, message queues, logging, and monitoring alerts), the domain model layer, the capability implementation layer, the orchestration execution layer, the access adapter layer, and the channel delivery layer. There is only one rule: upper layers may depend on lower layers, lower layers must not reference upper layers in reverse, direct lateral connections within the same layer are forbidden, and cross-layer collaboration is done through explicit interfaces.
To make the rule executable, it must be fixed into the build and continuous integration gate. Using a generic build script as an example:
# Pseudocode: validate layer dependency directioncheck-layers --root=src --allow "channel->orchestration" \--allow "orchestration->capability" --allow "capability->domain" \--allow "domain->infra" --deny-others
If the gate fails, the build fails and the merge is blocked. Zero framework intrusion is also a requirement at this layer: the open APIs and local SDK provided externally only perform protocol conversion and authentication pass-through, do not intrude into the caller’s dependency tree, and do not force the introduction of a platform runtime. This way, the agent can be embedded as a floating entry in existing systems and reused directly by local coding tools, without rewriting a separate set of logic for each channel.
4. Five-Level State Identifiers and a Dual-Aggregate Data Foundation
The most hidden cost of requirement sprawl happens in the data layer. If each form gets its own set of tables, permissions, gray release, and metering all fork. Use five levels of identifiers for unified addressing: tenant, subject, version, session, and execution record. Any invocation can be located by a unique path, which gives auditing and cost accounting a common baseline.
The data foundation uses two aggregate roots. The configuration aggregate root handles the declarative definition of subjects, capabilities, and channels, emphasizes consistency, and requires strong validation for changes. The runtime aggregate root handles sessions and execution traces, emphasizes high throughput and archivability, and allows eventual consistency. The two are linked by identifiers rather than coupled by foreign keys, so configuration changes do not affect the traceability of historical execution records.
Conclusion
The common logic of the four pillars is to isolate what is volatile and weld down what is stable. A single domain model eliminates duplication, three version tracks isolate different evolution frequencies, six layers with one-way dependencies and a build gate make boundaries executable, and five-level identifiers with a dual-aggregate foundation keep state and the data backbone stable. Once the skeleton is in place, adding an embedded entry, an open API, or local coding tool integration is just adding a channel adapter, not building another product line.
