Modern image generation largely relies on specialized generative models that leave the process of image construction implicit in learned parameters. We explore an alternative: general-purpose coding agents that construct images through executable programs. Our study of zero-shot drawing on AgentDrawBench, a 200-prompt benchmark, reveals a distinctive capability profile. Agents excel at preserving structure and satisfying precise visual constraints, achieving competitive results in domains where compositional accuracy matters more than photorealistic appearance, while remaining limited in perceptual richness. Their visual expressiveness varies with the drawing interface, and a qualitative study on reconstruction shows how procedural skills extracted from human demonstrations support different artistic media. We then examine code as an external visual language of thought: a structured, executable representation that agents can construct and inspect. We test it in visual question answering task and find reconstructed visual code retains substantial information for question answering and, in some domains, supports higher accuracy than the original image. These abilities raise a further question: do agents draw on a shared internal representation of scene content beyond a particular drawing program? We explore an internal visual language-of-thought hypothesis, in which a shared, compositionally structured representation supports visual operations across drawing languages. Cross-harness drawings and images assembled from independent single-pixel queries exhibit related layouts and tones. Agents also maintain self-generated room arrangements across viewpoints after visible drawings are removed. These results demonstrate that the coding agent would maintain a consistent and coherent world inside its imagine even before the harness gets involved and the generation starts.
Figures & tables
Figure 2: The computer-use harness. Three matched AgentDrawBench prompts drawn through Canvas 2D with visual feedback, the JS Paint GUI, and GPT-image-1: workplace-safety design, student furniture, and a tiger approaching through a brick opening.
Table 3: Holistic win rates (%) against GPT-image-1 using the MMRBv2 rubric. Astra denotes GPT-6-Astra; Deepseek denotes Deepseek V4.1 Flash.
Figure 3: WorldBench question-answering accuracy across seven domains and overall, using the original image, SVG source code, or rendered SVG reconstruction.
Figure 4: Selected WorldBench items where SVG source supports a correct answer while an image-based answer fails.
Figure 5: Reference-guided image reconstruction using four learned stroke workflows. Each row shows the reference image, intermediate renders at turns 1, 4, 8, 16, and 32, and the final saved image.
Figure 6: Independent GPT-6-Astra drawings for two prompts across six drawing harnesses, including two independent SVG runs. Top: drawings generated with intermediate visual feedback. Bottom: blind drawings of a desert prompt, generated without intermediate visual feedback; blind GUI runs receive only the initial blank window. Pixel provides an additional qualitative comparison. Each run starts from its text prompt without access to another run’s code or image. The rows use different prompts and illustrate cross-harness similarities within each setting. Aggregate consistency measurements are reported in Fig. 7 .
Figure 7: Cross-harness consistency on AgentDrawBench. (a–c) Prompt-matched layout correlation, palette cosine similarity, and DreamSim distance between independent drawings of the same prompt using five harnesses and a second SVG run. (d–f) The same three metrics summarized by pair type. Drawings produced with Canvas 2D, SVG, and Shapes show cross-harness similarity close to that of two independent SVG runs. Mouse-driven GUI drawings show comparable similarity to these outputs. Blender drawings are less similar to the 2D outputs, but remain substantially more similar than drawings of different prompts.
Figure 8: Pictures assembled from independent sessions: the Mona Lisa, a sunset over the sea, a red apple, and a peace sign, each pixel answered in a separate context with no access to any other answer. The system message shown is identical in every session; the user message names the subject and one coordinate. Layout and palette recur across sessions; detail and exact pixel values do not.
Context after the first view
Same pieces
Relations
Plan wall
Order
Own drawings kept
0.97
1.00
0.99
0.92
Own drawings removed
0.99
0.96
0.99
0.79
Drawings and list removed
0.88
0.79
0.99
0.80
Fresh call per view
0.71
0.61
0.24
0.63
Chance
–
–
0.31
0.50
Table 4: Self-furnished rooms: revisit consistency (piece-set Jaccard and relation agreement between a revisited heading and its first view) and agreement between each wall view and the agent’s own floor plan (piece on exactly its plan wall; left-to-right order). 30 rooms.
Figure 9: Self-furnished rooms, two conversations. The agent is given only a furniture list, arranges the room itself, draws the facing wall, turns six times, and ends with a floor plan; the frames are shown in the order drawn, revisited headings marked. Top: its own drawings are deleted from the context after every turn. Bottom: the furniture list is deleted too; the same pieces return on the same walls and the plan lists all of them.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Harness
Renderer
Representation / interaction
Pixel
PIL
Individual pixel assignments
Shapes
PIL
Ordered geometric marks
Canvas 2D
Node + Canvas 2D
JavaScript on a persistent canvas
SVG
resvg
Complete vector-document replacement
GUI
JS Paint / Chromium
Mouse and keyboard actions with screenshots
Blender Cycles
Cycles
Procedural 3D scenes with render feedback
Appendix
Table 5: Drawing harnesses, renderers, and interaction mechanisms. Their protocols are not uniformly matched in compute or feedback.
Figure 10: Complete correctness census for the 200 WorldBench items. Each label gives original/code/render correctness in that order. There are 107 all-correct, 30 all-wrong, and 63 mixed items.
Image generation models have evolved from text-conditioned pixel synthesis toward multimodal agents endowed with visual comprehension and tool invocation capabilities. Yet, existing agents remain at the mercy of underlying black-box image models. Their workflow is trapped in a repetitive cycle of prompt rewriting for generation refinement, leaving them with no mechanism to directly manipulate the canvas. In essence, the potential of LLMs to serve as a genuine "brush" for precise visual construction remains largely untapped. In this paper, we propose GenClaw, a code-driven agentic image generation paradigm that empowers the agent to create like a human artist: first conceptualizing, then sketching, and finally coloring. Specifically, the agent first constructs the conceptual knowledge and context through search and reasoning. It then utilizes code (e.g., SVG, HTML, ThreeJS) to render executable visual sketches. Finally, it employs an image generation model to supplement textures, materials, and photorealism. In this workflow, code serves as a controllable intermediate canvas bridging linguistic reasoning and pixel synthesis, seamlessly integrating programmatic logic with the visual expressiveness of generative models. By transforming image generation from a black-box paradigm into a staged process akin to authentic human creation, GenClaw offers a step toward for highly controllable and interpretable visual generation systems.
Junyan Ye, Jun He, Zilong Huang +4
1Tencent Hunyuan · 2Sun Yat-sen University · 3Tsinghua University +1
Coding agents are increasingly moving beyond text-based software tasks to reconstruct visual targets through code. This capability, visual coding, requires agents to translate their understanding of visual targets into executable code. Slides provide a natural testbed for this capability, combining rich visual structure with objects that can be programmatically created and edited. To measure this capability, we introduce PPTBench, a benchmark for reconstructing scientific flow diagrams as editable PowerPoint slides. PPTBench covers 500 scientific flow-diagram tasks across 10 presentation domains, drawn from real research papers, and is evaluated with a four-stage agentic judge covering artifact validity, process and connector fidelity, rendering quality, and visual fidelity. Evaluation of ten models across 36 model--harness--effort configurations shows a substantial gap in reliable visual coding: the best configuration achieves 77.34, while the median across configurations is 24.38. Fine-grained analysis shows that agents can generally produce valid slide files, but struggle to produce high-quality reconstructions that faithfully recover the semantics and visual structure of the target. Further analysis shows that increasing reasoning effort primarily improves hard-gate passage rather than mean detail quality on each configuration's passing tasks, while configurations with more inspection tend to achieve higher overall scores. PPTBench establishes a measurable testbed for studying visual coding and advancing agents toward more reliable visual creation.
Learning reusable skills can improve visual reasoning agents, yet applying a skill still requires the agent to implement or invoke a procedure and produce the final answer. Errors and hallucinations at these steps can prevent acquired experience from translating into reliable single-run performance. We propose VisualCoding, which combines execution-guided acquisition of reusable visual programs with direct adoption of their answers on applicable inputs. Execution-Guided Program Acquisition composes visual primitives and additional code into family-level solvers, then iteratively tests and revises them on labeled training instances. Scope-Aware Direct Execution runs a retained solver and returns its valid in-scope answer. We evaluate VisualCoding on four models across four benchmarks spanning 69 task families. VisualCoding exceeds the strongest evaluated baseline in mean accuracy by 4.45 percentage points with Gemini-3.1-Pro and by 14.78 points when reusing the frozen Pro-acquired artifacts with Flash-Lite. Ablations support execution-guided acquisition and show that direct execution outperforms textual or callable reuse of the same programs. Code is available at https://github.com/jiaq-liu/VisualCoding.
Jiaqi Liu, Ruinan Jin, Xiaoxiao Li
Department of Electrical and Computer Engineering, University of British Columbia · Vector Institute