Building a Pluggable AI Agent Framework: Customization in Practice

    This article explores why the real bottleneck in AI agent deployment is the surrounding engineering infrastructure, known as the Agent Harness, rather than the model itself. It explains how a pluggable framework returns control to developers by treating tools, sandboxes, session storage, context management, sub-agents, and the main loop as replaceable plugins with lifecycles. The article covers enterprise customization using Profiles and Presets, splitting high-risk operations into three stages, how a full Harness differs from general orchestration frameworks, when a managed approach is preferable, and how to choose between them.

    1. The Real Bottleneck in Agent Deployment Is Not the Model

    Over the past two years, the most common challenge teams face when building agent applications has not been that “the model is not smart enough.” It is the layer of engineering infrastructure around the model: how tools are registered and discovered, how execution environments are isolated, how session state is persisted, how context is trimmed, how multiple subtasks run in parallel and are aggregated, and, most often overlooked, how the loop logic itself is controlled.

    The industry has gradually reached a consensus: the capability ceiling of an agent is usually determined by this surrounding “supporting structure” rather than by a single inference call.

    This supporting structure is commonly called an Agent Harness. It sits between the model and business systems, translating natural-language intent into verifiable actions and reorganizing execution results into observations the model can understand. A mature harness carries nearly all the work that happens outside the model.

    2. Framework Characteristics: Returning Choice to Developers

    Unlike an out-of-the-box product, the defining characteristic of a framework-based implementation is replaceability. Tools, sandboxes, session storage, context management, sub-agents, and even the main loop that drives the model through repeated thinking and acting are all abstracted into plugins with a lifecycle: register, assemble, replace, and unload.

    The following illustrative assembly logic (pseudocode, expressing only the plugin concept):

    1. harness = Harness(profile="finance")
    2. harness.load_plugin("sandbox.local", quota={"cpu": 2, "mem": "4Gi"})
    3. harness.load_plugin("tools.sql_query", scope="readonly")
    4. harness.load_plugin("session.persistent", backend="kv_store")
    5. harness.set_loop("plan_act_observe", max_steps=12)

    This design creates two very different experiences. For teams that need deep customization, the freedom is extremely high. For users who just want something that works out of the box, an additional integration layer is needed to hide the complexity. In practice, therefore, most users rely on a community integration package that preconfigures the interface, plugin set, default tools, and model configuration. But once you reach that point, the competitive dimension shifts from the framework back to product experience and workflow refinement.

    3. Enterprise Customization: Dividing Capability Boundaries with Profiles and Presets

    The scenario best suited to a framework-based approach is the internal enterprise agent. The recommended practice is to first divide Profiles by business domain, then use Presets to package role capabilities into a minimal usable set:

    • Finance domain: load only read-only database queries, report generation, and audit trail capabilities;
    • R&D domain: connect to code repositories, test environments, and diff-comparison tools;
    • Customer service domain: connect to the knowledge base, customer records, and ticketing systems.

    Each agent receives only a small set of capabilities needed for its current work, which both reduces the probability of misuse and shrinks the size of prompts and context. Only after capabilities are converged can the permission model be meaningfully discussed.

    4. Splitting Narrow Tools and High-Risk Operations into Three Stages

    One genuinely valuable point is that a company’s existing APIs can be wrapped into individual “narrow tools.” The model is responsible only for selecting actions and filling in parameters, while the tool side is responsible for validating identity, data scope, and risk level. The two responsibilities are separated.

    For high-risk actions such as payments, refunds, and permission changes, it is recommended to split them into three stages—preparation, approval, and submission—triggered by different parties and written to an audit log throughout. Credentials and sensitive data remain in the company’s own environment, and the model side only touches desensitized references. This way, even if the model makes a wrong judgment, it will not directly cause irreversible consequences.

    5. Differences from General Orchestration Frameworks

    General orchestration frameworks solve the problem of “how developers glue a model, tools, and processes into an agent,” which requires writing a fair amount of glue code yourself. A complete harness, by contrast, provides a ready-to-run supporting structure and makes each capability a plugin with a lifecycle that is replaceable and unloadable. Teams can therefore focus their energy on the business process itself. If an enterprise already has general capabilities such as a cloud container platform, message queues, object storage, and monitoring and alerting, these can be used directly as the runtime foundation for plugins, without rebuilding them.

    6. Not Every Need Should Be Handled by a Framework

    Cloud-hosted agents solve the problem in the opposite direction: the service provider takes on configuration, the runtime environment, and ongoing maintenance, so users can use it at any time. The former offers extreme controllability, while the latter offers extreme peace of mind, and both address real needs. Baidu AI Cloud’s value in these scenarios likewise lies in converging the complexity of the underlying infrastructure, allowing teams to focus on business orchestration and effectiveness evaluation.

    7. Selection Recommendations

    Teams that need deep integration with internal systems, have compliance and data-boundary requirements, and possess platform engineering capabilities are suited to building a plugin-based harness themselves. Teams that pursue a fast launch and lack maintenance manpower are better suited to a managed solution or a mature integration package. There is only one criterion for the decision: do you want to control the loop logic and tool boundaries, or do you simply want a result that runs?