How to Build an Enterprise AI Agent Platform: Architecture and Governance

    Building an enterprise AI agent platform is not the same as shipping a single assistant. This article presents a reference architecture for teams that need multiple channels to reuse the same governed agent capabilities. It separates the control plane from the execution plane, defines a unified agent domain model, and introduces three independent version tracks for agent definitions, execution engines, and tool contracts. It also describes a six-layer dependency model, five identifiers for tenant, agent, session, run, and step, and two aggregate roots for capability definitions and run facts. The article then covers tool execution safeguards, storage responsibilities, phased delivery from prototype to production, and acceptance criteria for task quality, security, reliability, and architecture governance.

    I. Define the Goal First: Build an Assistant or a Platform?

    The most direct way to build an AI agent is to connect a language model, configure prompts, and then connect a knowledge base and a few tools. This approach is suitable for validating demand. However, if the goal is to serve multiple teams inside an enterprise, capability reuse, permission governance, and version evolution must be considered from the beginning.

    Enterprise requirements rarely appear at the same time. At first, users may only want to query policies or analyze logs on a web page. Later, business systems require an embedded chat entry point that automatically carries page context. After that, the release process needs to call an agent through an API to assess change risk, while developers want to access internal knowledge and controlled tools directly from local coding tools.

    What these requirements have in common is not that they all need a chat window. They need access to the same set of intelligent decision-making and execution capabilities.

    Therefore, platform design should first answer three questions:

    • What business capability does an agent actually represent?
    • How can different entry points reuse the same permissions, configuration, and execution mechanisms?
    • How can a single invocation be fully traced, explained, and audited?

    This article presents a reference design suitable for enterprise scenarios: use one agent domain model to carry capabilities, use three version tracks to manage change, use six layers of unidirectional dependencies to constrain code structure, and organize core data through five identifiers and two aggregate roots. This is not the only standard, but it is an architecture approach that is easier to understand and implement.

    II. Separate the Control Plane from the Execution Plane

    1. The control plane manages “how to run”

    The control plane is responsible for agent creation, configuration, approval, publishing, permission management, and version selection. When administrators modify prompts, adjust tool scopes, or update knowledge sources, these are control plane activities.

    Its core output should be validated, publishable, and traceable configuration, not temporary state that is currently running.

    A recommended configuration lifecycle includes states such as draft, pending review, published, and disabled. Drafts can be modified repeatedly, while published versions remain immutable. When changes are needed, create a new version instead of overwriting the old one.

    2. The execution plane is responsible for “completing this request”

    After receiving a request, the execution plane handles identity verification, context assembly, knowledge retrieval, model invocation, tool execution, result output, and run records.

    At the start of a run, the platform should resolve and fix the agent version, execution engine version, and tool contract versions used for that run. Subsequent changes in the control plane should not cause the same run to read two different sets of configuration before and after a change.

    For platforms with enterprise isolation requirements, the control plane and execution plane should preferably be deployed as separate processes or services, with different resource quotas, scaling policies, and failure handling mechanisms. In this way, a configuration backend failure does not directly take down the execution service, and a surge in execution traffic does not block release reviews.

    However, process separation is only the foundation. If the execution plane synchronously reads the management database at every step, runtime stability is still constrained by the control plane. A more robust approach is to decouple through release artifacts, versioned configuration snapshots, and controlled caching, while retaining a timely governance channel for permission revocation and emergency disablement.

    III. Unified Domain Model: Many Entry Points, One Capability Definition

    1. Define an agent as a governable capability unit

    An agent can be abstracted as:

    A capability unit that, within a defined permission scope, uses specified model policies, knowledge sources, and tool sets to complete a class of tasks under defined constraints.

    It should at least describe the following:

    Configuration Category Main Content
    Basic identity Tenant, name, owner, purpose
    Behavioral constraints Task boundaries, prompts, output requirements
    Model policy Capability requirements, invocation limits, fallback strategy
    Knowledge configuration Data sources, access scope, update rules
    Tool configuration Allowed tools, contract versions, execution constraints
    Security policy Authorization requirements, sensitive operation confirmation, data handling rules
    Runtime budget Timeout, step limit, invocation count, resource quota

    Differences such as “document Q&A,” “log analysis,” and “change assessment” can be expressed through configuration, workflows, and capability composition. There is no need to create isolated agent entity systems for each one.

    A unified model does not mean putting every field into one large table. Basic metadata, version content, tool bindings, and permission policies can be stored separately, but they should be organized around the same domain concept and maintain a consistent lifecycle.

    2. Model access channels as adapters

    Web chat, embedded business pages, open APIs, and local development entry points differ mainly in input and output methods, not in the agent itself.

    Channel adapters are responsible for:

    • Converting external identities into identity contexts recognized by the platform;
    • Converting page information, conversational input, or workflow parameters into a unified request;
    • Converting execution results into the response format required by the channel;
    • Handling channel-specific connection, cancellation, and output display logic.

    Channels should not maintain a separate set of agent permissions, nor should they bypass the unified execution service to call high-risk tools directly.

    An important principle is: entry points can carry context, but they cannot grant permissions by themselves. For example, an application ID passed from a page can help locate a resource, but it cannot prove that the current user has permission to access that application.

    IV. Three Version Tracks: Let Different Types of Change Evolve Independently

    If prompt adjustments, execution engine upgrades, and tool parameter changes all share a vague “version number,” troubleshooting and rollback become difficult.

    Versions can be split into three tracks.

    1. Agent definition version

    This track manages task instructions, model policies, knowledge source references, tool bindings, and workflow configuration.

    It answers: “What is this agent defined as?”

    A published version should store a content digest, creator, review records, and change notes. Run records should reference a specific version, not merely the “current version.”

    2. Execution engine version

    This track manages scheduling logic, context construction, tool invocation mechanisms, timeout handling, retries, and output parsing.

    It answers: “How does the platform execute the agent definition?”

    The same agent definition may behave differently after an execution engine upgrade. Therefore, engine changes require independent testing and canary rollout, and should not be treated as purely internal implementation changes.

    3. Tool contract version

    A tool contract describes input structure, output structure, error semantics, and necessary invocation constraints.

    It answers: “How does the agent interact with external capabilities?”

    Adding optional parameters is usually easier to make compatible than removing fields. Changing field meanings, tightening required conditions, or changing error semantics can cause breaking changes. Tool implementations can be deployed independently, but they must clearly declare which contract versions they support.

    The three tracks being independent does not mean they can be combined arbitrarily. The platform needs to record compatibility relationships and validate them before publishing and execution. For example, the tool contract required by an agent version must be supported by the current tool implementation.

    A run should be traceable at least to the following combination:

    1. Agent definition version
    2. + Execution engine version
    3. + Set of tool contract versions
    4. + Actual model identifier and invocation configuration

    This information helps analyze problems, but it does not guarantee fully reproducible results. Model outputs are nondeterministic, and knowledge data and external systems also change. For scenarios that require strict replay, necessary inputs, retrieval evidence, and tool result snapshots should also be retained in accordance with data retention requirements.

    V. Six Layers of Unidirectional Dependency: Make Module Boundaries Checkable Rules

    One feasible code layering approach is to set up the following from outside to inside:

    1. Ingress layer: Handles protocols, request parsing, and channel conversion.
    2. Application layer: Organizes use cases such as publishing, starting a run, and canceling a run.
    3. Orchestration layer: Manages task steps, invocation order, and execution state transitions.
    4. Capability layer: Encapsulates common semantics for model invocation, retrieval, and tool invocation.
    5. Domain layer: Defines agents, versions, sessions, and business constraints.
    6. Foundational contract layer: Stores stable identifier types, value objects, error definitions, and necessary interfaces.

    Dependencies may only point to allowed inner layers. Circular references must not be formed through convenience methods.

    Implementations of databases, message queues, model services, and concrete tools are placed in infrastructure adapter modules and provide capabilities by implementing inner-layer interfaces. The outermost assembly module connects interfaces with implementations.

    The purpose is to prevent domain rules from being locked in by a specific framework, storage structure, or communication protocol. For example, the domain layer should not receive request objects from a web framework, nor should it depend on database access components merely to validate version legitimacy.

    How to implement a zero-framework compile gate

    “Zero framework” mainly applies to core domain and contract modules, not to the entire platform.

    Build rules can enforce the following checks:

    • Core modules must not import web, database, or messaging frameworks;
    • Cross-layer circular dependencies are prohibited;
    • Domain modules must not directly access environment configuration or external services;
    • Core business rules can be tested without starting a server;
    • Tool contract changes must pass compatibility checks.

    Once boundaries exist only in architecture documents, they are easily broken by temporary requirements. They have real enforcement power only when they become failure conditions in compilation, dependency scanning, and continuous integration.

    VI. Five Layers of State Identifiers: Separate Ownership, Conversation, and Execution

    In this reference design, five core identifiers can establish the runtime main line:

    Identifier Main Responsibility
    Tenant ID Determines data and permission isolation scope
    Agent ID Determines the logical capability being invoked
    Session ID Organizes continuous interaction and context
    Run ID Marks one independent execution
    Step ID Marks a specific action within a run

    A session can contain multiple runs, and a run can contain multiple retrievals, model invocations, and tool executions. For open APIs that do not require continuous conversation, a one-time session can be created, or the model can explicitly support sessionless runs. All calls should not be forced to share one long-lived conversation state.

    Note that identifier structure is not the same as authorization. Knowing a run ID does not mean having permission to read its logs. All queries still need to be validated against tenant, user identity, and resource permissions.

    In addition, business identifiers and trace identifiers should be separated. Business identifiers express task ownership, while trace identifiers are used to observe cross-service calls. The two can be correlated, but they should not replace each other.

    VII. Two Aggregate Roots: Manage Capability Definitions and Run Facts Separately

    The role of an aggregate root is to define the transactional consistency boundary, not to reduce the number of database tables.

    1. Agent aggregate root

    The agent aggregate manages capability definitions and their lifecycle, for example:

    • Agent metadata;
    • Published version references;
    • Configuration change rules;
    • Tool and knowledge source bindings;
    • Enablement, disablement, and archival constraints.

    It addresses “how the platform allows a capability to be defined and published.”

    2. Session aggregate root

    The session aggregate manages interaction ownership and run association, for example:

    • Initiating principal and access scope;
    • Conversation order;
    • Run association;
    • Session closure and retention policies.

    However, all historical messages, step logs, and tool results should not be loaded at once as part of the session object. Frequently updated run states, message records, and execution events should use bounded loading and independent persistence to avoid an unbounded aggregate.

    If the business requires runs to have independent and complex strong consistency constraints, runs may also need to be promoted to independent aggregate roots. Two aggregate roots are a starting point, not a permanent limit on the number.

    3. Split storage responsibilities by data nature

    Configuration and business metadata are suitable for transactional storage. Large attachments and execution artifacts can use object storage. Knowledge retrieval indexes provide query acceleration. Caches store rebuildable derived state. Message queues are used for asynchronous execution and event distribution.

    It must be clear which system stores the authoritative facts. For example, a retrieval index is not a permission database, and a cache is not the sole basis for the final state of a run.

    When cross-store writes fail, retry, reconciliation, and compensation mechanisms should exist. For events that must be reliably sent after a database commit, a pattern of storing pending events within the transaction and asynchronously delivering them after commit can reduce the risk of state being updated while the event is lost.

    VIII. Tool Execution and Security Governance: Let Agents “Do Things” Without Exceeding Authority

    A model can propose action suggestions, but final authorization must be completed by deterministic server-side rules.

    1. Divide tool invocation into four stages

    Proposal stage: The model provides tool selection and parameters.

    Validation stage: The platform checks input structure, resource scope, identity permissions, and invocation budget.

    Confirmation stage: High-risk actions require human confirmation or approval.

    Execution stage: The tool adapter performs the actual operation and records the result and status.

    Actions involving data deletion, permission changes, or release changes should not be executed directly merely because the model considers them “necessary.”

    2. Treat retrieved content as data, not instructions

    Knowledge documents, logs, and content returned by external tools may contain misleading text. The platform should clearly distinguish system constraints, user tasks, and external material. Retrieved content must not be allowed to override authorization rules.

    Sensitive data should also be minimized before entering the model, and run logs should not store secrets, credentials, or personal information in full by default.

    3. Define real semantics for retries and cancellation

    A network timeout does not mean the operation did not occur. For tools with side effects, idempotency controls, execution status queries, or manual review paths should be provided. Unconditional repeated calls are not acceptable.

    After a user cancels a task, steps that have not started should be stopped. Operations already submitted to external systems may not be reversible, and their status must be shown truthfully. The platform must not misreport “stopped waiting for results” as “business operation canceled.”

    IX. From Prototype to Production: Deliver Gradually According to Risk

    Phase 1: Validate a single business loop

    Choose a task with clear boundaries and low risk, such as internal document Q&A or read-only log analysis. First define success criteria, input sources, output format, and non-executable actions, then implement model invocation, basic retrieval, and run records.

    Even for a prototype, it is advisable to retain tenant, agent version, and run identifiers so that traceability is not lost and later rebuilt.

    Phase 2: Solidify the static skeleton

    Establish a unified domain model, release process, version snapshots, module boundaries, and permission checks, and converge tool invocation into one controlled entry point.

    The focus of this phase is not to add more features, but to prove that new capabilities cannot bypass existing governance mechanisms.

    Phase 3: Expand access channels

    Connect business pages, open APIs, and local development entry points. Verify that when the same user accesses through different channels, permission decisions, version selection, and audit records remain consistent.

    Context automatically carried by callers should undergo source identification, structure validation, and resource permission validation.

    Phase 4: Improve reliability and operations mechanisms

    Complete rate limiting, timeouts, retries, circuit breaking, exception recovery, canary releases, and cost accounting. Cost should not only count model input and output consumption, but also consider retrieval, tool invocation, and other execution resources, and should be aggregated by tenant, agent, and run.

    X. Launch Acceptance: Look at Platform Behavior, Not Just Answers

    Enterprise agents require at least three types of acceptance.

    Task effectiveness acceptance: Check answer accuracy, evidence association, tool selection, and task completion. Use a fixed test set and also cover scenarios involving unanswerable questions, insufficient permissions, and incomplete input.

    Security and reliability acceptance: Verify that unauthorized requests are rejected, sensitive operations require confirmation, duplicate requests do not produce uncontrolled side effects, and tool failures are not packaged as successful results.

    Architecture governance acceptance: Verify that a run can be traced to the correct version, new channels do not need to duplicate core capabilities, disabled agents can block new requests according to policy, and both configuration changes and run facts have audit records.

    A truly sustainable agent platform does not put every requirement into an increasingly complex execution loop. Instead, it governs capability definitions, channel access, version changes, and runtime state separately.

    Models determine what an agent can understand, and tools determine what it can execute. Domain boundaries, permission rules, and data skeletons determine whether the system can safely serve more business scenarios over the long term.