Full-Stack Delivery with AI Agents: From Prompts to Runnable Systems
This article explores the evolution of AI coding tools from code completion to task-level delivery. It breaks down full-stack web application delivery into four layers—visual/interaction, content architecture, business logic/data persistence, and engineering—detailing evaluation metrics, key risks, and practical implementation steps for integrating AI agents into the software development lifecycle.
1. Background: From Code Completion to Task-Level Delivery
Over the past few years, AI coding tools used by developers have evolved through three stages. The first stage was code completion, where the model predicted the next snippet based on the context before the cursor. The second stage was conversational programming, where developers described problems in natural language, and the model provided function suggestions or modifications. The third stage is the Agent mode, where the model receives a goal, autonomously decomposes steps, creates files, invokes command-line tools, runs tests, and corrects errors based on failure logs.
The fundamental shift in the Agent mode lies in the unit of delivery. In the past, the output was a snippet of code; now, the output can be an accessible website complete with pages, APIs, database tables, and deployment scripts. This capability is highly valuable for prototyping and small business systems, as it drastically reduces the time from an idea to a demonstrable version.
However, prototyping speed and production quality are two different things. A page rendering correctly does not mean form validation is complete, nor does it guarantee data consistency under concurrent scenarios. When evaluating agent output, it is crucial to separate “appears to work” from “withstands scrutiny.”
2. Four Layers of Full-Stack Delivery
A complete web application can be broken down into four layers. The acceptance criteria for each layer differ, and the agent’s performance varies accordingly.
2.1 Visual and Interaction Layer
The visual layer includes layout, color scheme, typography, animations, and responsive design. Agents can usually generate pages with a unified overall style quickly, especially when explicit design constraints are provided in the prompt, such as color palettes, spacing systems, font scale hierarchies, and breakpoint rules.
The interaction layer requires attention to the following:
- Whether form input validation and error prompts are complete;
- Whether keyboard navigation and focus management are usable;
- Whether animations respect the system’s “reduce motion” setting;
- Whether the initial resource size exceeds the budget.
Most of these items can be written as automated checks. For example, using accessibility testing tools to scan pages, and using performance benchmarks to check initial load time. If the prompt does not mention these requirements, the agent often only implements the visual effects and proactively ignores edge cases.
2.2 Content and Information Architecture Layer
The narrative structure of long pages, such as a process explanation unfolding along a timeline, is essentially a set of ordered content blocks. During implementation, content and styles should be separated: content should be placed in structured data, and page components should only handle rendering. This way, subsequent text modifications or adding new stages do not require altering layout code.
A common issue for agents at this layer is hardcoding content directly into components, leading to increased costs for multi-language support and future maintenance. During acceptance, you can verify whether adding a new stage only requires modifying the data file.
2.3 Business Logic and Data Persistence Layer
This layer is the dividing line between a prototype and a usable system. Take a flight booking module as an example. The complete flow includes selecting a date, choosing a seat, entering passenger information, submitting the order, writing to the database, and updating the remaining seat count. Each step can fail, with concurrency issues being the most easily overlooked.
Suppose a flight has only 6 seats, and two users submit a request for the same seat simultaneously. If the code first queries the remaining quantity and then inserts a record, both requests might pass the check concurrently, resulting in overselling. The correct approach is to place the check and the write operation within the same transaction and ensure seat uniqueness through database constraints.
Below is a conceptual implementation using generic SQL syntax (specific driver placeholder syntax may vary by environment):
def reserve_seat(db, flight_id, seat_no, passenger_name):with db.transaction():# Lock the flight row to prevent concurrent requests from reading the same remaining countflight = db.query_one("SELECT capacity, booked FROM flights WHERE id = ? FOR UPDATE",(flight_id,),)if flight.booked >= flight.capacity:raise CapacityExceeded(flight_id)# Create a unique constraint for (flight_id, seat_no); duplicate seats will fail directly at the database layerdb.execute("INSERT INTO bookings (flight_id, seat_no, passenger_name) ""VALUES (?, ?, ?)",(flight_id, seat_no, passenger_name),)db.execute("UPDATE flights SET booked = booked + 1 WHERE id = ?",(flight_id,),)
This code highlights three key points. First, the capacity check and the write operation are in the same transaction. Second, the unique constraint acts as a last line of defense; even if the application logic has flaws, data remains consistent. Third, the handling of a full capacity should return a clear business error, allowing the frontend to lock the remaining entry points, rather than just displaying a generic failure message.
Common issues in similar code generated by agents include: missing transactions, performing capacity checks only on the frontend, and lacking unique constraints. Therefore, dedicated concurrency tests should be written during acceptance to simulate scenarios where multiple requests submit for the same seat simultaneously.
2.4 Engineering Layer
The engineering layer includes project structure, dependency management, testing, configuration, and deployment. It determines whether the output can be picked up by a team. Checklist items should at least include:
- Whether dependency versions are locked and if there are any packages that cannot be installed;
- Whether configuration items are read via environment variables instead of being hardcoded;
- Whether there are basic automated tests and build scripts;
- Whether logs record critical business events while avoiding the output of personal information.
The most common mistake agents make in the engineering layer is referencing non-existent APIs or parameters, or using outdated syntax. These issues usually surface only at runtime, so they must be caught early through builds and tests.
3. How to Evaluate Agent Output
Evaluation should be defined before the task begins, not after seeing the results. It is recommended to use the following three types of metrics.
3.1 Functional Correctness
Write requirements as executable acceptance test cases. For example:
- When selecting a full flight, the submit button should be disabled, and the server should also reject the request;
- When the passenger name is empty, the form should give a clear prompt;
- When the same seat is submitted by two requests simultaneously, only one should succeed.
Functional pass rate is the most direct metric. It is more reliable than “whether the page looks complete.”
3.2 Human Modification Cost
Record how many files and lines were modified manually between the agent’s initial output and the deliverable version, as well as the reasons for modification. Modification reasons can be categorized into three types: requirement misunderstanding, logic defects, and engineering standard issues. After aggregating this data, the team can determine which tasks the agent is suited for and which parts still require human leadership.
3.3 Security and Compliance
Security checks should cover input validation, authentication, access control, sensitive information handling, and dependency risks. Code generated by agents may lack these protections, especially when the prompt does not mention security requirements. It is recommended to integrate security scanning into the build process and conduct manual reviews for modules involving personal information.
4. Key Risks and Human Gatekeeping
Agents are suitable for rapid generation and iteration, but human judgment should be retained for the following stages:
- Business Rule Confirmation: Rules such as pricing, capacity, and refund policies must be confirmed by the business stakeholders and cannot be inferred by the model.
- Security and Permission Design: Authentication flows, data access scopes, and key management require specialized review.
- Dependencies and Licenses: Third-party packages introduced by the agent need to be checked for source, maintenance status, and license terms.
- Data Migration: Changes involving existing data should be backed up first, then verified in a test environment.
- Performance Targets: Metrics such as concurrency and response time should be based on real load testing, not the model’s estimates.
Another common risk is over-trust. The explanatory text output by the agent might be inconsistent with the actual code—for instance, claiming a feature has been implemented when tests do not cover it. Therefore, conclusions should be based on test results and code reviews.
5. Implementation Suggestions
Introducing agent-based delivery into a team can be advanced using the following steps:
Step 1: Write acceptance criteria first. Translate business requirements into executable test cases and specify constraints in the prompt, including tech stack, directory structure, security requirements, and unmodifiable parts.
Step 2: Generate in stages. Have the agent complete the data model and APIs first, and generate frontend pages only after tests pass. Keep version records for each stage to facilitate rollbacks.
Step 3: Independent review. Have developers who were not involved in the generation review the core logic, focusing on transactions, edge cases, and error handling.
Step 4: Record decisions. Save prompts, modification logs, and key decision rationale. These materials can aid future iterations and provide traceability when issues arise.
Step 5: Gradually expand scope. Start with internal tools or prototypes, and only consider using them for user-facing production systems after accumulating sufficient data.
The value of AI agents lies in compressing the path from idea to a verifiable version. It cannot replace requirements analysis, architectural design, and quality assurance. Placing it in the right position and measuring its output with quantifiable standards is the only way to consistently reap the benefits.
