Open-Source Execution-Oriented AI Agents: Architecture and Implementation

    This article explains how execution-oriented AI agents move beyond text generation to actually operate enterprise systems. It introduces a four-layer reference architecture—gateway, agent, skill, and memory—detailing the engineering constraints of each layer, and outlines a four-step enterprise adoption roadmap covering scenario selection, sandbox validation, gradual rollout, and platform consolidation. It also highlights key risk and governance requirements, such as least privilege, human confirmation for high-risk actions, end-to-end observability, and cost control. Developers and decision-makers will find practical guidance on building reliable, observable, and maintainable agent systems.

    1. From Conversation to Execution: Why AI Agents Matter Now

    Over the past few years, progress in generative AI has largely focused on one dimension: language understanding and content generation. Models can write copy, answer questions, and summarize documents. But when a task needs to reach into actual systems—checking inventory, changing configurations, creating tickets, or running reports—the model often stops at the “suggestion” stage. The industry has gradually reached a consensus: AI that can deliver results is the AI that enterprises truly need.

    The rise of execution-oriented AI agents is not a marketing phenomenon. It is the result of three conditions maturing at the same time. First, model reasoning and tool-calling capabilities have become stable. Second, enterprise-side APIs and automation infrastructure have become widespread. Third, the engineering community has formed a relatively unified understanding of an agent runtime that is “orchestratable, observable, and rollback-capable.” Together, these three factors have transformed AI from a content production tool into a process execution unit.

    2. A Four-Layer Reference Architecture: Decoupling “Thinking” from “Doing”

    A practical agent system can usually be abstracted into four layers. The value of layering is to separate the volatile parts from the stable ones: models will be replaced, protocols will change, and business skills will be added or removed, while memory and governance need to accumulate over the long term.

    Layer Core Responsibility Key Design Points Traditional Pain Point Solved
    Gateway Layer Unified access, routing, authentication Multi-protocol adaptation, rate limiting and circuit breaking Every application rebuilds its own interfaces
    Agent Layer Intent understanding, task orchestration, decision-making Plan-execute-validate loop Can only produce text, cannot operate
    Skill Layer Atomic capability encapsulation Idempotency, retryability, hot-pluggability Capabilities tightly coupled with implementation
    Memory Layer Context and state persistence Short-term buffer + long-term retrieval Every session starts from scratch

    2.1 Gateway Layer: The Engineering Value of a Unified Entry Point

    The gateway layer handles three types of responsibilities: protocol standardization (a unified external interface with adaptation to different model services internally), fine-grained access control (role-based and attribute-based access control), and traffic governance (rate limiting, circuit breaking, and graceful degradation). In enterprise environments, this layer is often the first checkpoint for auditing and cost allocation. All calls are logged, making it easier to optimize token consumption and failure rates later.

    2.2 Agent Layer: Turning Natural Language into Executable Workflows

    The core of the agent layer is the “plan-execute-validate” loop. A simplified pseudocode skeleton is shown below:

    1. def run(goal, ctx):
    2. plan = planner.decompose(goal, ctx) # Task decomposition
    3. for step in plan:
    4. result = executor.call(step.skill, step.args) # Invoke atomic skill
    5. if not validator.check(step, result): # Validate result
    6. plan = replanner.repair(plan, result) # Replan on failure
    7. ctx.memory.write(step, result)
    8. return ctx.summary()

    The key here is not how powerful the model is, but whether failure handling is complete. Timeouts, missing parameters, insufficient permissions, and unexpected results all need explicit branches, rather than throwing errors directly at the user.

    2.3 Skill Layer: Engineering Constraints for Atomic Capabilities

    The skill layer is the most underestimated. A reliable skill should at least satisfy the following: idempotency (repeated calls produce no side effects), retryability (distinguishing retryable from non-retryable errors), clear input and output schemas (for validation), and least privilege (requesting only the necessary scope). Skills are registered as plugins and support hot-pluggability, so business capabilities can be extended without restarting the system.

    2.4 Memory Layer: Cross-Session Continuity

    Memory is usually divided into working memory (current task context), episodic memory (historical execution traces), and semantic memory (accumulated business knowledge). In engineering practice, a combination of “short-term buffer + vector retrieval + structured storage” is commonly used. Retention policies and desensitization rules must also be defined to prevent sensitive information from persisting indefinitely.

    3. Enterprise Adoption Roadmap: Four Steps

    1. Scenario selection: Prioritize high-frequency processes with relatively clear rules and controllable failure costs, such as internal data queries, report generation, and ticket dispatching.
    2. Sandbox validation: Run the full loop with read-only permissions in an isolated environment, focusing on failure rates and human takeover rates.
    3. Gradual rollout: Open access progressively by department or traffic percentage, with monitoring, alerting, and logging in place, and establish a rollback switch.
    4. Platform consolidation: Solidify the skill library, memory policies, and permission templates into internal platform capabilities, combined with container platforms and message queues to achieve elasticity and decoupling.

    4. Risks and Governance

    The risk of execution-oriented agents lies not in “saying the wrong thing” but in “doing the wrong thing.” Four constraints must therefore be enforced: least privilege and operation whitelists; mandatory human confirmation for high-risk actions; end-to-end observability (every decision traceable to its input, skill, and result); and cost and quota management to prevent resource waste from cyclic calls. In addition, model output is inherently uncertain, so critical validation should rely on deterministic rules rather than model self-assessment.

    5. Conclusion

    The essence of execution-oriented AI agents is to connect the language capabilities of large models to existing enterprise systems and processes, encapsulating uncertainty within controllable boundaries through a layered architecture. For developers, the focus is on skill encapsulation and observability. For decision-makers, the focus is on starting from low-risk scenarios and reusing capabilities through platformization. Baidu AI Cloud continues to invest in general-purpose infrastructure such as container platforms, logging services, and monitoring and alerting, which can support the engineering implementation of such systems.