Agent Runtime Architecture Explained: Session Logs, Trajectories, and Deployment Essentials

    This article breaks down the architecture of an open-source agent runtime, covering its four entry points and six decoupled modules, the design of session event logs and trajectory projections, a checklist for reproducing the environment, methods for observing complex tasks, and practical recommendations for selection and deployment. It is aimed at developers evaluating coding agents as platform infrastructure rather than off-the-shelf tools.

    Project Positioning: From Off-the-Shelf Tool to Constructible Runtime

    The community initially expected an out-of-the-box coding agent, but what the open-source repository delivered is closer to a deeply customizable runtime. This gap signals that agent technology is evolving from standalone products toward infrastructure. The runtime exposes a web-based coding agent, a headless CLI, a Python SDK, and JSON-RPC-based interfaces. The Agent Communication Protocol (ACP) also falls into this interface category.

    Specific formats, versions, and figures mentioned in this article should be verified against the project’s official documentation and your own test results.

    1. Multiple Entry Points and Module Decoupling

    The runtime provides four entry points, each suited to different scenarios:

    Entry Point Use Case Typical User
    Web UI Visual interaction and execution monitoring Frontline developers
    Headless CLI Headless servers, automation scripts, pipeline tasks Ops and automation engineers
    Python SDK Embedding into existing backend services Platform developers
    JSON-RPC Cross-language, cross-process communication Integrators of polyglot systems

    Internally, the runtime has six relatively independent layers. Decoupling means replacing one layer does not force a rewrite of the others, but every interface has boundary conditions that must be confirmed individually:

    Module Responsibility Interface Contract Boundary Conditions
    Model Provider Adapting APIs of different LLMs Unified request/response structure Streaming output, retry, and timeout policies handled separately
    Toolkit Registering and invoking custom tools Tool name, parameter schema, return format How tool failures are reported back to the model
    Session Maintaining context, history, and cache Session ID and read/write entry points Truncation rules when the context window is exceeded
    Permission Controlling file, network, and command access Allow and deny rules Default policy should be deny
    Sandbox Isolating the code execution environment Resource limits, timeouts, mountable paths Sensitive host directories must not be mounted into the sandbox
    Agent Loop & UI Controlling the think-act-observe loop, separated from the UI Event output Whether the loop continues after UI disconnection needs empirical verification

    2. Requirements and Acceptance Criteria for Two User Types

    End users and platform developers care about very different metrics, and selection should evaluate them separately:

    Role Core Need Key Metrics Acceptance Criteria
    End user A usable coding tool Desktop experience, terminal compatibility (including Windows), cache hit rate, per-task duration Completion rate and rework count for the same task
    Platform developer Extensible infrastructure Plugin mechanism, preset combinations, trajectory observability, runtime self-modification Time to integrate a new tool, and whether core code changes are unnecessary

    A recurring observation in community discussions is that the openness of the runtime layer is often more mature than the default product experience. This observation comes from discussion and has not been systematically tested. A single composite score should not replace evaluating both types of needs separately.

    3. Session Event Logs and Trajectory Projection

    A core constraint of this runtime is that anything visible to the model must already be persisted to the log. If this principle holds in the implementation, the context the model reads during inference can be replayed from the log. The state shown in the debug panel stays consistent with the actual model input. The trajectory is therefore a read-only projection of the log and requires no additional instrumentation.

    This design brings consistency, but also cost. The log itself stores code, file paths, and user input, and may even contain fragments of secrets, so logs must be managed as sensitive data.

    The following table lists the purpose of log fields and handling recommendations. Field names should be confirmed against actual project output by reading the source code or exporting samples:

    Field Meaning Sensitivity Handling Recommendation
    ts Event timestamp Low Use UTC consistently
    type Event type, e.g., tool call, model response Low Record enum values and versions
    name, args Tool name and arguments High Redact secret and token parameters
    status Execution result Low Retain for troubleshooting
    tokens Input and output token counts Low Used for cost accounting
    content Model output text High Apply access control by confidentiality level
    cache_hit Whether the cache was hit Low Used for performance analysis

    The following JSON is a simplified illustration and does not represent the project’s real format:

    1. {"ts": "2026-11-24T10:00:00Z", "type": "tool_call", "name": "execute_code", "args": {"lang": "python"}, "status": "success"}
    2. {"ts": "2026-11-24T10:00:01Z", "type": "model_response", "cache_hit": true}

    The original source states that logs are stored as zstd-compressed JSONL. Compression reduces disk usage, but manual inspection requires decompression first. Compression parameters, file rotation, and retention policies should be confirmed against the source code or official documentation. Set an explicit retention period for logs based on compliance requirements, and restrict read access to the running user and authorized auditors only.

    4. Environment Checklist Before Reproduction

    The original source does not specify the OS, dependency versions, startup commands, or permission configuration for local deployment, so the following checklist is for your own recording. Specific values should follow the project documentation:

    Item What to Record Recommended Practice
    Operating system Version and CPU architecture Specify the exact version, e.g., Ubuntu 22.04 x86_64
    Runtime environment Python, Node, and other versions Install per repository requirements and pin versions
    Code version Commit hash or release tag Pin to a specific commit to avoid drift with the main branch
    Model configuration Provider, model name, context length Inject via environment variables
    Secret management Storage location and rotation method Use environment variables or a secret management service; never write to code or logs
    Sandbox permissions Mountable directories, network scope, resource limits Apply least privilege
    Log directory Path, file permissions, retention period Readable and writable only by the running user

    Suggested reproduction order:

    1. Install dependencies in a clean virtual environment or container, and save the lock file or version manifest.
    2. Copy the configuration template, fill in the model provider and secrets, and confirm that secret files are not committed to version control.
    3. Start the runtime and run a side-effect-free task first, such as reading a single file, to confirm logs are generated.
    4. Inspect log fields and confirm sensitive content has been redacted according to the rules.
    5. Under restricted permissions, execute a forbidden command and confirm the system explicitly rejects it rather than silently allowing it.
    6. Record failure symptoms and rollback methods, such as switching to a previous version or stopping the sandbox service.

    5. How to Observe Complex Tasks

    The original source uses a complex full-stack task as a case study: generating a web application with chart visualization from a requirements document. Such tasks typically include the following phases: parsing requirements, planning the file structure, generating and running code in the sandbox, taking screenshots with a headless browser, comparing screenshots against requirements using a multimodal model, and then entering a correction loop.

    To compare performance across runtimes, fix the following conditions: base model, task description, sampling parameters, and measurement window. Repeat the same task multiple times and take the median. Recommended metrics:

    Metric Measurement Method Notes
    Total token consumption Sum of input and output tokens per task Reconcile with model billing figures
    Token generation rate Output tokens divided by model generation time Exclude tool execution time
    Cache hit rate Hits divided by total model calls Also record whether the cache prefix changed
    Visual verification rounds Number of corrections triggered after screenshots Record the corresponding requirements document version

    The original source mentions that cache invalidation occurred after context truncation. One possible explanation is that truncation changed the cache prefix, making existing cache entries unusable. This explanation remains a hypothesis and should be verified by comparing cache prefix changes in the logs. Screenshots and generated files may also contain sensitive data and should be governed by the same rules as text logs.

    6. Conclusion and Recommendations

    1. Distinguish roles before selection. If you only need a usable coding tool, prioritize product experience; if you are building a platform, focus on evaluating the plugin mechanism and log…