Four Architectural Boundaries for Building Enterprise-Grade AI Agents

    This article explains why enterprise AI agent platforms tend to become messy as requirements expand, and presents four architectural boundaries that keep them stable: a single agent domain model independent of interaction form, three isolated version tracks, six layers with strictly one-way dependencies enforced by a zero-framework compile gate, and a five-level state identity scheme backed by a dual-aggregate-root data foundation. It includes a code sketch of the domain entity, a promotion diagram for the version tracks, and a practical checklist for evaluating your own platform.

    1. Why Agent Platforms Get Messier Over Time: It Starts With Scope Creep

    Almost every internal enterprise agent platform follows the same familiar evolution curve.

    • Week 1: The business team just wants an internal web chat entry point that can look up policy documents and search historical logs.
    • Week 3: The monitoring, alerting, and ticketing teams ask for a floating entry embedded in their existing systems, which automatically carries the current page’s application name, cluster identifier, and ticket context when opened.
    • Week 5: The R&D and release pipeline teams request a software development kit or open API with zero framework intrusion, so the agent can be called at change-release checkpoints to assess risk.
    • Week 7: Frontline developers and operations engineers point out that they spend most of the day writing code and debugging in local development environments. They do not want to be forced to switch browsers; they want the same agent connected directly in their local coding tools, reusing internal, controlled operations capabilities and code repositories.

    If you take these requests one by one out of inertia, split them into four independent product lines, and then manufacture several mutually isolated entities in the backend around whatever concept is trending — a “basic Q&A body,” a “knowledge retrieval body,” a “process orchestration body,” a “tool service body” — four structural debts will inevitably appear within three months: the permission system splits into three, canary rules each go their own way, changing one tool parameter requires syncing it in multiple places, and month-end token costs cannot be reconciled.

    The root cause is not runtime technique 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 the underlying state and data backbone are partitioned. The four hard boundaries below are the foundation for building a thick platform.

    2. Boundary One: A Single Agent Domain Model, No Entities Invented per Form

    A common approach is to first add a type enum to the core main table, classifying agents as conversational, retrieval, process, or orchestration types. It looks clean in the prototype stage, but hits a wall within two weeks in real business: a real enterprise assistant is inherently a composite — it needs to retrieve policy knowledge, call ticketing and monitoring tools, be invoked synchronously by external systems at process checkpoints, and be reused by local development environments.

    Building entities by form amounts to registering four sides of the same business capability as four unacquainted “species,” and every new access form added later requires yet another table.

    A more robust approach: form is not an entity attribute but one of several projections of the same entity. The core entity keeps only stable semantics — what it is, who owns it, what it can use, what constraints apply to it; form differences are pushed down into rendering strategies in the access adaptation layer.

    1. # Illustration: the domain entity describes only stable semantics, with no form enum
    2. class AgentDefinition:
    3. id: str # globally unique identifier
    4. name: str
    5. owner_team: str # owning team, anchor for permissions and cost attribution
    6. model_profile_ref: str # model profile reference, not hardcoded
    7. tool_refs: list[str] # allowlist of tools the agent may call
    8. knowledge_refs: list[str]
    9. policy_ref: str # reference to permission, masking, and rate-limiting policies
    10. version_channel: str # version track identifier

    The four forms are adapted in the access layer: the web frontend renders multi-turn conversations; the embedded entry injects page context; the open API returns structured conclusions via synchronous calls; local coding tools reuse the same tool allowlist through a standard tool protocol. There is only one entity, so permissions, canary rollout, and metering naturally have only one set.

    3. Boundary Two: Three Version Tracks That Never Interfere

    Agents are a rare kind of system where four elements — prompts, models, tools, and knowledge — all change at high frequency. If they share a single version line, one small prompt tweak triggers a full regression, and the release cadence is dragged down by the slowest link.

    Splitting tracks by blast radius of the change is the lowest-cost decoupling mechanism:

    • Experimental track: aimed at an internal trial audience, may be reset at any time, promises no compatibility, used to validate prompts and retrieval strategies.
    • Canary track: a small percentage of real traffic, keeps rollback-capable snapshots, focuses on quality metrics and error rates.
    • Stable track: accepts only validated, frozen versions; any change goes through review and promises interface and behavioral compatibility externally.

    Only one-way promotion between tracks is allowed; reverse edits across tracks are not. Every promotion generates an immutable snapshot recording a four-element fingerprint of the model profile, prompt digest, tool list, and knowledge base version, so when quality regresses you can pinpoint exactly which dimension changed.

    1. Experimental track --(review + metrics met)--> Canary track --(observation window passed)--> Stable track
    2. ^ | |
    3. +---------- new branch only ---------------+-------- rollback snapshot only ---+

    4. Boundary Three: Six Layers With One-Way Dependencies and a Zero-Framework Compile Gate

    Module rot almost always begins with a reverse dependency: the domain layer reads an interface-layer data structure directly for convenience, the tool layer casually adds a line of caching, and the next day the whole chain depends on it.

    Six layers from top to bottom with strictly one-way dependencies is the rule that is easiest to enforce and easiest to break:

    1. Access layer: protocol adaptation, context injection, form rendering.
    2. Orchestration layer: task decomposition, plan generation, step scheduling, and failure retries.
    3. Capability layer: tool invocation, retrieval augmentation, structured output validation.
    4. Domain layer: core concepts such as agent definitions, policies, and versions.
    5. State layer: sessions, tasks, execution records, and state transitions.
    6. Infrastructure layer: storage, message queues, logging, monitoring and alerting, key management.

    To keep the rule from relying on discipline, put the dependency check into the compile gate: lower-layer packages must not reference upper-layer packages in reverse; cross-layer calls must go through explicit interfaces; tool registration may happen only through the capability layer entry. A violation fails the pipeline immediately — no “merge first, fix later.”

    At the same time, stick to zero framework intrusion: expose only standard protocols and open APIs externally, so business systems can integrate without pulling in the platform’s private runtime. This directly determines whether release checkpoints, ticketing systems, and local development tools can reuse the same capabilities at low cost.

    5. Boundary Four: Five Levels of State Identity and a Dual-Aggregate-Root Data Foundation

    The hardest thing to reconcile in an agent system is not quality but state. One session may spawn multiple tasks, a task contains multiple execution steps, and each step involves multiple model calls and tool calls. If the identity scheme is a mess, both problem localization and cost accounting become distorted.

    Five levels of identity converge layer by layer from top to bottom, guaranteeing that any unit of consumption can be traced back along the chain to its owning team:

    1. session_id
    2. └─ task_id
    3. └─ step_id
    4. └─ call_id (one per model or tool call)
    5. └─ usage_record (tokens, duration, count)

    The data foundation is split into dual aggregate roots:

    • Definition aggregate root: agent definitions, version snapshots, policy references. Write-heavy? No — write rarely, read often, strong consistency, changes require review.
    • Runtime aggregate root: sessions, tasks, steps, call records. Written extremely often and growing monotonically with time, suitable for sharding and hot/cold tiering: historical data sinks to object storage, hot data stays in the database, and full-chain tracing information goes to the logging service.

    The two aggregate roots communicate only through identity references and never share mutable objects. This way definition changes do not lock up runtime writes, and runtime traffic spikes do not pollute definition consistency.

    6. Implementation Checklist

    • Does the main table still have a form enum field? If so, merge the entities first.
    • Do the three version tracks promote one-way only, with immutable snapshots?
    • Can the compile gate block a single reverse-dependency commit?
    • Can any given token consumption be traced back to a team and business scenario within five minutes?
    • Does adding a new access form require changing domain-layer code? If so, the adaptation layer is under-designed.
    • Is there only one source of truth for permissions, masking, and rate-limiting policies?

    The four boundaries share a single goal: to make new requirements land in slots of the existing skeleton rather than continuously widening the foundation. Once the skeleton holds, the agent platform can carry every form from web Q&A to local coding tool integration, while keeping accounting clear and boundaries distinct.