Four Architectural Boundaries for Building an Enterprise AI Agent Platform

    This article breaks down four architectural boundaries that determine whether an enterprise AI agent platform stays coherent as requirements expand. It explains why agents should be modeled as a single domain entity instead of separate types, how three version tracks keep draft, canary, and stable releases isolated, why a six-layer one-way dependency structure with compile-time gates prevents circular dependencies, and how five levels of identifiers plus a dual-aggregate data foundation make configuration, runtime history, and token metering traceable. Each section includes the failure patterns, design trade-offs, and reusable engineering patterns from the original discussion.

    Four Architectural Boundaries for Building an Enterprise AI Agent Platform

    Introduction: The Static Skeleton on Day One Determines the Platform’s Fate

    Many teams still think of AI agents as “chatbots,” but once an agent enters a production environment, it must call tools, retrieve internal documents, break down multi-step tasks, and run automatically inside existing workflows. Requirements then expand at an unprecedented pace. In week one, the business side only wants a web window that can look up policy documents. By week three, the monitoring and ticketing teams want a floating entry embedded in the alert page that automatically carries the application name, cluster ID, and ticket context. In week five, the release pipeline team asks for an open interface with zero framework intrusion so the agent can be invoked at change gates to perform risk assessment. By week seven, an on-call engineer wants to reuse controlled operations capabilities and the code repository without leaving a local coding tool.

    If every request is turned into a separate product line, and the admin console ends up stacking mutually disconnected entities such as “Q&A agents,” “knowledge retrieval agents,” “orchestration agents,” and “tool services,” three months later you will have three parallel permission systems, fragmented canary rules, a single tool parameter change that must be synchronized in four places, and token costs that cannot be reconciled at month end. This article does not list features. Instead, it walks through the failure scenes, trade-off logic, and reusable engineering solutions behind four hard boundaries.

    1. A Single Domain Model: Do Not Split Agents by Type Enumeration

    The most common mistake is adding a type field to the first core table and using four values—Q&A, retrieval, workflow, and multi-agent collaboration—to distinguish product forms. This looks clean in a prototype, but it hits a dead end within two weeks in real business use: an enterprise assistant is inherently a composite. The same agent must retrieve from a policy repository, call a ticketing API, and switch to an approval flow when something goes wrong.

    The root cause is treating “delivery form” as the “domain essence.” Form is a difference at the entry and interaction layer; essence is a difference in capability composition and runtime policy. The correct approach is to model the agent as a single entity and describe differences through a capability list and policy configuration:

    1. class Agent:
    2. id: AgentId
    3. name: str
    4. capabilities: list[Capability] # retrieval, tool calls, workflow orchestration
    5. policy: PolicyRef # permissions, canary, quota
    6. version_track: Track # see section 2

    The entry layer then adapts to each form: web, embedded floating entry, open API, and local coding tool integration are all just different projections of the same entity. The benefit is that permissions, canary, quota, and billing are maintained in one place, and adding a new form requires no new table and no new console.

    2. Three Version Tracks: Keep Evolution from Stepping on Itself

    After unifying the entity, the second pitfall is mixed version tracks: draft changes directly affect production, and canary cannot be distinguished from stable. The recommendation is three non-interfering tracks. The draft track can be changed freely. The canary track targets small traffic for validation and rolls back automatically when metrics fall short. The stable track only accepts versions promoted after validation. Tracks flow one way through an explicit “promote” action, and cross-track writes are forbidden.

    1. draft --(validation passed)--> canary --(metrics met)--> stable
    2. ^ | |
    3. +---- revert to draft <---------+---- auto rollback <----+

    Supporting points: every promotion generates an immutable version number; canary splitting is based on modulo of user or tenant; all three tracks share one permission and quota model to avoid rule fragmentation.

    3. Six-Layer One-Way Dependencies and a Zero-Intrusion Compile Gate

    The third consequence of scope creep is circular dependencies: the access layer reads data tables directly, and the tool layer calls back into UI logic. The recommendation is six layers—access adaptation, session orchestration, capability scheduling, tools and retrieval, domain model, and state and storage—with dependencies strictly one-way from top to bottom. Enforce this with a compile-time gate so violations fail immediately:

    1. ALLOWED = {1:{2}, 2:{3}, 3:{4}, 4:{5}, 5:{6}, 6:set()}
    2. def check(layer, dep):
    3. assert dep in ALLOWED[layer], f"illegal dependency {layer}->{dep}"

    At the same time, keep “zero framework intrusion”: expose only generic protocol-style interfaces and a lightweight client externally, and do not make business systems inherit platform-private base classes. Only then can the agent be reused by pipeline gates, local tools, and third-party systems at the same time.

    4. Five Levels of Identifiers and a Dual-Aggregate Data Foundation

    The last boundary solves “the numbers do not add up.” Define five levels of identifiers for the agent, version, session, message, and tool call to form a traceable chain. The data foundation uses a dual aggregate: one aggregate for configuration and policy, and one for runtime and metering. The two are linked by identifiers, so configuration changes do not affect runtime history, and metering can be traced precisely to a specific version and tool call.

    1. AgentId -> VersionId -> SessionId -> MessageId -> ToolCallId
    2. Configuration aggregate (definition/policy/track) Runtime aggregate (session/call/metering)

    Conclusion

    The common logic of the four boundaries is to keep volatile forms at the entry layer and push the stable essence down to the domain layer. To reduce the burden of self-building, you can rely on general capabilities from platforms such as Baidu AI Cloud (container platform, object storage, message queue, logging service, monitoring and alerting) to carry state and observability, and focus your effort on domain modeling and gate rules. Only when the skeleton holds firm can the platform grow thick without growing messy.