Multi-Model Collaboration for Web App Replication: A Practical Guide

    This article presents a practical experiment in which six combinations of models and agent frameworks were asked to replicate a conversational web application from a live page and public API documentation. It explains the two-round prompting design that separates implementation ability from integration and verification depth, defines an executable acceptance checklist, and walks through the three required deliverables: a functional document with a state diagram, a runnable web implementation with environment-based configuration and streaming support, and an experience-driven improved version. It closes with reusable evaluation dimensions and pipeline fields for turning a one-off comparison into a repeatable benchmark.

    1. Background and Problem Definition

    As agentic coding matures, a common engineering request is this: given a live conversational product page and a public API specification, have a model autonomously complete a loop of reverse description, implementation, and improvement. The value of such a task is not copying a specific site, but testing how a model performs under real engineering constraints: can it read the interface structure, can it abstract the interaction into a state machine, can it complete end-to-end integration once given credentials, and can it locate and fix its own defects when integration fails.

    This experiment selected six combinations of “model + agent runtime framework,” each required to produce three deliverables: a product functional document with a structure diagram, a runnable web implementation, and an optimized version based on its own experience. The process used two rounds of prompts: the first round provided only the requirements and reference entry points, while the second round supplied the calling credentials. The design is deliberate in that it separates “implementation ability” from “integration and verification ability”—the first round tests understanding and planning, and the second tests debugging depth in a real environment.

    2. Unified Task Setup and Acceptance Criteria

    To keep results horizontally comparable, all combinations faced the same inputs and the same acceptance standard. Inputs included: the access entry point of the target page, the documentation entry point for the API calling instructions, and a lightweight tool for automated browsing (already in a logged-in state). Output had to contain three artifacts, none optional.

    It is better to write the acceptance criteria as an executable checklist rather than vague subjective judgment:

    1. Acceptance checklist example
    2. 1. Documentation completeness: feature list, page structure diagram, and state transition description are all present
    3. 2. Runnability: starts locally and the first screen renders correctly
    4. 3. API connectivity: after key injection, a conversational request can be initiated successfully
    5. 4. Interaction coverage: streaming output, interruption, retry, and error messages are implemented
    6. 5. Robustness: behavior under invalid input, oversized context, and concurrent requests
    7. 6. Improvements: evidence-based optimization notes rather than generic remarks

    3. The Logic Behind the Two-Round Prompt Design

    The core of the first-round prompt is role and boundaries: the model is cast as a senior product manager, the goal is to replicate a conversational web client, page and API documentation entry points are given, and the browsing tool may be used to read the page. No key is provided at this stage, so the model can only perform static analysis and build a skeleton.

    The second-round prompt adds a single piece of information: the calling credentials are ready. This round is the real dividing line. Two clearly different behavior patterns were observed:

    • Shallow verification: after receiving credentials, the model issues only one minimal request, declares completion once it succeeds, and never checks boundary conditions.
    • Deep verification: the model constructs multi-turn conversations, oversized inputs, abnormal responses, and concurrent scenarios, actively exposes defects, returns to the code to fix them, and forms a closed loop of test, locate, and optimize.

    It is worth stressing that this difference stems more from the strategy orientation of each model and runtime framework than from inconsistent operation. For engineering adoption, this means the evaluation system must include a dimension for “self-verification depth”; otherwise “runs once” will be mistaken for “deliverable.”

    4. Deliverable One: Functional Document and Structure Diagram

    A high-quality document should cover at least three layers: information architecture, interaction states, and API contract. The information architecture describes the hierarchy of the conversation list, input area, message flow, and settings panel; the interaction states express idle, requesting, streaming, interrupted, and failed-with-retry as a state machine; the API contract abstracts request fields, authentication method, streaming chunk format, and error codes into a vendor-neutral general description.

    1. stateDiagram-v2
    2. [*] --> Idle
    3. Idle --> Requesting: user submits
    4. Requesting --> Streaming: first chunk arrives
    5. Streaming --> Streaming: incremental chunks
    6. Streaming --> Completed: end marker
    7. Requesting --> Failed: auth/network error
    8. Streaming --> Failed: connection dropped
    9. Failed --> Requesting: retry
    10. Completed --> Idle

    5. Deliverable Two: Runnable Web Implementation

    At the implementation layer, follow the principle of “externalized configuration, layered capabilities.” Keys and endpoints are injected through environment variables to avoid hardcoding; the rendering layer, session state layer, and transport layer are decoupled so the streaming protocol can be swapped easily.

    1. // Example: environment variable injection and streaming receive skeleton
    2. const endpoint = process.env.CHAT_ENDPOINT;
    3. const apiKey = process.env.CHAT_API_KEY;
    4. async function streamChat(messages, onDelta, signal) {
    5. const resp = await fetch(endpoint, {
    6. method: "POST",
    7. headers: {
    8. "Content-Type": "application/json",
    9. "Authorization": `Bearer ${apiKey}`
    10. },
    11. body: JSON.stringify({ messages, stream: true }),
    12. signal
    13. });
    14. if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
    15. const reader = resp.body.getReader();
    16. const decoder = new TextDecoder();
    17. let buffer = "";
    18. while (true) {
    19. const { done, value } = await reader.read();
    20. if (done) break;
    21. buffer += decoder.decode(value, { stream: true });
    22. const lines = buffer.split("\n");
    23. buffer = lines.pop() ?? "";
    24. for (const line of lines) {
    25. const text = line.replace(/^data:\s*/, "").trim();
    26. if (!text || text === "[DONE]") continue;
    27. onDelta(text);
    28. }
    29. }
    30. }

    On engineering details, interruption must be handled (a cancellable request signal), along with reconnection after a dropped connection, throttling of incremental rendering, and key leakage risk (no persistence on the frontend, redacted logs).

    6. Deliverable Three: Experience-Driven Improved Version

    Improvement should not be subjective polishing; it needs a problem–evidence–solution correspondence. Common actionable items include: a first-screen skeleton to reduce perceived latency; virtual scrolling of messages for long conversations; a request queue and concurrency cap to prevent rate limiting; structured error messages that distinguish authentication failure, insufficient quota, and network errors; and local session persistence plus observability instrumentation (implemented through general logging services and monitoring and alerting capabilities).

    7. Evaluation Dimensions and a Reusable Pipeline

    Turning a one-off comparison test into a pipeline requires fixing four things: unified inputs, a unified acceptance checklist, two-round prompts, and structured records. Suggested record fields include first-attempt success rate, number of integration rounds, number of defects found, fix closure rate, and documentation completeness. If the process is deployed on a container platform, with object storage holding artifacts, a message queue decoupling tasks, and a logging and monitoring system tracking failure rates, it becomes a sustainable regression evaluation baseline.

    8. Conclusion

    Replication tasks truly test a model’s engineering closed-loop ability: understanding requirements, abstracting structure, implementing and integrating, self-verifying, and improving continuously. The value of the two-round prompts is separating the evaluation of “can write” from “can verify”; a unified acceptance standard and structured records are the key to turning subjective impressions into comparable metrics. For teams, rather than chasing the effect of a single demo, it is better to solidify this method into a repeatable evaluation and delivery process.