Deploying and Testing Local AI Programming Agents: A Geometric Drawing Case Study

    This article explores the practical deployment and application of local AI programming agents using complex geometric drawing tasks as a case study. It covers environment setup, startup configuration, prompt engineering for constrained tasks (such as constructing a heptagon and doubling the cube with a two-marked ruler), and engineering best practices for verifying agent-generated code.

    Evaluating Capability Boundaries Over Demo Effects

    Recently, local AI programming agents have gained attention. They typically launch local services via a command-line interface (CLI), accessed through a browser, combining workspaces, execution modes, access permissions, and model configurations to generate code, read/write files, and execute tasks. Evaluating these tools shouldn’t rely on a single “impressive” demo but on four dimensions: environment installability, permission and security boundaries, constraint comprehension for complex tasks, and result verifiability.

    Rather than reviewing a specific product, this article abstracts the user experience into general technical problems: How to configure the environment, design prompts, and verify results when an AI agent faces strongly constrained, multi-step geometric tasks requiring animation and export capabilities, such as “constructing a regular heptagon with a two-marked ruler” or “doubling the cube with a two-marked ruler.”

    Deployment Environment: Native Dependencies as the Primary Hurdle

    These tools are commonly installed globally via a package manager. The example flow is as follows:

    1. <package manager> install -g <AI agent CLI package>

    The most common failure point during installation is not the main program itself, but native module compilation. Dependencies for terminal emulation, process control, or graphics often require a modern C++ compiler standard. If the system’s default C++ compiler is outdated, the installation may fail midway. The solution is not to downgrade functionality but to enable a higher version toolchain available on the system, then re-run the installation:

    1. <enable high-version C++ toolchain environment>
    2. <package manager> install -g <AI agent CLI package>

    Practical recommendations:

    1. Verify if runtime, package manager, and C++ toolchain versions meet dependency requirements first.
    2. Prioritize system-provided toolchain switching mechanisms over manually modifying global default compilers.
    3. Pin toolchain versions in container images to prevent “works on my machine but fails in CI” issues.
    4. Retain full logs upon installation failure, focusing troubleshooting on the native module compilation phase.

    Startup and Configuration: Workspace, Mode, Access, and Model

    After installation, you typically launch the local web interface via CLI. The terminal outputs a loopback address, which you open in a browser. The example command is as follows:

    1. <AI agent CLI> start --ui=web --workspace=<geometry-drawing-dir> --mode=code --access=full --model=<high-capability-code-model>

    There are four key configuration items:

    • Workspace: Restricts the directories the agent can read/write. It is recommended to create a separate workspace for geometric drawing tasks to avoid mixing with business code.
    • Mode: Code mode is better suited for generating HTML, scripts, and animation logic; general chat mode is better for discussing approaches.
    • Access: Full access improves file operation and command execution efficiency but carries the highest risk. Production environments should follow the principle of least privilege.
    • Model: For complex geometric constraints, selecting a model with stronger reasoning capabilities is advised, though manual verification remains essential.

    Task 1: Implementing a Two-Marked Ruler Heptagon Construction in HTML

    The prompt requires generating an HTML webpage that uses a two-marked ruler (neusis construction) to construct a regular heptagon, completes the omitted compass-and-straightedge steps, and adds a GIF export feature. The core steps can be formalized as:

    1. Take a square and draw the perpendicular bisector of the base.
    2. Draw a circle centered at the square’s bottom-right vertex with the diagonal length as the radius.
    3. Place the two-marked ruler against the bottom-left vertex, sliding the first mark along the circle until the second mark crosses the perpendicular bisector.
    4. Determine key intersection points based on the ruler’s position.
    5. Supplement standard perpendicular bisector and center determination steps to complete the heptagon construction.
    6. Keep only necessary trajectories in the animation to avoid the screen being covered by compass arcs.
    7. Render frame-by-frame and export as a GIF.

    For the HTML implementation, it is recommended to use SVG or Canvas drawing, abstracting “points, lines, circles, and ruler positions” as geometric objects. The two-marked ruler constraint can be modeled as: the ruler body passes through a fixed point, the first mark falls on the circle, and the second mark falls on the target line. This can be solved using analytical calculations or a numerical iterative search to find a ruler position that meets the error threshold. The animation layer should separate the “search process” from the “final construction” to prevent the audience from being distracted by intermediate trajectories. GIF export can be achieved by redrawing the scene at a fixed frame rate and encoding it into an animated image.

    Task 2: Implementing the Doubling of the Cube with a Two-Marked Ruler in HTML

    Doubling the cube can be rigorously stated as: using the interval between the two marks on the ruler as the unit length, and given a line segment of length a, construct the cube root of a. The construction steps in the prompt include: taking the given length and constructing points of equal and double length on an extension line; drawing a perpendicular from a point and determining the unit length point; connecting and drawing parallel lines; rotating the two-marked ruler through a fixed point until the two marks fall on the target lines.

    The implementation difficulty lies in “rotating until conditions are met,” which is a continuous constraint-solving problem. In the web page, the two-marked ruler should be abstracted as a rigid body with two marked points: fixed through point E, with a rotation angle θ, where the marked points fall on line l and the line where OA is located. The program can perform an interval search on θ to find the angle that satisfies the two line constraints, then calculate the intersections and subsequent length relationships. The prompt must clearly specify the unit length, normalization conditions, coordinate definitions, animation rhythm, and acceptance criteria; otherwise, the model tends to generate a page that “looks right” but lacks mathematical completeness.

    Result Verification and Engineering Recommendations

    For such complex geometric tasks, generated results must undergo manual verification: checking whether each construction step is traceable, whether constraints are truly satisfied, whether the animation retains only necessary traces, and whether the GIF export is complete. Engineering recommendations are as follows:

    1. Staged Prompting: First have the agent output a construction step table, then generate the HTML, and finally add animation and export features.
    2. Upfront Acceptance Criteria: Clearly define point/line naming, coordinate ranges, error thresholds, frame rates, and export formats.
    3. Least Privilege: Even for complex tasks, restrict the workspace as much as possible; avoid leaving full access permissions on indefinitely.
    4. Version Locking: Pin runtime, toolchain, and dependency versions to reduce environment drift.
    5. Log and Artifact Management: Retain generation records, key frames, and final HTML files for reproducibility.
    6. Team Collaboration: Artifacts can be placed in general object storage, paired with logging services and monitoring alerts; in general cloud environments, such combinations are common practices.

    Overall, local AI programming agents offer significant value in tasks with “long steps, strong constraints, and visualization requirements,” but installation dependencies, permission risks, and result verification remain key focuses for implementation. Treating the agent as an auditable code collaborator, rather than an unverified auto-constructor, is the most reliable way to leverage its capabilities.