Engineering Open-Source LLM Agents in Production: From Code Generation to System Delivery

    This article presents a vendor-neutral, engineering-focused approach to deploying open-source large language model (LLM) agents for end-to-end software delivery. Using an agent that builds a brand website with seat selection and booking as an example, it covers structuring requirements into verifiable specs, generating consistent UI layers with design tokens, modeling capacity constraints with state machines, enforcing consistency at the storage layer, and integrating logging and monitoring. It also includes prompt engineering patterns, an acceptance checklist, common failure modes, and mitigation strategies for teams that want to apply agentic coding inside their organizations.

    When the capability boundary of open-source LLMs expands from “answering questions” to “delivering systems,” developers care less about leaderboard rankings and more about whether an agent can reliably produce engineering artifacts that run, stay maintainable, and scale. This article uses an agent that automatically builds a brand website and completes seat selection and booking as an example to abstract a general, vendor-neutral practice: how to constrain output with structured prompts, how to design a booking state machine with capacity limits, how to connect generated results to persistent storage and monitoring, and how to balance aesthetic expression with engineering reliability. It provides a layered architecture, sample code, and an acceptance checklist that teams can adopt directly when bringing agentic coding capabilities into their organizations.

    1. Reframing the Problem: From Generating Code to Delivering a System

    Over the past two years, most discussions around LLMs have focused on two dimensions: scores on knowledge benchmarks and acceptance rates for code completion. But once agents take on end-to-end tasks, the evaluation dimensions must shift. A real delivery request usually looks like this: build a brand website for a low-Earth-orbit travel scenario, including visual seat selection, flight date selection, passenger information entry, and booking submission, with a unified visual style, a closed interaction loop, and persistent data.

    Such a request hits three layers of capability at once:

    • Presentation layer: brand visual system, motion pacing, responsive layout, accessibility, and readability;
    • Business layer: seat capacity constraints, time window validation, state transitions, idempotency, and duplicate submission protection;
    • Data layer: structured storage, query indexing, consistency under concurrent writes, and backup and recovery.

    So to judge whether an open-source agent can “get the job done,” you should check whether it can fill in all three layers within one or a few interactions, rather than only delivering a good-looking front-end snippet. The industry generally classifies this capability as an “end-to-end software engineering task,” whose difficulty lies not in syntax but in constraint satisfaction and internal consistency.

    2. Capability Breakdown: Four Key Stages of Full-Stack Delivery by an Agent

    2.1 Requirement Structuring: Turning Natural Language into Verifiable Specs

    The prerequisite for high-quality delivery is turning vague descriptions into explicit specifications. In practice, it is recommended to have the agent first output a “spec draft” containing the page list, data entities, field constraints, status enumerations, and acceptance criteria, and only then start coding. A sample structure:

    1. spec:
    2. pages: [landing, timeline, booking, confirmation]
    3. entities:
    4. Flight: {id, date, capacity=6, seats[]}
    5. Booking: {id, flight_id, seat_no, passenger{}, status}
    6. rules:
    7. - seat_no is in 1..6 and globally unique
    8. - when capacity is full, status=locked
    9. - submission requires an idempotency key; duplicate submissions return the same result
    10. acceptance:
    11. - 20 concurrent attempts to claim the same seat yield only 1 success
    12. - booking record still exists after page refresh

    The value of this step is separating “aesthetic preferences” from “hard constraints,” avoiding repeated rework later.

    2.2 Presentation Layer Generation: Design Tokens and Component Contracts First

    To give generated results a consistent feel, the key is to define design tokens first (colors, font sizes, spacing, corner radius, motion duration), then have the agent produce components according to the tokens, instead of each code block picking colors on its own. A minimal example:

    1. :root{
    2. --bg:#05070d; --fg:#e8f6ff; --accent:#22d3ee;
    3. --warn:#f97316; --radius:12px; --dur:320ms;
    4. }

    On this basis, the agent more easily maintains a consistent language such as “full-screen imagery background + monospace data panel + breathing-style status indicator.” Engineering-wise, three bottom lines are recommended: key text meets contrast requirements, motion can be disabled by the “reduced motion” preference, and interactive elements are keyboard accessible.

    2.3 Business Layer Implementation: Using a State Machine for Capacity and Time Window Constraints

    Seat selection is essentially a resource allocation problem with a capacity limit. It is recommended to model a state machine explicitly rather than scattering boolean checks across pages:

    1. OPEN --select--> HELD(ttl=10min) --pay--> CONFIRMED
    2. | | |
    3. |--expire---------->| |--refund--> OPEN

    The accompanying database constraints should be double insurance: application-layer validation plus a storage-layer unique index.

    1. CREATE UNIQUE INDEX uniq_seat ON booking(flight_id, seat_no)
    2. WHERE status <> 'CANCELLED';

    Under concurrency, first claim the seat with a conditional update inside a transaction, then write the booking record; on failure, return “already taken” to guarantee the 6-seat limit is never exceeded.

    2.4 Data and Operations: Persistence, Logging, and Monitoring

    For generated results to go live, they must connect to common cloud capabilities: use object storage for static assets and imagery, use a relational or document database to store bookings, use a logging service to aggregate runtime logs, and use monitoring and alerting to set thresholds for error rates and latency. Only general categories are described here, with no vendor-specific interfaces involved.

    3. Prompt Engineering: Four Constraint Patterns for Stable Output

    • Role and artifact constraints: specify “output a runnable minimal system, not fragments”;
    • Structure constraints: require the spec first, then the directory tree, then code and run instructions;
    • Constraint priority: declare “capacity and consistency > motion and decoration,” with the former taking precedence in conflicts;
    • Self-check constraints: require listing known risks and uncovered cases for human review.

    Sample prompt skeleton:

    1. You are a full-stack engineer. Build a minimal viable system for "orbital travel booking."
    2. First output spec.yaml; then output the directory structure; then provide front-end pages, APIs, and data models.
    3. Hard constraints: 6 seats per flight; only one winner under concurrent claiming; no data loss after refresh.
    4. Finally output 5 self-test cases and known limitations.

    4. Quality Acceptance: Turning “Good-Looking” into “Deliverable”

    • Functional loop: date selection, seat selection, information entry, successful submission, and queryable results;
    • Data consistency: concurrent claiming, idempotent duplicate submission, and seat recycling after cancellation;
    • Visual consistency: unified tokens, breakpoint adaptation, and degradable motion;
    • Operability: structured logs, standardized error codes, and visualized key metrics;
    • Security baseline: input validation, least-privilege data access, and no plaintext storage of sensitive information.

    5. Common Failure Modes and Mitigation Strategies

    The first is “excessive visuals, missing logic”: the page looks stunning but submission errors out; the mitigation is spec first, then coding. The second is “constraint drift”: after multiple rounds of edits, the seat limit is bypassed; the mitigation is pushing constraints down to a storage-layer unique index. The third is “not operable”: generated code lacks logs and error codes; the mitigation is fixing an operations artifact list in the prompt. The fourth is “evaluation disconnected from experience”: high scores but failure on real tasks; teams are advised to build their own small task sets covering concurrency, boundary, and rollback scenarios.

    6. Conclusion

    The value of open-source LLMs and agents is shifting from “generating text” to “reliably delivering systems.” For developers, what truly needs to be accumulated is methodology: drive generation with specs, carry business constraints with state machines, backstop consistency at the storage layer, ensure operability with logs and monitoring, and hold the quality bottom line with an acceptance checklist. Only by solidifying this methodology into team processes can agentic coding capabilities be continuously and repeatably turned into deployable business systems on general cloud infrastructure such as Baidu AI Cloud.