How to Build a Controllable Enterprise AI Agent Platform
This article explains how to design an enterprise AI agent platform that stays controllable as requirements grow. It shows why classifying agents by type (chat, RAG, workflow, multi-agent) breaks down in real usage, and instead defines four hard boundaries: a single agent domain model, three independent version tracks, six-layer one-way dependencies enforced by a zero-framework compile gate, and a five-level state identification scheme backed by a dual-aggregate-root data layer. It also covers exposing platform capabilities to local coding tools through a protocol-based gateway, plus a four-week rollout order. The goal is a platform that grows thicker, not messier, while remaining auditable, rollback-safe, and cost-accountable.
1. When Requirements Multiply, Things Get Messy: Type Enums Are the First Trap
By the seventh week after launch, the requests from engineering and operations teams had become very specific. Engineers spend most of their day writing code and debugging in local development environments. They do not want to switch back and forth to a browser every time they use an agent. Instead, they want to connect platform capabilities directly inside their local AI coding tools, while reusing the company’s controlled operations tooling and code repositories.
If the team reacts on autopilot and splits these requests into four separate product lines, then creates four or five disconnected entity tables in the backend based on trending concepts—a “basic Q&A agent,” a “knowledge retrieval agent,” a “multi-agent orchestration agent,” and “tool services”—three months later it will almost certainly face four problems: the permission system fractures into three sets, gradual rollout rules each go their own way, changing a tool parameter in one place requires syncing it in four places, and at month-end the model invocation cost accounting does not add up at all.
So if the platform is to grow thick rather than messy, it must establish unbreakable boundaries at the static skeleton stage. This article covers four boundaries: a single agent domain model, three non-interfering version tracks, six-layer one-way dependencies with a zero-framework compile gate, and five-level core state identifiers backed by a dual-aggregate-root data foundation.
2. Why “Creating Tables by Type” Is Doomed to Fail
When many teams design their first core main table, they rush to add a type field with values like CHAT, RAG, WORKFLOW, and MULTI_AGENT. This classification looks clean in the prototype stage, but within two weeks of entering real business use, it hits a dead end: enterprise business assistants are naturally cross-type composites.
Take the most common “production troubleshooting assistant” as an example. An employee asks, “Why did the order service jitter last night?” Its execution chain is:
- Retrieve the incident runbook from the operations knowledge base—this is knowledge retrieval;
- Call the internal APIs of the logging service and monitoring/alerting system to pull the exception stack—this is tool invocation;
- Discover that a slow query is involved and spawn a database diagnosis sub-agent to investigate concurrently—this is multi-agent collaboration;
- Locate the need to scale up or roll back, and then drive a deterministic process with manager approval according to the company’s change policy.
A single real request spans four capability forms at once. If the type field is the main table’s discriminator, three typical degradations appear: to keep types pure, the composite chain is forced into a single type, scattering orchestration logic everywhere; or a new type value is added for every combination, and the enum balloons rapidly; or the type constraint is abandoned altogether, the field becomes useless, and all the routing, billing, and rollout logic that depends on it fails at the same time.
The conclusion is direct: type is not a stable modeling dimension; capability composition is. Type should be demoted from a “main table field” to a “runtime-computed view.”
3. Hard Boundary One: A Single Agent Domain Model
The right approach is to abstract an agent as a stable aggregate with four parts: identity and permission ownership, a capability list, resource references, and a version pointer. So-called “Q&A,” “retrieval,” and “orchestration” are just different checked results in the capability list, not different entities.
Agent {id, owner, permissionScopecapabilities: [retrieval, toolCall, subAgent, workflow]resources: [knowledgeBaseRef, toolRef, repoRef]versionPointer}
This brings three direct benefits. First, permissions are maintained in just one set; the subject-resource-action triple does not get rewritten as capability forms change. Second, gradual rollout and release act on the same entity, with no need to build a separate release pipeline for each type. Third, the metering standard is unified: the model calls, retrieval calls, and tool calls of a single session all hang under the same agent identifier, so costs can be reconciled.
It is worth stressing that the capability list must come from a controlled registry, not a freely filled string array. Tools, knowledge bases, sub-agents, and workflow templates should all have a unique identifier and a parameter schema definition; the agent only holds references and does not copy the definitions. This is the key to fundamentally solving the later “change one place, sync four places” problem.
4. Hard Boundary Two: Three Non-Interfering Version Tracks
Agents change at vastly different frequencies: prompts and resource configurations may change multiple times a day, tool parameter schemas change as internal systems upgrade, and permission and compliance policies require very low frequency with strong auditing. Squeezing all three into the same version number results in high-frequency changes being held up by low-frequency approvals, or low-frequency changes being swept along by high-frequency releases.
The recommendation is to split them into three tracks:
- Configuration track: prompts, model parameters, retrieval strategy—supports rapid iteration and one-click rollback;
- Contract track: parameter schemas and return structures of tools and knowledge bases—follows compatibility-first, allowing only backward-compatible additions;
- Policy track: permission scope, data boundaries, approval requirements—changes require review and leave an audit trail.
At runtime, a resolution layer composes the current effective versions of the three tracks into an “effective snapshot,” and requests only recognize the snapshot identifier. This ensures reproducibility while preventing the three tracks from polluting each other.
5. Hard Boundary Three: Six-Layer One-Way Dependencies and a Zero-Framework Compile Gate
Layering that is not enforced is the same as no layering. The recommended six layers with one-way dependencies, from bottom to top, are: the base resource layer, the capability access layer, the orchestration execution layer, the agent definition layer, the session and state layer, and the access and open layer. Upper layers may depend on lower layers; reverse dependencies are strictly forbidden; layers at the same level do not call each other directly but sink down to a lower layer through interfaces.
The implementation approach is a zero-framework compile gate—using static checks in the continuous integration stage to ensure the rules are not broken, as illustrated below:
LAYERS = ["resource", "capability", "orchestration", "agent", "session", "access"]def check_imports(module, layer_index):for dep in module.imports:if LAYERS.index(dep.layer) < layer_index:continue # depending on a lower layer is allowedif dep.layer == layer_index and dep.is_direct_call:raise GateError("same-layer direct call is forbidden")if LAYERS.index(dep.layer) > layer_index:raise GateError("reverse dependency is forbidden")
The value of the gate is turning architectural constraints from documentation conventions into executable assertions. Any commit that tries to “temporarily insert a shortcut” will fail before merging, reducing the cost of architecture decay from a “quarterly refactor” to “changing three lines of imports.”
6. Hard Boundary Four: Five-Level State Identifiers and a Dual-Aggregate-Root Data Foundation
Agent execution is a long-running, interruptible, and recoverable process. State identifiers are recommended in five levels: session identifier, execution identifier, step identifier, tool invocation identifier, and artifact identifier. The five levels are generated independently and owned in one direction; any level can be retrieved and replayed, so troubleshooting no longer relies on stitching together call chains from log text.
The data foundation uses a dual aggregate root: one aggregate root handles “definition and version,” storing the agent, capability references, and effective snapshots; the other handles “runtime and state,” storing sessions, execution traces, and artifact indexes. The two are linked by identifier references rather than physical coupling, so definition changes do not affect in-flight executions, and runtime data growth does not slow down definition reads.
7. How Local Access and Tool Reuse Avoid Breaking Boundaries
Back to the original request: connect to the platform directly from a local AI coding tool and reuse controlled operations tooling and code repositories. The viable path is to make the open layer a protocol-based capability gateway that exposes a unified tool discovery and invocation contract externally. Local tools connect as clients, and authentication, auditing, and rate limiting are all handled at the gateway rather than each written separately on the client side.
Three practical points: repositories and operations tools are registered by reference, with permission decisions made on the server side; local sessions also generate the five-level state identifiers, ensuring unified auditing with browser-side sessions; parameter schema changes go through the contract track, and clients adapt according to the schema to avoid version fragmentation.
8. Recommended Rollout Order
In week one, establish the domain model and identifier system first, without writing any capability implementation; in week two, build the registry and the contract track; in week three, add the layering gate and continuous integration checks; in week four, connect the open layer and the local client. Each step uses “can it be reconciled, can it be rolled back, can it be audited” as the acceptance criteria, rather than the number of features as the progress metric. Hold these four boundaries, and the platform only grows thicker as it adds capabilities—it does not get messy.
