Rebuilding a Conversational Web App with AI Agents: An Engineering Delivery and Acceptance Playbook

    This article presents an engineering playbook for using AI coding agents to rebuild a conversational web application. It covers how to define verifiable deliverables (product analysis, baseline rebuild, and improved versions), structure requirements around user journeys, separate service integration from UI development, handle streaming responses and asynchronous state management, and establish layered acceptance criteria across functionality, error handling, security, accessibility, and performance. It also explains how to fairly evaluate an AI coding agent's execution capability and what a complete engineering delivery should include.

    1. From “Page Replication” to Full Engineering Delivery

    Asking an AI coding system to rebuild a conversational web page looks simple on the surface: provide a reference page and service integration notes, and you are done. In practice, the task spans product analysis, interaction design, frontend and backend development, credential management, and quality assurance.

    If the only acceptance criterion is “the page looks similar,” the system will likely produce a static demo: the sidebar, message list, and input box all exist, but sessions cannot be saved reliably, streaming responses cannot be cancelled, and there is no recovery path when the network fails. Such a result works for a demo, but it is not a usable product.

    A better task definition therefore includes three interrelated but independently verifiable deliverables:

    1. A product analysis document and functional structure diagram: describing the reference page’s features, interaction states, data objects, and boundary conditions.
    2. A baseline rebuild: reproducing the observed layout, workflows, and confirmed functionality within legally authorized boundaries.
    3. An improved version: preserving the core user journeys while proposing and implementing verifiable optimizations for specific pain points.

    This is not a recommendation or ranking of any particular product. It is a general engineering practice: using a complete task to observe how an AI coding system understands requirements, organizes work, invokes tools, fixes defects, and proves delivery quality.

    2. Establishing Clear Requirement Boundaries

    2.1 Separate “What Was Observed” from “What Was Inferred”

    A reference page reveals appearance and interaction cues, but it usually cannot reveal backend architecture, internal permission policies, or data persistence mechanisms. The product document should clearly distinguish three categories of information:

    • Observed functionality: features confirmed through page interaction, such as creating a session, sending a message, or switching conversation history.
    • Unconfirmed behavior: features whose entry points are visible but whose full paths are not verified, such as attachment handling or cross-device sync.
    • Proposed extensions: new capabilities derived from user needs, such as in-session search, content export, and quick actions.

    This classification prevents the AI coding system from writing guesses as facts, and it avoids committing to capabilities in the implementation phase that have no backend support.

    2.2 Organize Requirements Around User Journeys

    Listing buttons alone cannot describe product behavior. A more effective approach is to describe complete journeys, for example:

    “The user creates a session, types a question, submits the request, watches the answer generate incrementally, stops the generation, and then switches to another historical session.”

    This single journey involves at least six stages: creation, input validation, request state, message updates, cancellation, and history recovery. If any stage is missing, the interface may look complete while being unusable in practice.

    Each requirement item should include its trigger condition, expected result, failure result, and verification method. For example:

    Feature Expected result Error handling Verification method
    Send message User message appears and answer generation starts Empty input is blocked; failed requests show a notice Manual testing and request inspection
    Stop generation Current generation terminates; existing content is retained Clearly marked as stopped Check cancellation state and subsequent events
    Switch session Full history of the target session is displayed Load failures can be retried Cross-session operations
    Restore history Data within the agreed scope is restored after refresh Explain the reason when recovery is impossible Refresh and re-entry tests

    If a capability was not observed, it should not be documented as an existing feature of the reference page; list it as an unconfirmed item or an improvement proposal instead.

    2.3 Preserve Necessary Engineering Constraints

    Task instructions can reduce irrelevant context, but they must not instruct the executing system to ignore security requirements, permission limits, or runtime constraints. Instructions that genuinely help delivery should specify:

    • Which pages and local directories may be accessed;
    • Which authorized tools may be used;
    • Whether installing dependencies or modifying the environment is allowed;
    • Which data must not be uploaded;
    • Which operations require human confirmation;
    • How to record capability gaps instead of fabricating missing functionality.

    The rebuild should also respect usage rights for page assets, logos, and design resources. Technical practice can use authorized assets or neutral placeholder content; there is no need to copy recognizable brand elements.

    3. Making the Product Document Directly Serve Implementation

    The value of a product document lies not in its length but in whether it reduces development ambiguity. An actionable document should cover at least page structure, state transitions, the data model, and edge cases.

    A functional structure diagram can take the following form:

    1. Conversational App
    2. ├─ Session Management
    3. │ ├─ Create session
    4. │ ├─ View history
    5. │ ├─ Rename title
    6. │ └─ Delete session
    7. ├─ Message Interaction
    8. │ ├─ Input and submit
    9. │ ├─ Streaming display
    10. │ ├─ Stop generation
    11. │ ├─ Copy content
    12. │ └─ Retry on failure
    13. ├─ Content Rendering
    14. │ ├─ Plain text
    15. │ ├─ Formatted content
    16. │ └─ Code snippets
    17. └─ Foundational Support
    18. ├─ Loading and error states
    19. ├─ Small-screen layout
    20. ├─ Keyboard operation
    21. └─ Data and credential protection

    This structure is only a generic design example; specific items must be adjusted based on observation results and project scope.

    The data model should be built around stable identities. Sessions need independent identifiers, and messages need to record their parent session, role, content, creation time, and status. Do not rely on array positions to distinguish messages; otherwise deletion, switching, and asynchronous updates will easily cause misalignment.

    Message states can be divided into “pending, generating, completed, failed, cancelled.” These states determine not only whether buttons are enabled, but also whether a retry entry is shown, whether content can continue to be appended, and whether intermediate results should be persisted.

    4. Separating Baseline Rebuild from Experience Optimization

    4.1 The Baseline Version Pursues Verifiable Consistency

    The baseline version should follow the confirmed page layout and operation order as closely as possible, avoiding the temptation to inject design preferences while rebuilding. Evaluation should check separately:

    • Visual consistency: layout hierarchy, spacing, type scale, color scheme, and responsive behavior.
    • Interaction consistency: button behavior, input rules, focus changes, and scrolling behavior.
    • Functional completeness: whether every page entry corresponds to a real, executable flow.
    • State completeness: whether loading, failure, empty-data, and cancelled states exist.

    Visual inspection should also standardize window sizes and content samples; otherwise differences between screenshots may come from the environment rather than implementation quality.

    4.2 The Optimized Version Must Address Real Problems

    “Adding more features” is not the same as “improving the experience.” Every optimization should establish a clear problem–solution–verification relationship.

    For example, if locating content in a long session is costly, provide in-session search; if users need to scroll back to earlier content while an answer is generating, improve the auto-scroll strategy; if re-entering text after a failure is costly, preserve the original input and provide a retry entry.

    Scrolling behavior deserves special attention: while the user remains at the bottom, the view can follow new content; when the user actively scrolls up to review history, the view must not be forced back to the bottom. In that case, show a “new content” indicator and let the user decide whether to jump.

    The optimized version should be kept separately from the baseline. Only then can you attribute experience improvements to specific changes and detect whether new capabilities introduce regressions.

    5. Service Integration Is More Than Verifying “Request Succeeded”

    The execution can be divided into two phases: the first completes requirement understanding, page implementation, and integration with mock data; the second provides controlled credentials to verify the real service chain.

    This approach separates UI development capability from service integration capability, but it requires that the completion criteria for both phases be defined in advance.

    5.1 Keep Credentials Server-Side Only

    The browser must never store long-lived service keys. Even when injected through build configuration, credentials can end up in the shipped page resources and be read by the client.

    A more robust general structure is:

    1. Browser UI
    2. ↓ user identity and message requests
    3. Application Service
    4. ↓ parameter validation, permission checks, call control
    5. Conversational Generation Service
    6. ↓ responses or data streams
    7. Application Service
    8. ↓ normalized results
    9. Browser UI

    Service credentials should be provided through controlled configuration or a secrets management mechanism. They must not enter the code repository, be printed to logs, or be embedded in screenshots or delivery documents. If real credentials ever appeared in uncontrolled task records, handle the exposure risk according to organizational policy and rotate the credentials.

    5.2 Isolate Service Differences with an Adapter Layer

    The page should not depend directly on any service’s raw response structure. The application service can convert results from different sources into internal unified events, such as text chunk, completion, failure, and cancellation.

    These names are internal project conventions and do not represent the real interfaces of any external service. Actual fields, authentication methods, request parameters, and streaming protocols must be implemented according to the official documentation of the service in use, not guessed from experience.

    The adapter layer can also unify error classification: invalid input, insufficient permissions, rate limiting, upstream unavailability, and network interruption. The UI should receive only the necessary user-facing messages and must not directly display errors containing internal paths, credentials, or sensitive configuration.

    5.3 Understand Streaming Responses Correctly

    Network fragments in streaming do not necessarily correspond to complete characters, complete events, or complete messages. The implementation must buffer incomplete data, parse according to the actual protocol, and handle end markers and abnormal interruptions.

    If every received fragment is immediately treated as complete text for display, the result can be missing content, duplicated appends, or a state that never terminates. Testing should deliberately cover different fragment boundaries instead of validating only one successful generation.

    6. Solving Asynchronous Interaction Defects with State Management

    Most problems in conversational pages come from concurrency and lifecycle handling, not visual styling.

    For example, a user sends a request in Session A and then switches to Session B. If the update logic only references “the currently open session,” Session A’s answer may be appended to Session B. The fix is to bind each request to an explicit session ID and message ID, so that responses can only update their corresponding objects.

    Similarly, after the user clicks stop, the network layer may still hold events that have arrived but not yet been processed. The system must not only initiate cancellation, but also prevent late events from flipping the “cancelled” state back to “completed.”

    Simplified internal logic can be expressed as:

    1. On receiving a response event:
    2. Locate the target message by request ID
    3. If the message is already cancelled or the request is stale:
    4. Ignore subsequent content
    5. Else:
    6. Update the target message, not the last message on the current page

    You also need to test the case where a session is deleted while a request is still running. You may cancel the request before deletion, or let the server continue processing by agreement, but you must guarantee that deleted data is not recreated by late responses.

    7. Layered Acceptance, Not Just a Smoke Check

    Sending one sentence after the service is connected and receiving an answer only proves the shortest path roughly works; it does not prove the system is delivered.

    7.1 Functional Acceptance

    Verify all agreed functionality: create, switch, delete, input, send, cancel, retry, and copy content. Every clickable entry should produce a definite result; entries that are not yet implemented should be hidden or marked with their limitations, rather than creating the illusion of support.

    7.2 Failure Acceptance

    Deliberately construct scenarios such as invalid credentials, connection drops, response delays, repeated submissions, and page refreshes. The concern is not only whether an error appears, but also:

    • Whether the user knows the current state of the request;
    • Whether the original input and existing answers are preserved;
    • Whether a retry is possible;
    • Whether retries can produce duplicate requests or duplicate records;
    • Whether error messages leak internal information.

    7.3 Security Acceptance

    Check whether credentials entered client-side resources, whether logs contain sensitive content, whether formatted output is safely processed, and whether session access passes permission checks.

    When accessing a session, the server must verify that the current user has the corresponding permission; it must not return data simply because the client submitted a session ID. User input and generated content should also be treated as untrusted, preventing them from being interpreted directly as executable page code.

    7.4 Accessibility and Performance Acceptance

    Primary operations should support keyboard access; input fields and icon buttons should have understandable names; focus states should be clearly visible. On small screens, the input area must not obscure key operations, and long content must not break the overall layout.

    For performance, record time to first content, full generation time, long-session rendering behavior, and page resource loading. Measurements must note network conditions, device, text length, and concurrency; without these conditions, a single number cannot describe the real user experience.

    8. Fairly Evaluating an AI Coding System’s Execution Capability

    The results of different execution systems usually depend not only on the underlying model, but also on tool permissions, context management, browsing capability, task decomposition, and error recovery strategies. A single success or failure should not be attributed directly to the model itself.

    When comparing execution approaches, standardize the reference material, initial code, runtime environment, credential scope, task time, and acceptance criteria, and preserve operation logs, code changes, and test evidence.

    Evaluation can be structured around these dimensions:

    • Requirement understanding: does it accurately distinguish facts, assumptions, and improvement proposals?
    • Implementation quality: does it form clear modules and avoid heavy duplication and ad-hoc patches?
    • Testing depth: does it proactively verify failures, boundaries, and concurrent states?
    • Fix闭环 — repair loop closure: after finding a problem, does it fix it and verify again?
    • Delivery transparency: does it honestly state unfinished items, known risks, and the scope of verification?

    In particular, distinguish “claims tests passed” from “provides reviewable evidence.” Valid evidence includes test steps, actual results, necessary logs, and explicit runtime conditions. A single task can reveal differences in engineering strategy, but it is not sufficient to derive general superiority across all scenarios.

    9. What a Complete Delivery Should Include

    A complete delivery should not be page code alone. It should also include the product document, functional structure diagram, startup instructions, service configuration instructions, test records, and known limitations.

    For capabilities that could not be completed, state the reason explicitly: whether the requirement is unconfirmed, the runtime environment is constrained, or necessary service support is missing. Transparently disclosing limitations has more engineering value than disguising incomplete functionality with static content.

    The core of rebuilding a conversational web page is not producing a visually similar shell, but connecting requirements, state, data, security, and verification into a complete chain. Only when an AI coding system can explain its implementation basis, prove the critical paths, and discover and fix defects has it truly made the transition from “code generation” to “engineering delivery.”