AI Agent Platform Architecture: Four Hard Boundaries for a Static Skeleton
This article explains how to design the static skeleton of an enterprise AI agent platform so it can grow without turning into a mess. It covers four hard boundaries: a single agent domain model instead of type-based tables, three independent version tracks for configuration, orchestration, and runtime, six layers of one-way dependencies enforced by a zero-framework compile gate, and a five-level state ID scheme backed by a dual aggregate-root data foundation. It also gives a recommended implementation order and a five-question acceptance checklist.
1. Background: How Scope Creep Turns a Platform into a Swamp
Internal AI platforms in enterprises tend to evolve along a very similar path. In week one, the business side only wants an internal web Q&A window that can look up policy documents and search historical logs. By week three, the monitoring, alerting, and ticketing teams ask for a floating entry point in the bottom-right corner of the legacy system pages that automatically carries the application name, cluster ID, and ticket context of the current error page. Later, requests appear for pulling data across systems, adding manual approval checkpoints, and allocating token consumption by cost center.
If the team keeps accepting these requests on inertia, translates them into four separate product lines, and then builds four or five mutually disconnected entity tables in the admin console to follow popular concepts — a “basic Q&A agent,” a “knowledge retrieval agent,” a “multi-agent orchestration agent,” and “tool services” — four consequences usually show up within three months: the permission system splits into three, canary rules go their separate ways, changing one tool parameter requires syncing four places, and token costs cannot be reconciled at month end.
The root cause is not a runtime trick but the static skeleton set on day one: how domain entities are modeled, how version evolution is split into tracks, how code modules weld their boundaries, and how the underlying state and data backbone are partitioned. The four hard boundaries below are what separate “building depth” from “building a mess.”
2. Hard Boundary One: One Agent Domain Model, No Type-Enum Tables
The most common mistake is rushing to add a type field to the first core main table:
-- Counter-example: splitting entities by form factoragent_type = CHAT | RAG | WORKFLOW | MULTI_AGENT
This classification looks clean in a prototype, but it hits a wall within two weeks of real business use: enterprise business assistants are inherently composite across form factors. Take a “production triage 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 ops knowledge base — a knowledge retrieval form;
- Call the internal APIs of the logging service and the monitoring/alerting system to pull exception stacks — a tool invocation form;
- On suspecting a slow query, spawn a database diagnosis sub-agent to investigate concurrently — a multi-agent collaboration form;
- Once the fix requires scaling or rollback, drive a deterministic process with manager approval according to the change policy — a process orchestration form.
A single request spans all four form factors, so any “table per form factor” design is forced into cross-table assembly at runtime. The correct approach is to abstract a stable agent entity: identity and permission subject, instruction and prompt templates, model and parameter profile, the set of attached knowledge sources, the list of available tools, sub-agent collaboration relationships, process bindings, and quota and cost attribution. Form factor is no longer an entity classification but the result of a configuration combination.
{"agent_id": "agent_prod_triage","identity": { "owner": "ops", "data_scope": ["log", "metric", "kb"] },"instruction_ref": "tpl_v7","model_profile": "balanced","knowledge_refs": ["kb_runbook"],"tools": ["log_query", "metric_query", "ticket_create"],"sub_agents": ["agent_db_diagnose"],"workflow_ref": "change_approval","quota": { "cost_center": "ops-01" }}
The payoff is that the four cross-cutting capabilities — permissions, canary release, quota, and cost — each need to be implemented only once.
3. Hard Boundary Two: Three Non-Interfering Version Tracks
What is genuinely hard to manage about agents is not code but “multiple versions in use at the same time.” It is recommended to split evolution into three tracks:
- Configuration track: instruction templates, knowledge source attachments, tool switches, model parameter profiles. Highest change frequency; requires minute-level activation, canary release, and one-click rollback.
- Orchestration track: task decomposition strategy, sub-agent collaboration topology, process nodes and approval checkpoints. Changes are measured in weeks and require determinism and replayability.
- Runtime track: execution engine, tool protocol adapters, sandbox and resource scheduling. Changes are measured in months and must remain backward compatible.
The point of separating the three tracks is a controllable blast radius: changing a prompt should not trigger a runtime release, and upgrading the execution engine should not require rewriting all process definitions. The implementation essentials are an independent version number per track, independent canary dimensions (by tenant, by scenario, by user cohort), and an independent rollback unit, plus linking configuration snapshots and execution records with the same version number so that “why it answered that way at the time” stays traceable.
4. Hard Boundary Three: Six One-Way Dependency Layers and a Zero-Framework Compile Gate
Module rot almost always starts with circular dependencies. A recommended structure is six layers with one-way dependencies: upper layers may depend on lower layers; the reverse is strictly forbidden.
- Interface layer: multi-channel access and context pass-through (pages, tickets, alert sources);
- Application orchestration layer: session and task lifecycle;
- Domain layer: domain models and invariants for agents, knowledge sources, tools, and processes;
- Capability adapter layer: model invocation, retrieval, tool protocols, process engine adapters;
- Infrastructure layer: object storage, message queues, logging services, monitoring and alerting, container platform;
- Data backbone layer: core state and persistence.
This comes with a “zero-framework compile gate”: no framework or vendor-proprietary types may appear in the domain layer; adapters are forbidden from connecting laterally to each other, and cross-layer calls must go through port interfaces defined in the domain layer. The gate lives in the CI pipeline, and violations fail the build outright.
# Gate pseudocodefor dep in module.dependencies:assert layer(dep) < layer(module), f"Reverse dependency: {module} -> {dep}"assert no_framework_import(domain_layer)assert no_lateral_call(adapter_layer)
5. Hard Boundary Four: Five-Level Core State IDs and a Dual Aggregate-Root Data Foundation
Chaotic state identifiers are a direct cause of costs that cannot be reconciled. A unified five-level ID scheme is recommended: tenant, agent, session, task, execution. All token consumption, tool invocations, and retrieval hits attach at the “execution” level and roll up level by level, so cost allocation and rate limiting have a single source of truth.
The data foundation uses dual aggregate roots:
- Definition aggregate root: agent definitions, versions, configuration snapshots, emphasizing strong consistency and auditability;
- Runtime aggregate root: sessions, tasks, execution records, emphasizing high throughput and archivability, with hot/cold tiering and historical executions sinking to object storage.
The two are associated only through version numbers and IDs and do not share a write model, which avoids the disaster of “editing a config and incidentally editing history.”
6. Implementation Order and Acceptance Checklist for the Four Boundaries
Recommended order: first settle the domain model and the five-level IDs, then split the dual aggregate roots, then lock in the six-layer dependencies and the gate, and finally open up canary release across the three tracks. The acceptance self-check is five questions: Does adding a new form factor require a new table (should be no)? Does changing a prompt require a runtime release (should be no)? Can adapters call each other laterally (should be no)? Can costs be reconstructed line by line from execution records (should be yes)? Can historical executions be replayed by version number (should be yes)?
Baidu AI Cloud follows the same kind of layering and state partitioning approach in its general-purpose agent capabilities, and it can serve as a reference point during architecture review. As long as the static skeleton holds up, the platform can keep gaining depth rather than falling into disorder, no matter how many business scenarios are integrated later.
