Replicating a Conversational AI Application with LLMs: A Practical Engineering Guide

    This guide presents a reusable methodology for replicating a public conversational AI application using only publicly observable behavior and official documentation. It breaks the work into four layers—specification, implementation, integration, and acceptance—and explains a two-round prompting strategy that separates interface reconstruction from full engineering closure. You will find a fixed scoring rubric for comparing model and agent-orchestration configurations, key implementation practices with sample adapter code, trade-off principles for UX improvements, security and compliance baselines, and a final acceptance checklist.

    1. Background and Problem Definition

    When a model vendor exposes model capabilities through open APIs and open weights, a natural question arises: can developers independently build a functionally equivalent conversational AI application with a similar user experience, based solely on the public capability descriptions? This is no longer a question of “can we call an API.” It is a full software engineering problem that requires requirement recovery, information architecture design, frontend implementation, API integration, fault tolerance, and acceptance testing across the entire chain.

    The approach in the source material is representative: it takes a real product’s public pages and public API documentation as input, asks the model to act as a senior product manager, and produces three deliverables—a feature specification with a structure diagram, a runnable web interface, and an improved version based on an understanding of the original design. This article strips away the specific product references and abstracts the approach into a reusable methodology: use “publicly observable behavior” as the specification source, use “multi-turn prompting plus agent orchestration” as the execution method, and use “runnable artifacts plus documentation plus improvement items” as the acceptance criteria.

    It is important to emphasize that any replication can only be based on publicly visible behavior and capabilities promised in public documentation. You should not assume the existence of undisclosed internal APIs, private parameters, or undocumented limitations. Drawing this boundary clearly is what makes subsequent evaluation meaningful.

    2. Overall Approach: Breaking Replication into Verifiable Engineering Tasks

    It is advisable to split the task into four layers, connected by explicit artifacts to avoid the quality unpredictability of a single-shot output.

    1. Specification layer: feature list, page structure diagram, and state machine (session, message, attachment, error states).
    2. Implementation layer: frontend components, styling system, state management, and API adapter layer.
    3. Integration layer: key injection, request construction, streaming output parsing, timeouts, and retries.
    4. Acceptance layer: smoke test cases, boundary test cases, and a list of UX improvement items.

    The corresponding prompt can be organized like this:

    1. Role: Senior product manager + frontend architect.
    2. Inputs: The target application's public page URL and public API documentation URL (use only documented capabilities).
    3. Tasks:
    4. 1) Output a feature list and page structure diagram (including empty, loading, and error states);
    5. 2) Output a runnable frontend project with API calls centralized in an adapter layer;
    6. 3) Propose at least three UX improvements under equivalent functionality, with rationale for the trade-offs.
    7. Constraints: Do not assume any undisclosed APIs; inject keys via environment variables, never hard-code them in source.

    3. Two-Round Prompting: Why Differences Only Emerge After “Handing Over the Keys”

    In practice, a two-round interaction is commonly used: the first round provides only requirements and public materials, and the second round provides the calling credentials. The value of this design is that it separates observation of “interface reconstruction ability” from “engineering closure ability.”

    The first round assesses understanding and design: can the model read the public documentation, draw a reasonable structure, and turn vague requirements into a component tree? The second round is the real watershed. Once credentials are provided, the artifacts must be invoked for real, and problems surface in a concentrated way:

    • A “minimum viable verification” strategy often gets only one success path working, with no handling for error codes, empty responses, or overly long inputs;
    • A “deep self-testing” strategy proactively constructs abnormal inputs, discovers parsing deviations, state desynchronization, and duplicate submissions, and fixes them.

    This suggests that when evaluating agents, you should not only look at whether the first screen looks similar; you should look at their ability to self-correct after receiving real feedback. Under identical operating conditions, the differences mainly come from the strategy choices of the model and the agent orchestration framework rather than human intervention, which makes the conclusions more credible.

    4. Horizontal Comparison Dimensions Across Six Configurations

    To avoid getting bogged down in “which is better” arguments, it is recommended to score with fixed dimensions. Each configuration (different models plus different agent orchestration methods, including long-context, standard-context, team-collaboration, and client-embedded types) is compared on the same scale:

    Dimension Observation Points Suggested Weight
    Requirement fidelity Feature list coverage, completeness of states 25%
    Structural clarity Consistency between structure diagram and implementation 15%
    Runnability Successful cold start, installable dependencies 20%
    Robustness Error codes, timeouts, empty states, retries 20%
    Improvement quality Whether improvements address real pain points 15%
    Security and compliance Credential leakage, log masking 5%

    A typical conclusion is that long-context configurations are more stable at “ingesting large amounts of documentation at once and staying consistent”; team-collaboration configurations have an advantage in the “design first, implement next, self-test last” division of labor; and client-embedded configurations are closer to a native feel in interaction detail reconstruction. These are strategy differences, not absolute superiority or inferiority.

    5. Key Implementation Practices and Sample Code

    The API adapter layer must be thin and explicit, with “replaceability” as the design goal:

    1. // adapter.js — all remote calls are centralized here for easy replacement and mocking
    2. export async function* chat({ messages, signal }) {
    3. const resp = await fetch(process.env.CHAT_ENDPOINT, {
    4. method: "POST",
    5. headers: {
    6. "Content-Type": "application/json",
    7. Authorization: `Bearer ${process.env.CHAT_API_KEY}`,
    8. },
    9. body: JSON.stringify({ messages, stream: true }),
    10. signal,
    11. });
    12. if (!resp.ok) throw new Error(`upstream_${resp.status}`);
    13. for await (const chunk of resp.body) {
    14. yield decodeChunk(chunk); // parse chunk by chunk to hide protocol differences
    15. }
    16. }

    Three accompanying engineering disciplines:

    • Credentials go only through environment variables; no plaintext may appear in build artifacts; mask key names in logs.
    • Decouple streaming rendering from the state machine; express message states with the four states pending/streaming/done/error to avoid “unable to recover after a half-render.”
    • Unify error semantics; map upstream status codes to user-readable messages and a retryable flag, rather than throwing raw payloads to the interface.

    6. Trade-off Principles for UX Improvements

    The “improved version” is most likely to become a pile of features. A more reliable approach is to subtract and enhance around real pain points: time to interactive first screen, collapsible and locatable long answers, session search, attachment upload progress and failure retry, and accessibility items such as keyboard reachability and contrast. For each improvement proposed, write clearly “what problem it solves, what the cost is, and how to roll it back.” This has more engineering value than adding one more flashy button.

    7. Security and Compliance Baseline

    The most common risks in replication projects are credential leakage and missing content compliance. You should ensure: keys are not committed to databases or repositories; logs are masked; both user input and model output are filtered; only the minimum necessary data is retained; and generated content is provided with identification and an appeal entry point. If cloud resources are involved, you can use object storage for static assets, a container platform for services, and logging and monitoring/alerting services for observability support—all selected by general capability category.

    8. Acceptance Checklist

    1. Cold start runs with a single command, with dependency versions locked;
    2. Every item in the feature list is checked off, with reasons stated for any gaps;
    3. At least three types of exceptions are covered: error codes, timeouts, and empty responses;
    4. The structure diagram matches the code directory;
    5. All improvement items include trade-off explanations;
    6. Credential scanning passes with no plaintext residue.

    9. Conclusion

    “Whether it can be replicated” is essentially a test of engineering maturity: whether the specification is clear, whether the boundaries are honest, whether feedback is utilized, and whether improvements involve trade-offs. Once the two-round prompting and the unified scoring scale are fixed, the differences between any model and agent orchestration configuration will naturally emerge. What the team truly accumulates is a repeatable, auditable, and transferable process for building intelligent applications.