How a Dual-System Agent Framework Supports Engineered AI Agent Delivery

    Deploying AI agents in production requires more than prompt orchestration. This article explains a dual-system agent framework that separates high-frequency, bounded decisions handled by a lightweight local decision model from complex planning and review handled by a large language model. It outlines a unified runtime with access, decision, execution, and governance layers; shows how layered decision-making can reduce cost and latency; and describes the observability, evaluation, rollback, permission, audit, and environment adaptation capabilities needed for forward-deployed engineering. It also covers contract-centric extension and a practical rollout path from small closed-loop scenarios to reusable delivery templates.

    Moving agents from demos to production is rarely about whether they can answer a question. The harder problem is whether they can be embedded into business processes with stable behavior, low cost, and operational manageability. In forward-deployed engineering (FDE) delivery scenarios, teams must quickly connect models, tools, skills, and business systems in customer environments while meeting engineering requirements such as response speed, permission isolation, audit trails, version management, and canary rollback. A usable open-source agent runtime and extension framework should therefore not be merely a prompt orchestrator. It should serve as a unified runtime foundation: adapting to models and compute below, carrying business intent above, connecting tools and data horizontally, and retaining observability and governance.

    1. The Core Engineering Tension: Complex Planning and Instant Judgment Mixed Together

    Many agent projects can get a process working in the early stage, but after entering production they run into two types of problems. The first is cost and latency: many requests are actually high-frequency mechanical judgments such as whether a button can be clicked, whether device readings are stable, or where a process should go next, yet every request calls a large-parameter language model for full reasoning. The second is stability and maintainability: complex intent understanding, global task planning, and simple routing logic are coupled in the same call chain, making exception localization difficult, evaluation criteria vague, and version upgrades risky.

    A better approach is to layer decisions. The slow system is handled by a regular large language model and is responsible for understanding complex business intent, decomposing tasks, creating global plans, and handling open-domain issues. The fast system is handled by a lightweight decision model deployed locally, on a single machine, or in a runtime environment close to the business. It specializes in high-frequency, mechanical, clearly bounded instant judgments, such as tool selection, workflow transition, request routing, parameter validation, and initial risk screening. The fast system pursues near-real-time response and reduces unnecessary cloud round trips; the slow system intervenes only in complex or high-risk scenarios. This preserves the semantic understanding and planning capabilities of large models while avoiding the call overhead and wait time caused by using a large model for a small task.

    It is important to emphasize that the dual-system approach is not simply splitting models into large and small versions. It establishes a clear escalation and fallback mechanism: the fast system provides candidate actions and confidence scores; when risk is low and confidence is high, the action executes directly; when confidence is insufficient, the action involves sensitive operations, or business rules conflict, the request is escalated to the slow system for review. This mechanism should be managed uniformly by the runtime framework rather than scattered across business code.

    2. Unified Runtime Architecture: Decoupling Models, Tools, Skills, and Business Systems

    Engineered delivery requires the framework to provide a unified runtime abstraction. It can be summarized in four layers:

    1. Access layer: Receives requests from business systems, message queues, page events, or device events; performs identity recognition, rate limiting, idempotency, and context assembly.
    2. Decision layer: Runs the fast and slow systems. The fast system handles immediate classification, routing, and action selection; the slow system handles complex planning and review. Decision results should include the action, parameters, confidence, rationale summary, and escalation flag.
    3. Execution layer: Calls business systems through tool registration and skill abstraction. Tools should have explicit input/output contracts, permission declarations, timeout and retry policies; skills are reusable wrappers around multiple tool calls.
    4. Governance layer: Provides logs, metrics, tracing, replay, evaluation, audit, canary release, and rollback. The governance layer is not an auxiliary feature; it is key to whether on-site delivery can be accepted.

    This layering prevents models, tools, skills, and business systems from being hard-coded together. Delivery engineers can declare environment information, tool inventories, permission policies, and acceptance cases through configuration, turning field adaptation into versionable engineering assets.

    3. Cost and Response Speed: Replacing Full Large-Model Calls with Layered Decisions

    The economics of layered decisions come from the request distribution. In production systems, a large number of requests are repetitive, short-path, and rule-clear. If all are handed to a large model, cost grows linearly with call volume, and latency is affected by network and inference queuing. After high-frequency mechanical judgments are pushed down to a lightweight decision model, common paths can be completed locally, and only complex requests enter the slow system. The framework should support per-scenario thresholds: confidence thresholds, risk-level thresholds, business whitelists, tool permissions, and escalation policies. Thresholds should not be set by guesswork; they should be calibrated through offline evaluation and online canary release.

    The following pseudocode illustrates the idea:

    1. def handle_request(req):
    2. context = build_context(req)
    3. fast = fast_decider.predict(context) # Lightweight decision model: routing/tool selection/workflow transition
    4. if fast.confidence >= cfg.high_conf and fast.risk <= cfg.low_risk:
    5. return execute(fast.action, fast.args, context)
    6. plan = slow_llm.plan(req.intent, context) # Large language model: complex planning and review
    7. action = reconcile(fast, plan, context)
    8. if action.risk > cfg.risk_gate:
    9. action = require_approval(action, context)
    10. return execute(action.name, action.args, context)

    This example does not depend on a specific interface. The key points are: the fast system first provides low-cost candidates, the slow system intervenes on demand, and high-risk actions enter approval or manual confirmation. The framework should also record the reason for each escalation so that fast-system coverage and thresholds can be optimized later.

    4. Essential Capabilities for Engineered Delivery: Observability, Evaluation, and Rollback

    Field delivery cannot be judged only by demo performance. First, observability must cover requests, decisions, tool calls, and business results, forming searchable trace records; sensitive fields must be masked. Second, evaluability requires acceptance cases, regression cases, and failure samples to be included in version management, with regression run whenever prompts, models, tool contracts, or routing rules change. Third, rollbackability requires model versions, skill versions, tool configurations, and policy thresholds to be independently released and rolled back, with canary ratios and isolation by tenant or scenario. Fourth, permissions and audit must run through tool calls, ensuring least privilege, blocking unauthorized access, and leaving operation trails. Fifth, environment adaptation must support different deployment forms such as local, single-machine, container platforms, and edge nodes, and describe dependencies through an environment manifest.

    5. Extension and Integration: Contract-Centric, Not Call-Centric

    Extension capabilities should be designed around contracts: tool contracts define inputs and outputs, error codes, timeouts, and idempotency requirements; skill contracts define reusable flows and preconditions; model contracts define capability tags, context limits, cost levels, and degradation strategies. When adding a new business system, delivery engineers only need to register tools, declare permissions, and add evaluation cases without changing the core runtime logic. For common infrastructure such as object storage, message queues, container platforms, logging services, and monitoring and alerting, integration should be provided through a standard adapter layer, avoiding direct dependencies of business code on a specific environment.

    A practical path is to advance in stages: small-scenario closed loop, dual-system traffic split, governance completion, and scale replication. First, select high-frequency scenarios with clear boundaries and quantifiable outcomes to validate the fast system. Then introduce the slow system to handle complex intent and high-risk review. After that, complete logs, metrics, evaluation, permissions, and rollback. Finally, consolidate a skill library and delivery templates to form a repeatable engineered delivery method. The value of a dual-system agent framework is not to replace large models, but to place decision capabilities with different costs in the right positions so agents can run reliably, cost predictably, and be governed effectively in real business operations.