Open Agent Runtime Architecture and Execution Trajectory Mechanisms: A Technical Deconstruction
This article examines open agent runtimes as constructible infrastructure rather than a single product. It outlines a seven-component decoupled architecture, compares four entry points and layered default configurations, explains why the session event log should serve as the runtime's source of truth, and describes execution trajectories as read-only projections of that log. It also presents a controlled comparison method for terminal-oriented coding tools and open runtimes, walks through a full-stack task with visual artifacts, and summarizes engineering priorities around default profiles, tool allowlists, sandbox network policy, log schema governance, and trajectory consistency.
1. From Product to Runtime: Understanding the Dual Identity of Open Agents
When an agent runtime framework is publicly released, public discussion often reveals two distinct sets of demands. One comes from end users, who expect an out-of-the-box, mature, cross-platform, and stable intelligent coding assistant. The other comes from platform developers, who focus on the plugin system, preset combinations, execution trajectory observability, permission policies, sandbox execution, and runtime self-modification capabilities. Both demands are reasonable, but they point to different dimensions of completeness.
From an architectural perspective, such systems have a dual identity as both a product and a runtime. As a product, they need to provide a desktop or terminal experience, stable cache hits, low-latency interaction, and daily coding efficiency. As a runtime, they need to decouple model providers, tool sets, session management, permission policies, sandbox execution, the agent main loop, and the interface layer, allowing developers to reassemble them as needed. The two are not mutually exclusive, but engineering completeness often appears structurally asymmetric: runtime openness may already be quite mature, while the default product experience has not yet caught up with common terminal-oriented intelligent coding tools in the industry.
This article does not recommend or rank a specific product. Instead, it abstracts the publicly available runtime as a class of infrastructure for constructing agents and discusses its entry forms, default configurations, session event logs, execution trajectory projection mechanisms, and how to compare execution differences between implementation paths under the same underlying model. The observational data mentioned here is used only to illustrate capability boundaries and does not constitute a basis for product ranking.
2. Architecture Overview: Seven Decoupled Components
The core value of an open agent runtime lies not in how many features are built in, but in which parts can be replaced and reassembled. A typical open runtime can be divided into the following seven components:
- Entry layer: package manager entry, web entry, headless command-line entry, and Python SDK entry. Different entries serve different usage scenarios but should share the same session and log semantics.
- Model provider adapter layer: abstracts different model capabilities into a unified interface for requests, responses, streaming events, and billing/token statistics.
- Tool set and plugin system: tools such as file read/write, terminal execution, code retrieval, browser rendering, and visual artifact generation are registered as plugins or tool descriptions, with allowlist and version constraint support.
- Session management and event log: persists user input, model messages, tool calls, permission decisions, execution results, and error events on a per-session basis.
- Permission policy and sandbox execution: applies policy control to file system, network, subprocess, environment variable, and external resource access, and executes high-risk operations in an isolated environment.
- Agent main loop: handles planning, model invocation, tool selection, observation of results, error repair, and termination decisions.
- Interface layer and trajectory projection: projects the underlying event log into visual execution trajectories, metric panels, and debugging views.
The key constraint across these seven components is: content visible to the model must already be persisted to the log. Only by writing to the source of truth first and then exposing it to the model can sessions be replayed, permissions audited, failures recovered, and context reproduced. Execution trajectories should not be side-channel monitoring based on independent instrumentation; they should be read-only projections derived from the session event log. This design determines the upper limit of system observability.
| User group | Core demand | Technical focus |
|---|---|---|
| End users | Mature intelligent coding assistant | Desktop and terminal experience, cross-platform compatibility, cache hits, daily coding efficiency, how much model capability the runtime can expose |
| Platform developers | Extensible agent infrastructure | Plugin system, preset combinations, execution trajectory observability, runtime self-modification and rollback capabilities |
3. Four Entry Points and Default Configuration Breakdown
The four entry points are not simple wrappers; they are different ways in which the same runtime is exposed at different boundaries.
The package manager entry is suitable for quick local installation and scripted invocation. Its advantages are clear dependency management and version locking, making it suitable for developers validating a toolchain on a local machine. The web entry is suitable for visual debugging and demonstrations, making it easy to observe sessions, tool calls, and trajectory panels. The headless command-line entry is suitable for CI/CD, batch processing, and remote automation. It does not depend on a graphical interface and emphasizes orchestration and exit-code semantics. The Python SDK entry is suitable for embedding agent capabilities into platform services, task scheduling systems, or internal R&D platforms, emphasizing programmable session control, event subscription, and tool registration.
Default configurations usually lean toward developer debugging rather than terminal product experience. Key defaults to inspect include: model provider and timeout/retry settings, tool allowlists, permission policies, sandbox network toggles, session log paths and compression methods, whether the interface layer enables the trajectory panel by default, and secret and environment variable isolation policies. If defaults are too permissive, security risks increase; if they are too conservative, daily coding experience becomes sluggish. An engineering approach is to layer default configurations: a local development preset, a CI automation preset, and a production restricted preset, with differences explicitly declared through preset combinations.
4. Session Event Log: The Runtime’s Source of Truth
Session event logs are typically append-only JSON Lines and can be block-compressed to control size. Their value is not just recording; they become the runtime’s source of truth. The following illustrative event structure is used only to show generic fields and does not represent any specific implementation interface:
{"event_id": "e-001","session_id": "s-001","type": "tool_call","ts": "2025-01-01T00:00:00Z","actor": "assistant","visible_to_model": true,"payload": {"tool": "file_edit", "args_digest": "..."},"permission_decision": "allow","token_metrics": {"input": 0, "output": 0, "cached": 0}}
The core write order should be “persist first, visible later.” Pseudocode is as follows:
def emit_and_persist(event, session_log, context):append_jsonl(session_log, event)flush_if_required(session_log)if event.get("visible_to_model"):context.append(normalize_for_model(event))
This order provides four benefits. First, context can be reconstructed from the log during crash recovery. Second, permission decisions and tool results are auditable. Third, execution trajectories can be stably projected from the log, avoiding inconsistencies where “the interface shows it but the log does not.” Fourth, the same session can be replayed and compared across different entry points. Log engineering also needs to consider schema versioning, redaction, retention periods, compression block size, and index fields. For binary visual artifacts, they should not be written directly into the event log. Instead, they should be saved to a file system or object storage, with the log recording only references, hashes, generation parameters, and validation results.
5. Execution Trajectory: Read-Only Projection, Not Side-Channel Instrumentation
An execution trajectory can be compared to a developer tool for the agent. It needs to answer questions such as: what did the model see, what tools were called, why was permission allowed or denied, did cache hits occur, how did input and output tokens change, and at which step did a failure occur. If trajectories rely on independent instrumentation, they can easily diverge from the real execution path. If trajectories are read-only projections directly from the session event log, they are naturally consistent with the source of truth.
Illustrative projection logic is as follows:
def project_trajectory(session_log):for event in read_compressed_jsonl(session_log):if event["type"] in VIEW_EVENT_TYPES:yield normalize_event(event)
The projection layer should support filtering by event type, aggregation by session, and metric statistics by time window, and should allow the UI layer and automated analysis tools to reuse the same projection results. Metrics such as cache hits, input/output tokens, and token rate should come from metering fields in log events, not from estimates made by the UI layer. In this way, the same log can support both visual panels and regression testing and failure localization.
6. Controlled Comparison Under the Same Model: Terminal-Oriented Tools vs. Open Runtimes
When comparing different implementation paths, variables must be controlled: the same underlying model, the same task set, the same tool boundaries, the same permission policy, and the same log granularity. Comparison dimensions should not focus only on whether a task is completed. They should also observe event granularity, tool-call replay capability, permission decision explainability, failure recovery paths, visibility of cache and token metrics, and consistency between interface display and automation interfaces.
Abstractly, the advantages of mature terminal-oriented intelligent coding tools lie in being out-of-the-box, polished interaction, and optimized daily paths. The advantages of open runtimes lie in being recomposable, observable, embeddable, and extensible. The former is more like a finished product, while the latter is more like a foundation on which agents can continue to be constructed. The two are not a simple replacement relationship. If only a single local run is observed, it is easy to misjudge interaction latency, cache hits, or task randomness as capability differences. A more reliable approach is to build a task set, run it repeatedly, record event logs, and perform trajectory-level comparisons rather than giving product rankings.
7. Full-Stack Task Practice with Visual Artifacts
Consider a full-stack task with visual artifacts: requirement parsing, front-end page generation, back-end API implementation, data model design, page rendering screenshots or chart generation, and automated validation and repair. The runtime needs to configure the model, tool allowlist, sandbox network policy, visual output directory, log path, and permission policy. The execution trajectory should fully record planning, file edits, terminal execution, test results, visual artifact references, and validation conclusions.
The engineering treatment of visual artifacts is particularly critical: screenshots, charts, or report files are saved to a controlled directory or object storage, and the event log records references, hashes, generation parameters, and validation results. The validation phase performs both API and page assertions and visual regression comparison. Permission auditing checks whether browser rendering, network access, and file writes comply with policy. On a cloud platform such as Baidu AI Cloud, general capabilities such as object storage, log services, and container platforms can host the runtime, logs, and artifact storage, but deployment should still follow the principles of least privilege, secret isolation, and log redaction.
8. Engineering Recommendations and Conclusion
When implementing an open agent runtime, it is advisable to prioritize four areas: layered default configurations, tool allowlists and sandbox network policy, event log schema and redaction/retention policy, and consistency testing for execution trajectory projection. Plugins and presets require version compatibility and failure isolation. Runtime self-modification capabilities require change auditing, rollback, and test gates. The terminal experience requires the product layer to fill in cross-platform interaction, cache hits, and latency optimization.
The true value of an open runtime lies in constructibility: it splits model providers, tools, sessions, permissions, sandbox, main loop, and interface layer into replaceable components, allowing teams to construct their own agents according to task boundaries. Its core constraint—“model-visible content must already be persisted to the log”—and the read-only projection mechanism for execution trajectories are the foundation of auditable and reproducible agent engineering. Only when the default product experience and runtime openness mature together can such systems meet the expectations of both end users and platform developers.
