Unified Agent Stack: A Deep Dive into the Three-Tier Interface Architecture
The tech industry is shifting its focus from raw model capabilities to comprehensive agent runtime environments. This article explores the unified agent stack, detailing a three-tier interface architecture—terminal, GUI, and API—built upon a single execution kernel. It further analyzes how the "harness" creates a competitive moat and provides actionable engineering practices for permission management, CI/CD integration, observability, and cloud deployment.
I. Beyond the Phenomenon: From Model Supply to Runtime Supply
A product launch aimed at non-technical users may present itself as a new “general office assistant,” but it is fundamentally an interface expansion of an intelligent programming engine. The critical takeaway from such events is not the addition of new features, but the reuse of the same underlying execution kernel. When a single kernel simultaneously supports developer terminals, business-oriented graphical interfaces, and enterprise automation APIs, the product narrative shifts from “model capability” to “agent runtime capability.”
The technical motivation for this shift is clear: model capabilities are rapidly converging and becoming highly interchangeable. The engineering components built around the model—such as context assembly, tool calling, permission boundaries, session recovery, error retries, and artifact persistence—are what truly determine practical usability. Whoever controls the runtime environment controls experience consistency and the data feedback loop.
II. Three-Tier Interfaces: One Kernel, Three Human-Machine Relationships
The core design principle of a unified stack is “one kernel, multiple shells.” The three tiers are not three separate implementations, but projections of the same execution loop across different interaction mediums.
- Terminal Interaction Layer (Engineering Roles): Uses a character interface to deliver streaming output, diff reviews, and scriptable composition. It emphasizes orchestration and pipeline integration, making it ideal for codebase-level transformations and batch refactoring.
- Graphical Interaction Layer (Business Roles): Wraps the same kernel into a working interface that uses documents, spreadsheets, and presentations as inputs and outputs. It abstracts away command and path concepts, emphasizing “previewable, reversible, and deliverable” results.
- API Interaction Layer (System Integration): Exposes the same capabilities in a headless mode for pipelines, scheduled tasks, and background services. It emphasizes structured input/output, deterministic exit codes, and retryable failures.
The shared abstraction across all three tiers can be summarized as a minimal contract:
Input: Task description + Workspace context + Allowed resource listProcess: Plan → Tool call → Observe result → Revise (bounded loop)Output: Structured result + Changeset + Execution trace
As long as this contract remains stable, adding a fourth tier (e.g., mobile or voice) requires no changes to the kernel. This is the most significant engineering benefit of this architecture.
III. Why the Harness Becomes a Moat
The “harness” refers to the entire suite of constraints and execution mechanisms outside the model itself: system prompts, context budget allocation, tool registration and calling protocols, sandbox and file system isolation, termination conditions, logging, and auditing. Its value lies in three aspects.
First, controllability. The same model behaves vastly differently under various context assemblies and toolsets; the runtime environment is the primary tuning knob for quality. Second, portability. Once the runtime environment becomes standardized, the underlying model can be replaced without affecting upstream delivery. This serves as both a vendor’s moat and a user’s bargaining chip. Third, compliance boundaries. Declarative permission configuration turns “what the agent can do” into an auditable asset rather than a verbal agreement scattered across prompts.
IV. Defensive Logic Against “Thin Wrappers”
When subscription-based compute power is repackaged and resold at low prices, upstream vendors typically respond not with price wars, but by tightening runtime access: restricting headless calling patterns, requiring identifiable call sources, and implementing risk controls against abnormally high frequencies and shared sessions. The implication for integrators is clear: do not build “agents of agents.” Focus your value on vertical data, domain-specific tools, and deliverable quality.
V. Actionable Engineering Practices
1) Least Privilege and Declarative Policies
workspace: ./repoallow:read: ["src/**", "docs/**"]write: ["src/**"]exec: ["test", "lint"]deny:read: [".env", "secrets/**"]write: ["infra/prod/**"]budget:steps: 40tokens: 200000
2) Integrating Headless Mode into Pipelines
agent run --task-file task.yaml \--workspace ./repo \--policy policy.yaml \--output json > result.jsonecho $? # 0 for success / non-zero indicates manual intervention required
The key is to design the agent as a “build step that can fail”: express artifacts as changesets, let existing code review processes handle evaluation, and route failures to retry or manual queues.
3) Observability Triad: Structured execution traces (intent, tools, parameter summaries, and result status for each step); metrics (number of steps, tool failure rate, cost per task, manual rework rate); alerts (non-convergent loops, unauthorized access attempts, cost overruns).
4) Context Engineering: Prioritize retrieval over massive context injection. Tailor the context window to the task, and externalize long-term knowledge into a searchable knowledge base and vector index to avoid hardcoding domain knowledge into prompts.
5) Cloud Hosting: Headless workloads are well-suited for container platforms, combined with object storage for artifacts, message queues for task distribution, and logging and monitoring services for auditing and cost attribution. Cloud platforms such as Baidu AI Cloud typically provide these general-purpose capabilities, allowing you to combine them as needed without being locked into proprietary interfaces.
VI. Evolution Trends and Selection Advice
Expected trends include: more interface tiers while the kernel remains stable, standardization of tool protocols, state persistence and checkpoint resumption for long tasks becoming standard, and a shift from “generating code” to “generating and verifying deliverables.” For team selection: technical roles should start from the terminal layer to establish engineering standards; business roles should start from the graphical layer to validate value density; platform teams should directly build the API layer, treating permissions, auditing, and cost as first-class citizens. Sharing a single set of policies and trace formats across all three tiers is the true long-term benefit of this architecture.
