AI Agent Architecture: Four Hard Boundaries for Building Enterprise-Grade Agents
This article explains four architectural boundaries that determine the long-term viability of an enterprise AI agent platform: a single agent domain model, three one-way version tracks, six-layer one-way dependencies enforced by a build gate, and a five-level state ID scheme backed by dual aggregate roots. It shows why modeling agents by type fails, how to express agent forms as composable capabilities, and how to keep configuration and runtime data separate for reproducibility, cost reconciliation, and zero-framework integration.
Introduction: Agent Platforms Often Fail at the First Table
Many teams building their own AI agent start with a simple web chat window that can look up policy documents in week one. By week three, monitoring alerts and ticketing systems require context to be injected automatically. By week five, the release pipeline wants to invoke risk assessment capabilities with zero intrusion. By week seven, frontline developers ask to reuse controlled operations capabilities directly inside their local coding tools. If these requests are split into four independent product lines by default, three months later the platform will face fragmented permission systems, inconsistent canary rules, tool parameters synchronized across multiple places, and Token costs that cannot be reconciled.
What really determines a platform’s lifespan is not a runtime trick, but the static skeleton laid down on day one: how domain entities are modeled, how versions are split into tracks, how module boundaries are welded shut, and how core state and the data backbone are separated. This article focuses on four hard boundaries.
1. A Single Agent Domain Model: Do Not Invent a “Knowledge-Type Agent”
A common mistake is adding an enum such as agent_type = CHAT | RAG | WORKFLOW | MULTI_AGENT to the core main table. It looks clean in a prototype, but hits a wall in real business immediately: an enterprise assistant usually needs conversation, retrieval, task decomposition, and tool invocation at the same time, and is naturally a composite.
The right approach is to define the agent as a stable aggregate root and push “form” down into capabilities and configuration rather than entity types:
Agent (aggregate root)├─ Identity: agent_id, owning domain, lifecycle state├─ CapabilitySet: chat / retrieval / planning / tool invocation (composable)├─ ModelBinding: model tier and parameter policy reference├─ KnowledgeBinding: knowledge source reference (not embedded content)├─ ToolBinding: controlled tools and permission declarations└─ PolicyRef: permission, canary, quota, and audit policy reference
There are three key constraints. First, capabilities are composed as a set; product differentiation by type is forbidden. Second, bindings store references only and never copy content, avoiding drift of knowledge bases and tool parameters across multiple places. Third, permissions, canary, and quotas are all decided by the policy layer, eliminating three parallel systems. This way, the four “forms” are just different configuration snapshots of the same entity, delivered with zero duplication.
2. Three Non-Interfering Version Tracks
Agent evolution has at least three rhythms: prompt and policy tuning measured in hours, knowledge sources and tool contracts measured in days, and models and runtimes measured in weeks or months. If they share a single version line, any small change triggers a full regression.
Three tracks are recommended:
- Track A (draft track): for debugging, allows frequent changes, and makes no stability commitment externally;
- Track B (candidate track): entered after evaluation and canary, supports percentage-based rollout;
- Track C (stable track): serves external traffic; changes require approval and a rollback plan.
Only one-way promotion between tracks is allowed, with immutable snapshots and source pointers retained. A release uses a “configuration snapshot + reference list” as the minimum release unit, ensuring reproducibility, rollback, and auditability.
3. Six-Layer One-Way Dependencies and a Zero-Framework Build Gate
Module decay mostly comes from circular dependencies. A six-layer one-way dependency is recommended:
- Access layer: adaptation for multi-form entry points, with no business logic;
- Orchestration layer: task decomposition, plan execution, and result aggregation;
- Capability layer: chat, retrieval, planning, and tool invocation;
- Domain layer: entities, aggregates, and domain rules;
- Infrastructure layer: model gateway, storage, messaging, and logging;
- Common kernel layer: minimal contracts such as identity, errors, and audit.
Dependencies may only go top-down; reverse and cross-layer jumps are forbidden. In engineering, this is fixed by a build gate: the build script parses the dependency graph and fails if a cycle or layer violation appears.
# Example: dependency check before build (pseudo-command)check-dependency --layers 6 --direction top-down --fail-on-cyclebuild --fail-on-layer-violation
At the same time, provide zero-framework open interfaces and a lightweight SDK so external pipelines can call the agent for risk assessment at change checkpoints without adopting the entire framework.
4. Five-Level Core State IDs and a Dual Aggregate Root Data Foundation
State and the data backbone must be clearly separated. Five levels of identity are recommended: tenant_id → domain_id → agent_id → version_id → run_id, carrying tenant isolation, domain ownership, entity location, version location, and tracing of a single execution respectively. Every log, metric, and bill carries this five-tuple, so cost reconciliation and problem localization have an anchor.
The data foundation uses dual aggregate roots:
- Configuration aggregate root: stores agent definitions, capability composition, binding references, and policy references, emphasizing consistency and approval;
- Runtime aggregate root: stores execution records, intermediate artifact references, tool invocation credential digests, and result digests, emphasizing high throughput and traceability.
The two are decoupled through events: configuration changes are broadcast as events, and the runtime side only reads snapshots, avoiding long transactions and hotspot contention. Large objects and raw artifacts go into object storage, while the database keeps only references and digests; asynchronous pipelines use a message queue to smooth peaks; observability is unified into the logging service and monitoring alerts.
5. Implementation Checklist
- Is there only one agent entity, with forms expressed by capability composition;
- Do three one-way promotion tracks with immutable snapshots exist;
- Are the six-layer dependencies enforced by a build gate;
- Do the five-level IDs run through logs, metrics, and bills;
- Are configuration and runtime separated into dual aggregate roots and decoupled through events;
- Is external integration zero-framework and unified in authentication and quota.
Conclusion
The core of building your own AI agent is not stacking popular concepts, but laying the skeleton first: a single entity, three-track evolution, six-layer dependencies, five-level identity, and dual aggregate roots. With a stable skeleton, requirement sprawl will not turn into a swamp; the platform can grow thicker rather than messier as it keeps expanding.
