Code-Driven Multimodal Creation: Agent Architecture and Verification Practices
This article explores how language models can write and execute code to create digital works with visual, audio, and interactive elements. It breaks down the engineering workflow into task planning, program generation, tool execution, result verification, and security governance. Readers will learn about the technical essence of code-driven creation, mechanisms for procedural animation and sound synchronization, safeguards for long-term autonomous execution, and practical methodologies for evaluating the true capabilities of AI agents beyond one-time demonstrations.
1. Shifting from Model Rumors to Verifiable Technical Problems
Discussions around next-generation AI models often revolve around long-context capabilities, long-term autonomous execution, complex animation production, and interactive 3D scenes. However, a name appearing in a directory, a tag in a page source, or a developer demonstration is not enough to prove that a model has been officially released, let alone verify its performance, availability, and service commitments.
Technical analysis should categorize evidence into three tiers:
The first tier includes information confirmed by official documentation, such as explicitly announced capabilities, usage limits, and service conditions. The second tier consists of independently reproducible experiments, including complete inputs, execution logs, source code, and runtime environments. The third tier encompasses unverified demonstrations and hearsay.
For developers, what is truly worth investigating is not an unconfirmed model version, but a more universal problem: How can language models write and execute code to complete digital works featuring visual, audio, and interactive logic?
This question can be broken down into engineering phases: task planning, program generation, tool execution, result verification, and security governance. Only when these phases form a closed loop can a one-time demonstration be transformed into stable production capability.
2. The Technical Essence of Code-Driven Creation
1. Generating Programs Instead of Final Visuals Directly
The core of code-driven creation is having the model output a program that constructs the work. The program then generates the final audiovisual results through graphics rendering, geometric calculations, sound synthesis, and time control.
The basic pipeline can be summarized as:
Requirement description → Scene specification → Executable code → Rendering and synthesis → Check and feedback → Revision and delivery.
For example, when creating “a sailboat on the sea,” the model can separately define the boat’s geometric structure, the sea surface height variations, lighting parameters, camera trajectories, and the boat’s bobbing motion. During playback, the runtime environment continuously calculates these states based on time, rather than reading a pre-generated video.
The advantages of this approach include a clear structure, adjustable parameters, easy integration of interactive logic, and straightforward error localization. Its limitations are equally clear: complex natural textures, realistic human performances, and high-precision materials often require richer resources and more complex rendering pipelines, which cannot be achieved with simple programs alone.
2. “No External Assets” Does Not Mean “No External Dependencies”
Programs can construct visuals and sounds using basic graphics, mathematical noise, and synthesized waveforms, but they still require underlying capabilities like interpretation, graphics rendering, and audio output.
Therefore, when evaluating the independence of a work, one should distinguish between:
- Whether it reads external content resources like images, sounds, or fonts;
- Whether it relies on network loading for runtime components;
- Whether it requires specific graphics or audio capabilities;
- Whether it can run normally offline;
- Whether there are implicit downloads, remote calls, or pre-installed environment dependencies.
“Single-file delivery” is merely a packaging format; it does not automatically equate to being fully self-contained, nor does it mean it can play smoothly on any device.
3. Moving Agents from One-Shot Generation to Closed-Loop Execution
1. Establishing Checkable Specifications First
Directly asking a model to “create a beautiful animation” usually leaves too much ambiguity. A more reliable method is to first translate requirements into verifiable constraints:
- Work type: Linear animation or interactive scene;
- Time structure: Total duration, shot sequence, transition points;
- Visual content: Subjects, backgrounds, colors, and camera movements;
- Audio content: Background music, ambient sounds, event sound effects;
- Interaction methods: Clicks, drags, keyboard operations, and their feedback;
- Runtime boundaries: Target devices, allowed dependencies, offline requirements;
- Acceptance criteria: Playability, no severe occlusions, audio-visual event correspondence, etc.
The specification serves as both the basis for generation and the benchmark for subsequent testing. Without clear acceptance conditions, an agent can easily keep investing in local decorations while ignoring whether the work is complete and functional.
2. Building a Phased Execution Process
A practical implementation sequence is to first complete a minimum runnable version, then gradually enhance expressiveness.
The first phase only verifies whether the screen can render, whether time progresses, and whether core objects can move. The second phase adds storyboards, camera angles, and key visual effects. The third phase introduces sound and interaction. The final phase addresses performance, compatibility, and delivery packaging.
This sequence reduces debugging costs. If visuals, sound, interaction, and complex effects are generated simultaneously, it becomes very difficult to determine which layer caused the failure if the program does not run.
3. Execution Feedback Must Cover Beyond Syntax Issues
A program launching successfully only means it passed the minimum runtime check; it does not mean the work meets the requirements.
The agent also needs feedback at different levels:
- Static feedback: Syntax errors, undefined variables, missing resource references;
- Runtime feedback: Exceptions, timeouts, continuous memory growth;
- Visual feedback: Whether the subject appears on screen, whether the camera is blocked;
- Temporal feedback: Whether scenes switch in order, whether animations end prematurely;
- Audio feedback: Whether it is muted, clipping, popping, or out of sync;
- Requirement feedback: Whether specified actions, objects, and interactions are truly implemented.
Therefore, a reliable process should combine execution logs, screenshots at key moments, audio analysis, and manual spot-checks, rather than deeming it a success solely based on “the process did not throw an error.”
4. Three Key Mechanisms for Procedural Animation
1. Using a Unified Timeline
If visuals and sound rely on separate timers, cumulative deviations easily occur. A more reasonable approach is to establish a unified master clock, allowing camera movements, object motions, and sound events to reference the same time base.
An object’s state can be written as:Position = MotionFunction(CurrentTime)
This way, even if drawing frequencies vary across devices, the object’s position at a given time point remains largely consistent. Compared to adding a fixed displacement every time it draws, this method prevents the animation speed from changing based on device speed.
For physical motions requiring numerical integration, one should further consider fixed time steps, sub-step updates, and interpolation display, rather than simply treating all motions as direct functions of time.
2. Managing Complexity with Scene Structures
When a work contains multiple objects, geometric shapes, materials, transformations, and parent-child relationships must be organized.
For example, hanging sails, masts, and rudders under a hull node maintains their structural relationship when the hull rocks. Linking the camera target to the subject’s position reduces the chance of the subject accidentally leaving the frame.
Engineering-wise, scene data should be separated from update logic. Scene data describes “what exists,” update logic describes “how it changes,” and the rendering module is responsible for “how it is displayed.” This layering makes it easier for the model to modify specific features and for developers to take over maintenance.
3. Making Random Effects Reproducible
Waves, clouds, particles, and surface details often require randomness. If the random results differ every time it runs, comparing before and after modifications becomes difficult.
Using a fixed random seed allows the same version to produce a consistent basic layout under identical conditions. This not only helps locate visual defects but also prevents an accidental good result from being mistaken for stable capability.
5. Procedural Sound and Audio-Visual Synchronization
Sound can be generated using basic methods like oscillating signals, noise, envelopes, filtering, and mixing. Simple prompt tones, mechanical sounds, and abstract ambient sounds are usually suitable for this approach, while natural human voices or complex instrumental performances require higher modeling capabilities.
In sound engineering, at least three issues must be checked.
First is amplitude control. When multiple sound layers are stacked, they may exceed the representable range, causing distortion. Gains should be set reasonably, and limiters applied as needed.
Second is event edges. A sudden start or stop of a sound easily causes pops. Smooth transitions should be handled through short fades in/out or envelope control.
Third is the synchronization baseline. Visual collisions, flashes, and corresponding sound effects should be triggered by the same event definition, rather than being manually set with approximate times in two separate modules.
It is also worth noting that some runtime environments restrict automatic audio playback. Therefore, “the sound code is correct” and “the user hears sound immediately after opening the file” are not the same thing. The startup method should be clarified upon delivery.
6. Engineering Safeguards for Long-Term Autonomous Execution
1. Saving State Instead of Relying on Infinite Dialogue Memory
Complex tasks require continuous tracking of the current goal, completed items, known issues, code versions, and test results. The fact that a context window can hold a large amount of content does not mean the model can accurately understand all details at all times.
A more controllable approach is to maintain a concise task state file and generate summaries at key nodes. Before resuming execution each time, read the current specification, the most recent usable version, and pending issues to avoid repeatedly overturning verified designs.
2. Setting Execution Budgets and Stop Conditions
The longer an agent runs autonomously, the more necessary it is to define boundaries, including maximum retry attempts, single execution time limits, resource caps, and cumulative cost thresholds.
Stop conditions should not be limited to “the model thinks it’s done”; they can also include:
- All required acceptance criteria are passed;
- Multiple consecutive revisions yield no improvement;
- Runtime or resource budgets are reached;
- Content requiring human judgment is encountered;
- Unmanageable dependencies or permission requests arise.
These constraints do not weaken the agent; rather, they prevent it from falling into ineffective retries and uncontrolled modifications.
3. Executing Generated Code in Restricted Environments
Programs generated by models should be treated as inputs requiring verification. The execution environment should follow the principle of least privilege, restricting file access, network connections, system calls, and resource consumption.
Input materials and execution instructions should also be clearly separated. Operational requirements contained in external text should not automatically receive execution permissions. Operations involving reading sensitive files, accessing credentials, or sending data outward require independent authorization and auditing.
7. How to Evaluate True Capabilities Rather Than Demonstration Effects
A single brilliant case cannot represent general reliability. Evaluation should focus simultaneously on completion rate, quality, cost, and stability.
It is recommended to record at least the following metrics:
- Task completion rate: The proportion of tasks meeting all required acceptance criteria;
- First-time runnable rate: The proportion that can start without manual modifications;
- Manual intervention count: The number of mid-process prompt supplements, fixes, and resource replacements;
- End-to-end duration: Including planning, execution, waiting, testing, and rework;
- Runtime performance: Drawing time distribution, memory footprint, and response latency;
- Reproducibility: The consistency of results across multiple runs under the same conditions;
- Delivery completeness: Whether source code, dependency descriptions, runtime instructions, and test logs are complete.
Regarding costs, one should not only calculate text inputs and outputs but also consider compute resources, storage, execution retries, manual review, and subsequent maintenance. The primary cost of complex creative tasks sometimes comes precisely from repeated rendering and manual corrections, rather than the first-time generation.
8. Implementation Roadmap for Practical Applications
Teams can start with smaller-scale projects with clear acceptance criteria, such as short educational animations, product structure demonstrations, or simple teaching interactions.
First, establish a limited-scale task set covering typical requirements and fix the test environment. Subsequently, build the basic closed loop of task planning, code execution, result collection, and version saving. Once the process stabilizes, add sound, more complex 3D scenes, and multi-person collaborative review.
Upon delivery, in addition to the work itself, the generation specifications, runnable source code, dependency manifest, key versions, test results, and known limitations should be retained. For commercial use, it is also necessary to check the licensing of code and resources, content compliance, and data processing boundaries.
The core value of code-driven creation is not promising to “replace all production phases with a single prompt,” but transforming creativity into a structured process that can be executed, modified, and inspected. The truly worthwhile direction is combining the model’s generative capabilities with deterministic runtime environments, repeatable testing, and clear human responsibility boundaries, gradually turning possibilities in demonstrations into engineering reliability.
