Engineering Practices for Recreating AI Creative Applications with Intelligent Coding Agents
This article presents an engineering approach to rebuilding the core capabilities of AI image and video creation applications without copying protected designs. It covers layered architecture, functional contracts, asynchronous task orchestration, asset lineage, version management, agent collaboration, media-level validation, reusable capability packages, and governance requirements for production-ready systems. The focus is on reproducing verifiable business workflows rather than merely matching a user interface.
1. Define the Problem: Reproduce a Verifiable Business Workflow, Not Just a UI
Developers are increasingly using intelligent coding agents to quickly prototype image- and video-generation applications. On the surface, the challenge appears to be visual similarity. In engineering terms, the harder problems are organizing the state behind the interface, orchestrating generation, editing, and extension capabilities, making asynchronous tasks idempotent and recoverable, preserving relationships between asset versions, and validating the complete workflow with real data and real service paths.
A more appropriate goal is not to copy a specific application, but to reproduce general interaction patterns and functional capabilities for an authorized project or an internally developed product. These capabilities may include project management, prompt generation, image editing, video extension, multi-version comparison, and asset lineage.
Visual designs, copy, trademarks, media, and other protected forms of expression should not be copied directly. Engineering teams should reproduce the capability contract and implement it using their own design language. This approach supports technical research, migration validation, and internal prototyping while reducing copyright, trademark, and compliance risks.
2. Overall Architecture: Isolate Change Through Layered Design
A practical architecture for an AI creative application can generally be divided into the following layers:
- Presentation layer: Project lists, creative workspaces, parameter panels, media previews, and version comparison.
- Gateway/BFF layer: Aggregates the data required by each page and centralizes authentication, rate limiting, auditing, and error codes.
- Orchestration service layer: Breaks a creative request into steps such as input parsing, parameter validation, task creation, capability invocation, result aggregation, and version persistence.
- Model capability abstraction layer: Provides unified interfaces for text-to-image, image-to-image, image editing, text-to-video, video extension, and similar capabilities, preventing business logic from becoming dependent on a single provider.
- Media processing layer: Handles transcoding, frame extraction, concatenation, duration validation, segmented playback, and cover generation.
- Storage and asset layer: Uses object storage for source images, generated images, videos, covers, and intermediate artifacts, while metadata records versions and lineage.
- Task and messaging layer: Uses queues for long-running tasks and messages to notify clients of state changes. Failed tasks should support retries and manual compensation.
- Observability and security layer: Covers logs, metrics, tracing, alerts, content safety, access control, and cost tracking.
At the deployment layer, general cloud services from Baidu AI Cloud can be used for object storage, container platforms, message queues, logging, monitoring, and alerting. These services can host media assets, deploy application services, process asynchronous tasks, and support operational visibility. Specific choices should still be evaluated against actual workload size, availability requirements, and cost constraints. Adding infrastructure merely to increase technical complexity should be avoided.
3. Break Down Requirements Before Asking an Agent to Generate Code
Intelligent coding agents can quickly produce a project skeleton when given clear constraints, but they do not automatically define product boundaries. Requirements should first be organized into an acceptance-oriented capability matrix:
- Project page: Create projects, list projects, search, show recently edited projects, delete, and restore.
- Image capabilities: Text-to-image generation, reference images, batch generation, localized editing, and parameter reuse.
- Video capabilities: Prompt-based generation, continuation from a first or last frame, duration extension, and multiple candidates.
- Editing capabilities: Create derived tasks from existing images or videos without overwriting the original assets.
- Version capabilities: Preserve historical versions, display parent-child relationships and operation parameters, and compare multiple versions.
- Asset lineage: Allow every image and video segment to be traced to its root asset, operation type, prompt summary, and task record.
- Playback experience: Validate continuous playback for extended videos and support seeking, covers, and metadata display.
- Permissions and auditing: Provide project-level permissions, operation logs, confirmation for sensitive actions, quota controls, and cost notifications.
Non-functional requirements should also be part of the contract:
- Generation tasks must run asynchronously.
- Task creation must support an idempotency key.
- Failed tasks must be retryable without duplicate billing or duplicate writes.
- Large files should use direct-to-object-storage or multipart uploads.
- All media reads should use short-lived signed URLs.
- After a user deletes a project, its assets should enter an auditable delayed-cleanup workflow.
4. Data Modeling: Versions and Lineage Are Core Assets
The following metadata example illustrates a possible structure:
{"projectId": "p_001","assetId": "a_1001","rootAssetId": "a_1000","parentAssetId": "a_1000","type": "video","operation": "extend","promptDigest": "sha256:...","params": {"durationSeconds": 16,"aspectRatio": "16:9"},"status": "succeeded","createdBy": "u_001","createdAt": "2026-01-01T10:00:00Z"}
The key principle is that generated assets should be immutable. Every edit creates a new asset. rootAssetId identifies the original source, while parentAssetId identifies the direct source from which the current asset was derived. params and promptDigest preserve traceable information.
With this model, the system can display original asset ownership, retain multiple versions, and show relationships before and after video extension without relying on frontend inference or overwriting older files.
A task model should include at least the following states:
draft -> queued -> running -> succeeded|-> failed -> retrying -> running|-> canceled
Each retry should create a new execution record while keeping the same business idempotency key. For long-running tasks, the frontend may use polling or server-side push notifications. However, the authoritative state must come from the server-side task record so that a page refresh does not lose task status.
5. How to Collaborate with an Intelligent Coding Agent
To improve agent output, the input should contain four types of information:
- Goal: Which user journeys must be reproduced and how they are prioritized.
- Context: The technology stack, directory structure, existing interfaces, design tokens, and data models.
- Constraints: Rules such as never overwriting source assets, avoiding unauditable dependencies, following error-code conventions, and recording required log fields.
- Acceptance criteria: The scope of screenshot comparison, API contract tests, task-state tests, and continuous media playback tests.
The agent can be instructed to work in the following order: contract first, implementation second, and validation third.
Step 1: Output the page and component inventory without generating business code.Step 2: Output the API contracts, task state machine, and asset lineage model.Step 3: Generate the frontend skeleton and mock data, and complete the workflow without real model calls.Step 4: Integrate the capability abstraction layer and add failure retries, idempotency, and auditing.Step 5: Complete end-to-end validation scripts and the manual acceptance checklist.
This process turns the agent from a code completion tool into a constrained engineering collaborator. Each stage produces an explicit, reviewable, and reversible deliverable.
For complex features, the agent should first create a failure-case library. Examples include a task being submitted twice after a timeout, audio and video becoming out of sync after extension, or the same idempotency key returning different assets. Tests can then be written for each failure mode.
6. Validate the Result at the Workflow Level, Not Only Through Screenshots
High-fidelity UI is only the first level of validation. Acceptance should cover three areas.
1. Contract-level validation
Verify request parameters, error codes, permissions, idempotency keys, and task-state transitions. For example, repeated submissions with the same idempotency key should return the same task or a reference to the same result.
2. Media-level validation
For an extended video, check total duration, segment transitions, audio continuity, frame continuity at the beginning and end, cover usability, and seek playback. Media inspection tools can be used to read container metadata, but acceptance criteria should be written into business tests rather than left to visual inspection.
3. Lineage-level validation
Perform chain-based checks for version retention and original asset ownership. The system should verify that a result can be traced back to its root asset, editing parameters are complete, older versions remain accessible, and deleting a parent asset protects derived assets according to the defined policy.
An example end-to-end pseudocode flow is shown below:
scenario("Upload an image, edit it, and preserve the version"):project = createProject(userA)root = uploadAsset(project, sampleImage)job1 = requestEdit(root, prompt, size)waitUntil(job1.status == "succeeded")derived = getResult(job1)assert derived.rootAssetId == root.idassert derived.parentAssetId == root.idassert listVersions(project).contains(root, derived)scenario("Play an extended video continuously"):video = generateVideo(project, prompt, duration=8)extended = requestExtend(video, targetDuration=16)waitUntil(extended.status == "succeeded")assert mediaDuration(extended) >= 16assert canSeek(extended, 0, 16)
Because generative models are inherently variable, acceptance should not require pixel-level identity. Instead, it should verify structure, parameters, task records, asset relationships, and media usability. Where necessary, maintain a golden input set for regular regression testing of both primary and exceptional paths.
7. Turn Experience into Reusable Capability Packages
To make a replication effort reusable across teams, the important output is not a collection of prompts, but an executable capability package. A general structure might look like this:
capability-package/manifest.json # Name, version, scope, and dependenciesinputs.schema.json # Input constraintsrunbook.md # Execution steps and manual checkpointstemplates/ # Page, API, and data model templatesvalidators/ # Contract and end-to-end validatorsexamples/ # Samples that passed acceptanceknown-issues.md # Known failure modes and mitigations
The package should clearly define its inputs and outputs.
Inputs may include the target capability scope, technology stack, design tokens, existing API documentation, sample data, and acceptance criteria. Outputs should include runnable code, API contracts, test reports, a risk list, and rollback instructions.
After each project retrospective, update the failure-case library with issues such as asynchronous task timeouts, inaccurate media duration calculations, permission bypasses, and broken version chains. This is what enables the next team to reduce implementation and debugging costs.
8. Compliance, Security, and Engineering Governance
Capability reproduction must be developed together with governance.
The first concern is intellectual property. Reproduce only general business capabilities and interaction patterns, use owned or authorized media, and do not copy another party’s trademarks, copy, visual assets, or protected forms of expression.
The second concern is content safety. Generation, upload, and sharing workflows should include moderation and reporting mechanisms, with tiered handling for sensitive content.
The third concern is data isolation. Projects, assets, and tasks must be isolated by tenant and user. Download URLs should be short-lived to prevent unauthorized enumeration.
The fourth concern is cost control. Record model invocation costs by task, set quotas and concurrency limits, and cap retry attempts so that automatic retries do not multiply expenses.
The fifth concern is observability. Logs should record task identifiers, asset identifiers, state transitions, and error codes, while avoiding unnecessary storage of sensitive prompt text.
Intelligent coding agents can significantly accelerate prototyping, but they cannot replace engineering judgment. What determines whether a project can become production-ready is a clear contract, stable task orchestration, traceable asset modeling, and a complete acceptance system. Once these foundations are in place, general infrastructure such as Baidu AI Cloud can support storage, deployment, queues, and observability, helping transform a demo that merely appears to work into a maintainable, auditable, and scalable production system.
