How to Generate HTML Assets for Your AI Agents
Learn how to structure JSON content, design HTML templates, and render polished webpages with dynamic data.
Last updated
Learn how to structure JSON content, design HTML templates, and render polished webpages with dynamic data.
Last updated
Generating HTML assets enables your AI agents to produce professional, styled web outputs—ideal for reports, articles, or visual summaries.
The example workflow builds a long-form article page through the following steps:
User Input: Captures a topic from the user.
User Context: Gathers additional context via AI-generated questions.
Generate Queries: Uses that context to generate relevant Google search queries.
Run Research Subworkflow:
Searches Google
Scrapes each result
Summarizes each page
Compile Results: Collects all structured data into a JSON object.
Generate Images: Runs a subworkflow that:
Creates image prompts from each article section
Generates images with a model
Combine Content: Uses a custom function (e.g., add images to report
) to merge article JSON and images into a final, structured variable (e.g., updated report
).
Set the Source Type to HTML
.
Output variable: e.g., HTML
Format: HTML
Enable image rehosting if needed.
Expand the Source Document field to edit and preview your HTML. Use Handlebars-style syntax to bind JSON variables:
Use {{#each}}
and {{/each}}
to loop through arrays.
Nest variables properly based on your JSON structure.
Paste in your sample JSON and variable name (e.g., updated_report
) to preview the output live in the editor.
If you don’t want to hand-code HTML:
Use the Generate Asset Helper agent.
Provide:
Your variable name (e.g., updated_report
)
Sample JSON
A clear description of the page (e.g., “a long-form article page with images above each section”)
The helper will:
Ask design questions (layout, font, colors, spacing)
Generate a complete HTML template
Provide instructions to paste it into your asset block
Add a Display Content block:
Set the type to HTML
Connect it to the output of your Generate Asset block
Your AI agent will now generate and render a fully styled web page as the final output.
The HTML template can include embedded CSS using <style>
tags. You can:
Adjust fonts, spacing, and layout
Change image border radius or alignment
Modify heading sizes (e.g., h1
, h2
, h3
)
Edit and preview changes instantly in the asset editor.
When inserting dynamic content:
Use full paths (e.g., {{updated_report.title}}
)
Don’t reference standalone keys (e.g., {{title}}
) unless the variable is defined globally
The Generate Asset block allows you to:
Display highly customized HTML pages
Combine AI-generated content and imagery
Provide end users with a rich, professional experience
For advanced use cases, explore how other MindStudio agents (like “Generate LinkedIn Carousel” or “Generate Podcast”) implement this technique.