Remote Orchestration of AI Coding Agents from the Browser

    This article describes a remote workspace architecture that connects a browser-based task manager to a local development machine so AI coding agents can receive tasks, execute them in a terminal, and report progress back to the same page. It covers the four-layer design—local daemon, cloud relay and state hub, daemon core, and PTY-hosted agent—along with SSE command delivery, agent-agnostic orchestration, and a three-step setup model. The goal is to show how teams and individual developers can drive terminal-based AI coding agents from any browser without tying the workflow to a specific agent.

    Background: From Switching Windows to Clicking a Button

    AI coding agents—terminal-based intelligent tools that can autonomously read tasks, write code, and run tests—are already deeply integrated into many developers’ daily work. But a practical problem follows: task management and code execution are two disconnected worlds.

    A typical fragmented workflow looks like this:

    1. Write a task description in a web-based task manager.
    2. Switch to a local terminal and manually copy the context and paste the task.
    3. Watch the terminal until the agent finishes, or leave for a while and come back to check.
    4. Return to the task system and manually update the status and add progress notes.

    This workflow has four clear breakpoints: context must be moved by hand, execution cannot be observed remotely, task status drifts away from actual progress, and you are tied to your own development machine. None of this works while you are commuting, sitting in a meeting room, or simply browsing on your phone.

    The “remote workspace” approach discussed in this article essentially builds a bridge between a cloud task manager and a local development environment: you submit a task in a browser—even a mobile browser—and about thirty seconds later, the AI agent on your laptop is already reading the task, writing code, running tests, and streaming progress back to the same task page. Your browser becomes the control panel, your machine handles execution, and the task description becomes an executable instruction.

    Core Architecture: Four Layers with Clear Responsibilities

    To deliver this experience, the architecture typically consists of four cooperating parts with clear boundaries.

    1. Local Daemon (running on the development machine)

    The daemon is a resident desktop application process on your development machine and acts as the local connector for the agent. When you register a device on the workspace page, it actively initiates a long-lived connection to the cloud service and waits for commands. Using an active outbound daemon instead of a server-side direct connection to the local machine has two key benefits:

    • Traversing network boundaries: development machines are often behind NAT, firewalls, or even without a public IP address, so the server cannot access them directly. An outbound connection from the local machine naturally avoids this problem.
    • Minimizing the attack surface: no listening ports need to be exposed on the local machine. Remote commands can only arrive through this authenticated long-lived connection.

    2. Cloud Server (command relay and state hub)

    The server sits between the web interface and the daemon and plays two roles. First, it performs command relay, forwarding operations from the browser to the corresponding device. Second, it provides state persistence, storing session state, task notes, progress updates, and related data. As a result, even if you open the browser on another device, you can still see the complete task history—all state lives in the cloud rather than in local memory.

    3. Daemon Core (the brain for connection and scheduling)

    Inside the daemon, a separate “brain” module holds the authentication token, maintains the long-lived connection to the server, handles heartbeats and automatic reconnection, and drives all API calls. When a workspace session starts, it forwards initialization events to the execution layer. Separating connection management from the execution layer ensures that network fluctuations do not affect a running agent. Reconnection logic is centralized, and the execution layer only needs to care about the task itself.

    4. AI Agent (the executor running in a pseudoterminal)

    The agent is any terminal coding tool spawned by the execution layer in a pseudoterminal (PTY). One technical point is easy to overlook: why use a PTY instead of executing a child process directly? Because mainstream terminal AI tools are interactive and depend on TTY behavior such as color output, progress redraws, and stdin interaction. Running in a PTY means that any tool that can run in a terminal and read task context can be brought into the orchestration flow.

    The full chain can be summarized as:

    1. Browser (Web UI)
    2. │ REST API
    3. ▼
    4. Cloud Server (persistence + relay)
    5. │ SSE long connection
    6. ▼
    7. Local Daemon
    8. │ PTY spawn
    9. ▼
    10. AI Coding Agent (read task → write code → run tests → update notes)

    For downstream commands, SSE (Server-Sent Events) is a sensible choice: SSE is a one-way server push channel over ordinary HTTP. It does not need WebSocket’s bidirectional capability, because local status reports can use ordinary HTTP requests. It is simple to implement, proxy-friendly, and has built-in reconnection semantics.

    Key Design Principle: Agent-Agnostic

    The most important architectural decision in this approach is: the orchestration layer does not implement AI; it orchestrates AI.

    The AI tool ecosystem iterates very quickly. A tool that is mainstream today may be replaced by a new approach six months later. If your workflow is tightly bound to a specific agent, every tool switch means starting over. A more reasonable approach is therefore to treat the agent as a pluggable component:

    • The upper layer provides generic capabilities: task context injection, session management, progress tracking, state persistence, and team collaboration.
    • An agent only needs to meet two conditions to integrate: it can run in a terminal, and it can read a task context file.

    From a code perspective, this is a typical abstraction interface design:

    1. interface AgentLauncher {
    2. // Start the specified agent in a PTY and inject task context
    3. spawn(taskContext: TaskContext): AgentSession;
    4. }

    The orchestration layer depends only on this abstraction, and any concrete tool is one implementation of it. The benefit is that agent upgrades, replacements, and parallel comparison of multiple agents require no changes to the upper-layer workflow. This is also a lesson worth borrowing for any technical platform designed for long-term evolution—place the most frequently changing parts behind an interface.

    Practical Setup: From Zero to Remote-Ready

    The adoption cost should be as low as possible. Ideally, only three steps are required:

    1. Install and open the local desktop app: the app manages the full lifecycle of the daemon, and no manual terminal commands are needed.
    2. Register the device on the workspace page: click “Register this device,” and the app automatically detects the machine name and platform information and completes the binding. The device identity and authentication token are associated during registration, and all subsequent communication is authenticated.
    3. Start using it: after registration, the local machine becomes an online daemon with a ready long-lived connection. From then on, open the workspace page in any browser, including a mobile browser, create a task, select the target device, and start a session.

    Connection robustness is handled automatically by the app in the background: heartbeat keepalive, automatic reconnection after disconnection, and session state persistence. The user perceives only one thing: the device is online, and tasks can run.

    Conclusion

    The value of the remote workspace approach is that it removes the distance between task management and code execution: the browser is the control panel, the cloud is the state hub, the local machine is the execution engine, and the AI agent is a pluggable worker. Its core architecture points can be summarized as follows: an actively outbound daemon to traverse network boundaries, SSE as a lightweight command delivery channel, PTY to support interactive tools, and full decoupling between orchestration and AI to handle the rapid evolution of the tool ecosystem. For teams and individual developers who want to drive AI coding agents anytime and anywhere, this model offers a low-barrier, highly extensible path.