Building Extensible Programming Agents: A Modular Design Approach

    The competitiveness of programming agents is shifting from built-in tool capacity to composable, programmable, and extensible architectures. This article explores a modular design approach for building extensible programming agents, drawing inspiration from sandbox games. It covers the limitations of fixed agent shells, the importance of an event-driven timeline as a core abstraction, and a four-tier mode architecture ranging from standard orchestration to meta-mode creation. Additionally, it discusses security governance, observability, and practical implementation strategies to transform agents from standalone tools into extensible platforms.

    Building Extensible Programming Agents: A Modular Design Approach

    After extensively testing a class of locally executed programming agents, one conclusion has become increasingly clear: the competitiveness of programming agents is shifting from “how many built-in tools they have” to “whether the shell is composable, programmable, and extensible.” Common fixed programming agents in the industry typically hardcode capabilities such as file editing, command execution, search, planning, and sub-agents into a single main workflow. Users can only operate in the ways pre-designed by the product. In the short term, this form is stable and has a low barrier to entry; in the long term, it struggles to adapt to different models, tasks, and engineering constraints of different teams.

    More interestingly, some products are beginning to reconstruct their shells using a “sandbox game-style” approach: the base provides the workspace, sessions, tool calls, event timeline, and sandbox, while modes are loaded on demand like mods. The standard mode offers full capabilities; the programmatic tool calling mode merges multiple round-trips into a single script execution; the minimal benchmark mode retains only the most basic tools to observe the model’s raw capability; and the meta-mode is used to create new modes. The key to this direction is not “having many modes,” but turning modes into declarable, registrable, verifiable, and governable engineering objects.

    1. The Bottleneck of Fixed Shells: Capability Stacking is Not Extensibility

    Fixed programming agents often carry an implicit assumption: tasks can be completed along a linear process of “read file — think — modify code — run command — view result.” However, real development tasks vary greatly. Small bug fixes require rapid localization and minimal changes; cross-repository refactoring requires planning, sub-agents, and batch verification; security audits require stricter permissions and manual confirmation; and model benchmarking requires stripping away shell assistance to observe the model’s own capabilities. If all scenarios share the same tool exposure method and orchestration strategy, two problems arise: simple tasks are slowed down by complex shells, while complex tasks are limited by the product’s preset workflows.

    Therefore, the first principle of an extensible programming agent is layering: the base is responsible for sessions, workspaces, tool gateways, the event bus, sandboxes, and audits; the mode is responsible for capability sets, orchestration strategies, tool exposure methods, permission policies, and UI presentation. A mode is not a simple toggle, but a versionable “capability package.” This way, the product does not need to rewrite the main workflow for each scenario but instead loads different modes on the same runtime.

    2. The Execution Model Behind the UI: Timeline as the Core Abstraction

    These products are typically presented through a web UI: the left side organizes sessions by workspace, where one workspace corresponds to a local project directory; the middle is the conversation area; and the right side or bottom unfolds each tool call step via a timeline. After a user submits a request, the agent reads files, writes code, executes commands, and runs tests, with each step forming an observable event. The overall feel is somewhere between a local programming assistant and a web development environment, but execution occurs on the user’s own machine or in a controlled environment.

    What truly matters is not the UI, but the execution model behind the timeline. A task should be modeled as a sequence of events, such as: requirement parsing, plan generation, tool call, tool result, file change, command execution, test result, manual confirmation, and rollback point. Each event contains the input, output, duration, permission decision, associated task, and replayable context. Only through event-ization can the process be auditable, failures localized, modes replaceable, and benchmarks reproducible.

    The illustrative pseudo-code is as follows:

    1. task_event:
    2. type: tool_call | tool_result | patch | command | test | confirm | rollback
    3. task_id: string
    4. actor: model | user | system
    5. capability: string
    6. input_ref: artifact
    7. output_ref: artifact
    8. policy_decision: allow | deny | require_confirm
    9. timestamp: time

    The timeline is not a log decoration, but the “source of truth” for the agent runtime. Programmatic tool calls, minimal benchmark mode, and meta-mode creation should all be built on this unified event model.

    3. The Four-Tier Mode Hierarchy: From Full Capability to Raw Benchmarking to Mode Creation

    The first type is the Standard Orchestration Mode, which provides full capabilities: file read/write, command execution, file search, web search, planning, goal management, sub-agents, and workflows. It is suitable for most daily development tasks, focusing on optimizing tool descriptions, context management, and failure recovery. The standard mode should not expand indefinitely but should group capabilities through a tool gateway, dynamically exposing the minimal toolset according to the task phase to prevent the model from getting lost among too many tools.

    The second type is the Programmatic Tool Calling Mode. Traditional tool calling is a back-and-forth process: the model calls a tool once, waits for the result, and then decides the next step. Complex tasks may require a dozen round-trips, causing intermediate results to flood the context, which increases overhead and easily pollutes reasoning. The programmatic mode exposes tools to the model through a code execution interface. The model directly generates a typed script to complete multiple tool operations in the sandbox at once. For example, it can batch-read multiple files, filter results, generate patches, and execute verification, merging ten round-trips into a single program execution.

    The benefits are clear: fewer interaction rounds, reduced context noise, and improved atomicity and reproducibility for multi-step operations. However, the costs are equally clear: scripts require sandboxing, timeouts, concurrency limits, error handling, and idempotent design; the tool gateway must provide stable descriptions and permission boundaries; and the execution process must be replayable and auditable. Programmatic calling does not mean handing all tools directly to the model, but rather exposing a curated set of functions while recording script inputs, execution traces, and artifact references.

    The third type is the Minimal Benchmark Mode, which retains only a persistent command executor and a file editor. Its purpose is not to improve daily efficiency but to subtract: removing shell assistance like planning, sub-agents, and workflows to observe the model’s true capabilities under minimal tool conditions. The benchmark mode must unify tools, context budgets, retry strategies, and failure criteria; otherwise, results from different models are incomparable. It can also be used for regression testing: when the shell is upgraded, the minimal mode confirms that the model’s capabilities are not masked by shell changes.

    The fourth type is the Meta-Mode, which is the “mode for creating modes.” This is the most valuable yet most restraint-required capability. The meta-mode should not allow the model to arbitrarily modify the product, but should allow experts to declaratively define new modes: select capability sets, map tool gateways, write orchestration state machines, configure permission policies, define UI presentations, and add test cases, followed by offline replay, gray release, and version management. Mode packs should be loadable like plugins but must pass signature verification, permission review, and compatibility checks.

    4. Sandbox Game-Style Extension: The Base World and Modpacks

    Using the modding mechanism of sandbox games as an analogy, the base of an extensible programming agent provides the “world rules”: workspace, sessions, event bus, tool gateway, sandbox, permissions, audit, and replay; mode packs provide the “new blocks and recipes”: capability declarations, tool adapters, orchestration scripts, UI extensions, and test cases. Just as game mods cannot bypass the engine’s security boundaries, modes cannot bypass runtime permissions. Games have save files and replays, and agents should have task snapshots and event replays. Game mods require version compatibility, and mode packs also require runtime version constraints and test matrices.

    The advantage of this architecture is that the product does not have to hardcode all scenarios into fixed features, but instead hands the right to extend to controlled mode developers. Enterprises can define “code review mode,” “migration mode,” or “security audit mode” according to team standards and run them under unified auditing. An illustrative mode declaration can be written as:

    1. mode "review":
    2. capabilities: [file.read, file.search, command.test, plan, subagent]
    3. exposure: minimal
    4. policy:
    5. file_write: deny
    6. command_exec: allowlist
    7. network: deny
    8. ui:
    9. timeline: expanded
    10. diff: read_only
    11. tests: [smoke_review, permission_denied]

    Note that the mode declaration only describes intent and constraints; specific execution is still interpreted and audited by the runtime. The declaration itself should not be treated as a security boundary.

    5. Security Governance and Observability: Prerequisites for Extensibility

    The more programmable the modes, the more critical security governance becomes. First is least privilege: the file system is restricted to the workspace, command execution uses a whitelist or requires manual confirmation, network access is authorized by domain and purpose, and write operations retain diff views and rollback points. Second is sandbox isolation: programmatic scripts execute in a restricted environment with set limits for timeout, memory, concurrency, and call counts, prohibited from escaping to the host environment. Third is audit and replay: recording mode versions, tool calls, permission decisions, artifact hashes, and manual confirmations to ensure issues are traceable.

    Observability should cover three levels: at the task level, examining goal completion and failure causes; at the event level, examining tool call chains and durations; at the mode level, examining the success rate, rollback rate, and manual intervention rate of different modes. Without these metrics, mode extension devolves into mere capability stacking. On platforms like Baidu AI Cloud, general-purpose services such as container platforms, object storage, and logging/monitoring services can host the execution environment, archive artifacts, and manage observability data, but the core remains the runtime’s own event model and permission model.

    6. Implementation Advice: Build the Runtime First, Then the Mode Marketplace

    For enterprise implementation, it is recommended to unify the runtime first: solidify sessions, workspaces, tool gateways, event timelines, sandboxes, and auditing before opening up mode registration. Mode packs should be versioned, carrying compatibility declarations and test cases; the release process should include offline replay, permission review, gray release, and small-traffic validation. For model benchmarking, the minimal mode and budget should be fixed to prevent shell differences from skewing conclusions. For programmatic tool calling, start with read-only, batch, and rollbackable tasks before gradually expanding to write and command execution.

    In summary, the true direction of such products is not “to build a stronger fixed programming assistant,” but to turn the programming agent shell into an extensible runtime. The standard mode ensures general efficiency, the programmatic mode optimizes multi-step execution, the minimal mode provides a fair benchmark, and the meta-mode hands the right of extension to a controlled engineering system. Viewed through the modular lens of sandbox games, a stable base, pluggable modes, governable permissions, and replayable processes are the keys to evolving programming agents from standalone tools into platforms.