Enterprise Agent Architecture: A Layered Approach to Execution and Governance

    This article explains why a working AI agent prototype is not the same as a production-ready system, and how separating the agent execution kernel from the application and governance layer solves the problem. It covers the responsibilities of each layer, why the split is not duplicated effort, a reference architecture with a sample execution contract, a practical implementation checklist, and common anti-patterns to avoid.

    Enterprise Agent Architecture: A Layered Approach to Execution and Governance

    1. The Starting Problem: Why “It Runs” Is Not the Same as “Ready to Ship”

    When many teams first adopt agent capabilities, they treat the agent as just a larger function to call: write a prompt, wire up a few tools, and call it done once a result comes back. The pilot looks impressive. But as soon as the system enters real business workflows, the problems surface all at once: call chains are invisible, failures cannot be reproduced, business users cannot adjust the flow, permission boundaries are blurry, and knowledge updates drift away from what is actually running in production. The end state is a familiar one: engineers are stuck firefighting, business stakeholders cannot participate, and the project gets shelved the night before launch.

    The root cause is not mysterious. An agent system carries two fundamentally different kinds of concerns at the same time. One is the runtime concern: how the model is invoked, how tools are executed, and how failures are caught and replayed. The other is the delivery and governance concern: how non-engineering roles adjust the flow, how knowledge is maintained, how access is authorized, and how every change is traced. Collapsing both into a single layer looks convenient in the short term, but it inevitably spins out of control over time.

    2. Splitting Responsibilities: The Execution Kernel and the Governance Layer

    2.1 The Execution Kernel: Making the Model Actually Act

    The execution kernel is developer-facing and is essentially an agent runtime. It typically handles:

    • A unified wrapper for model calls, with retry, timeout, and rate-limiting policies;
    • A tool execution environment, including file read/write, command execution, and sandbox isolation;
    • Recording and replay of reasoning traces, so you can pinpoint “why did it make this decision”;
    • Context assembly, meaning the stitching together of prompts, message history, retrieved snippets, and tool return values.

    The problem it solves: how AI can run safely and repeatably, and actually operate on the external world.

    2.2 The Application and Governance Layer: Making the Enterprise Confident Enough to Use It

    The governance layer leans toward low-code orchestration and enterprise delivery. Typical capabilities include:

    • Visual flow orchestration, where branches, loops, parallelism, and human approvals are drawn as a graph;
    • Knowledge bases with retrieval augmentation, where uploaded documents become searchable and citable;
    • Multi-model access and switching, making it easy to balance cost and quality per scenario;
    • Application publishing in forms such as conversational apps and external APIs;
    • Governance capabilities such as logging, permissions, versioning, and canary rollout.

    The problem it solves: how business users use it, change it, and audit it.

    To align the relationship in one sentence: the execution kernel makes the agent capable of doing the work; the governance layer makes the enterprise confident enough to use the agent.

    3. Why Layering Is Not Duplicated Effort

    The usual objection to layering is that “the features look like they overlap.” But look closely and only the surface-level entry points overlap; the underlying goals are different.

    • Different abstraction levels: the runtime exposes deterministic, function-level interfaces, while the governance layer exposes visual, flow-level semantics. The former is built for invocation; the latter is built for collaboration.
    • Different change frequencies: model and tool strategies evolve quickly and belong to engineering iteration, while business flows and knowledge content change with the business, at a higher frequency and with a requirement for zero-downtime adjustments. Mixed into one layer, a change on either side drags the other along.
    • Different owners: the runtime is owned by R&D, while the governance layer is usually a joint effort across business, operations, data, and other parties. Without layering, there is nowhere for permissions and auditing to land.
    • Different failure modes: typical runtime failures are timeouts, sandbox escapes, and tool exceptions; typical governance failures are misconfigured flows, stale knowledge, and unauthorized access. Their observability metrics and remediation approaches are entirely different.

    4. Reference Architecture and Key Interface Contract

    A practical layered structure looks roughly like this (illustrative):

    1. Business apps / Conversational entry / External APIs
    2. ↓
    3. Application & Governance Layer (orchestration, knowledge, permissions, versioning)
    4. ↓ Unified execution contract
    5. Agent Execution Kernel (model, tools, sandbox, trace)
    6. ↓
    7. Infrastructure (container platform, object storage, message queue, logging, monitoring & alerting)

    The two layers should agree on a stable execution contract so that the governance layer does not depend directly on the runtime’s internal implementation:

    1. {
    2. "run_id": "r-20260812-0001",
    3. "flow_version": "v3",
    4. "input": {"query": "..."},
    5. "tools": [{"name": "search_kb", "timeout_ms": 3000}],
    6. "policy": {"allow_side_effect": false, "max_steps": 8},
    7. "trace_sink": "log_service"
    8. }

    Here, policy states explicitly whether side effects are allowed and what the maximum number of steps is; trace_sink points to the logging service, ensuring traces can be collected. The governance layer only cares about the contract fields, and the runtime can swap implementations independently.

    5. Implementation Checklist

    1. Define boundaries before choosing tools: list “orchestratable flow semantics” and “executable atomic capabilities” as two separate tables, and only discuss tooling once the boundary is clear.
    2. Default to least privilege: tool allowlists, side-effect switches, and restricted sandbox network egress; default to deny rather than default to allow.
    3. Observability first: instrument four metric categories first — traces, latency, token consumption, and tool success rate — and only then talk about optimization.
    4. Close the knowledge governance loop: document ingestion needs versioning and invalidation policies, and retrieval results must be traceable back to the source snippet.
    5. Human-in-the-loop nodes: insert human approval before high-risk actions, and fold the approval records into the audit trail.
    6. Canary and rollback: canary the flow version and the model version separately, so that an anomaly in either dimension can be rolled back independently.
    7. Keep cost under control: choose the model tier per scenario, and cache repeated retrievals and repeated call results.

    6. Common Anti-Patterns

    • Scattering prompts across business code, making unified evaluation impossible;
    • Letting business users directly change runtime parameters, with no approval or rollback;
    • Recording only the final output and not the intermediate trace, so failures cannot be reproduced;
    • Tightly coupling knowledge and flows, so a document update requires a release;
    • A permission model with only “on/off”, with no granularity per tool or per data domain.

    7. Conclusion

    The value of adding a layer is not more features. It is separating two sets of concerns that differ in change speed, ownership, and failure mode, so each can be governed on its own terms. The execution kernel is responsible for “being able to do it”; the governance layer is responsible for “keeping it under control.” Built on the general-purpose infrastructure of cloud platforms such as Baidu AI Cloud, and carried by common capabilities like container platforms, object storage, message queues, logging services, and monitoring and alerting, these two layers let teams put their energy back into the business itself, instead of repeatedly patching cracks in the architecture.