Installing and Running Web-Based AI Coding Agents: Setup, Configuration, and a Hands-On Test
This article explains how to install, configure, and use web-based AI coding agents, which have evolved from simple code-completion plugins into agentic environments capable of file read/write, command execution, and multi-step planning. It covers the three-part architecture of a local service, browser frontend, and external model API; a structured troubleshooting workflow for native PTY build failures caused by outdated GCC versions; secure ways to expose the local service; and three key configurations—workspace, mode, and permissions—that define the agent's capability boundary. It also presents a hands-on stress test using neusis (two-mark ruler) geometry construction, with prompt-writing tips, an acceptance checklist, and engineering recommendations for reproducibility, least privilege, key governance, cost control, and result review.
1. Why Web-Based AI Coding Tools Matter
Over the past year or two, AI coding tools have evolved from “code completion plugins” into agentic (Agent) environments capable of reading and writing files, executing commands, and performing multi-step planning. Compared with forms that run only in an editor sidebar, the web mode offers three key advantages:
- Environment decoupling: Model inference runs remotely, the interaction interface runs in a local browser, and only a lightweight runtime is needed locally.
- Process visibility: Intermediate artifacts, terminal output, and file changes from multi-step tasks can all be displayed as web pages, making them easy to review.
- Easy reproducibility: The workspace, permissions, and mode are fixed as configuration items, so teams can share the same baseline.
At their core, these tools follow a three-part structure: a local service + a browser frontend + an external model API. Understanding this structure is the prerequisite for troubleshooting most installation and runtime issues.
2. Installation: Treat Dependency Problems as Toolchain Problems, Not Installation Failures
2.1 Typical Failure Symptoms
When installing a command-line runtime globally through a package manager (represented by the generic command install -g below), some Linux distributions report compilation errors. The root cause is usually not the tool itself, but the fact that the pseudo-terminal (PTY) component it depends on is a native extension that must be built on the spot with a C++ compiler. This extension has relatively high compiler requirements (the common industry threshold is GCC 12.x or later), but the default compiler on many server distributions is still from the 8.x generation.
2.2 Troubleshooting Order
It is recommended to follow the order of “locate first, switch second, verify last” to avoid blindly upgrading the system’s default compiler:
# 1. Check the current default versiong++ --version# 2. Find existing higher-version toolchains on the systemls /opt/rh/ 2>/dev/nullls /usr/bin/g++-* 2>/dev/null# 3. Enable the higher-version toolchain only in the current shell sessionsource /opt/rh/gcc-toolset-14/enable# 4. Confirm the switch took effectg++ --version# 5. Re-run the installationnpm install -g <runtime-package>
The key technique here is that source only affects environment variables in the current session and does not modify system default symlinks, which carries the least risk. If the machine truly has no higher-version toolchain, install a standalone toolchain collection through the package manager instead of directly replacing /usr/bin/g++.
2.3 Other Common Pitfalls
- Insufficient permissions: Global installation requires writing to global directories. Using a user-space solution with Node environment management capabilities can bypass
EACCES. - Network and mirrors: Both native extension downloads and package pulls depend on the network. Configuring an available mirror source can significantly shorten build times.
- Cache pollution: If the old error persists after switching toolchains, clear the package manager cache and
node_modules, then retry. - Version alignment: The versions of the runtime, native extension, and compiler must match; mixing them is the main source of hidden failures.
3. Runtime: Local Service, Access, and Configuration
After installation, start in web mode:
dsh --profile web# Example output: dsh web: http://127.0.0.1:3080
By default, it listens on the loopback address 127.0.0.1, meaning the service is accessible only from the local machine—a secure default. If you need to debug within a local area network, you should explicitly specify the listening address and assess the exposure risk at the same time: this service is capable of file read/write and command execution, and once it becomes externally reachable, it is equivalent to handing over control of the host. Recommendations for production use include:
- Bind to the loopback address and access it via SSH port forwarding;
- Run it inside a container, mounting only the target working directory to limit the visible filesystem scope;
- Place an identity-authenticating gateway in front, and enable access logs and auditing;
- Integrate with logging services and monitoring alerts to keep records of anomalous command invocations.
After opening the page for the first time, you need to enter the model API key. The key should be stored in environment variables or a local configuration file, avoiding hardcoding it into project code and never committing it to version control.
4. Three Key Configurations: Workspace, Mode, and Permissions
The initial page usually offers two types of choices: selecting a working directory (workspace) and selecting a working mode (mode). These configurations determine the agent’s “capability boundary” and matter more than which model you choose.
| Configuration | Purpose | Practical Recommendation |
|---|---|---|
| Workspace | Limits the root directory for readable/writable files | One directory per project; never point to the home directory or system root |
| Mode | Determines interaction style (conversational / code-agent) | Choose code mode when multi-file changes are needed |
| Permissions | The openness of file writing and command execution | Default to least privilege; elevate only when necessary |
A solid baseline configuration is: point the workspace to a dedicated directory (for example, pro_dsh), select code mode, and gradually elevate permissions from “read-only / requires confirmation” to full access as needed, with a model version that has stronger reasoning capabilities. Permission elevation should follow the principle of “one-time, revocable”: roll back as soon as the task is finished.
5. Hands-On: Driving Complex Geometric Constructions with Prompts
To test the tool’s multi-step planning and frontend artifact capabilities, you can use a classic problem like “neusis (two-mark ruler) construction” as a stress test. It combines strict geometric constraints, continuous interactive actions, and visualization requirements, making it a good evaluation sample.
5.1 Key Points for Writing Prompts
A high-quality prompt contains four elements: target artifact, step-by-step constraints, requirements for completing omitted parts, and additional capabilities.
Example 1 (regular heptagon):
Generate an HTML page demonstrating the construction of a regular heptagon with a two-mark ruler.Step constraints:1. Take a square and construct the perpendicular bisector of the base;2. Use the bottom-right vertex as the center and the diagonal length as the radius to draw a circle;3. Keep one end of the two-mark ruler tight against the bottom-left vertex, moving the first mark along the circleuntil the second mark passes through the perpendicular bisector of the base;4. Complete the remaining standard compass-and-straightedge steps to determine the center and vertices.Presentation requirements: the compass should retain only necessary traces and not show the continuous motion trajectory of points;finally, provide a function to export a GIF.
Example 2 (doubling the cube, i.e., the construction of a cube root):
Generate an HTML page that uses a two-mark ruler to double the cube.Using the distance between the two marks as the unit length, given OA = a (require a < 1), construct the cube root of a:1. Extend OA to take AB = OA, and extend in the reverse direction to take OF = 2OA;2. Draw a perpendicular through A, and take point E such that BE equals the unit length;3. Connect EF, and draw a line l through B parallel to EF;4. Rotate the two-mark ruler through point E so that the first mark lands on l and the second mark lands on the line containing OA.Presentation requirements: interactive steps can be replayed one by one, label key intersection points, and support exporting the animation.
5.2 Three Lessons for Prompt Design
- State invariants clearly: The unit length, radius, and perpendicular relationships are hard constraints; writing them into the prompt can greatly reduce the model’s “free improvisation”.
- Explicitly constrain visual noise: Without saying “retain only necessary traces”, the model often draws dense trajectories, and page readability quickly deteriorates.
- Specify the artifact form clearly: Delivery requirements such as HTML, single file, and exportable GIF should be declared at the beginning, not appended afterward.
5.3 Acceptance Checklist for Results
- Whether the geometric relationships hold strictly (can be verified by back-calculating coordinates);
- Whether the interaction can be done step by step, and whether the step order matches the prompt;
- Whether trace management is clean and whether the animation can be exported;
- Whether all generated files fall within the specified workspace;
- Whether all commands executed during the process are within the expected scope.
6. Engineering Recommendations and Risk Boundaries
- Reproducibility: Put toolchain versions, runtime versions, and configuration files under version control to form a one-click setup script.
- Least privilege: When the agent has command execution capabilities, be sure to run it in a container or isolated environment.
- Key governance: Inject keys uniformly via environment variables or a key management service, and rotate them regularly.
- Cost control: Validate complex tasks with small samples first, then scale up the context and reasoning budget.
- Result review: Agent artifacts are “code pending review” and must undergo manual review and automated testing before being merged.
7. Conclusion
For web-based AI coding tools, the difficulty has never been “typing an installation command”, but rather the coordination of three things: toolchain compatibility, permission boundaries, and prompt engineering. Treat compiler version issues as part of environment governance, treat permission configuration as part of security design, and treat prompts as reusable specifications. This way, you can reliably integrate these tools into daily development workflows and make the output verifiable, reproducible, and auditable.
