Skip to main content
UI Resources are Jinja2-based HTML templates that agents render dynamically in chat. Instead of plain text, agents can display cards, tables, forms, and other interactive elements.

How It Works

  1. You create a UI Resource template with HTML, CSS, and Jinja2 placeholders
  2. You create a UI Resource Tool and link it to the template
  3. When an agent calls the tool, it passes data to the template
  4. The template renders and displays in the chat as an iframe

Creating Templates

1

Open the Template Builder

Navigate to AI Studio > UI Resources > Create Template
2

Configure Settings

3

Define the Context Schema

The context schema specifies what data your template expects. The agent and tool use this schema to know what fields to extract from the conversation.
4

Write the Template

Use Jinja2 syntax to create dynamic HTML. Include <style> tags for CSS within the template.
5

Add Preview Data

Provide sample data to test rendering in the preview pane:

Template Syntax (Jinja2)

Variables

Conditionals

Loops

Loop utilities: loop.index (1-indexed), loop.first, loop.last, loop.length.

Filters

Conditional CSS Classes

Macros

Define reusable components within a template:
⚠️ WARNING: Templates run in a sandboxed environment. Some Jinja2 features are disabled for security.

Connecting Templates to Agents

After creating a template, you need a UI Resource Tool to make it available to an agent:
  1. Go to AI Studio > Tools > Create Tool
  2. Select UI Resource as the tool type
  3. Set the template name in Additional Info
  4. Define the input schema (matching the template’s context schema)
  5. Write a prompt describing when the agent should display this template
  6. Assign the tool to your agent
See UI Resource Tool for detailed configuration.

AI-Powered Editing

The template builder includes an AI assistant that can modify templates using natural language:
  1. Open a template in AI Studio > UI Resources
  2. Go to the Template tab
  3. Click the AI Edit button (sparkles icon)
  4. Describe your changes: “Add a button”, “Make it responsive”, “Use blue tones”
See AI Template Editor for details.

Configuration Reference

Template Fields


Troubleshooting

  1. Verify the template name matches exactly in the tool’s Additional Info
  2. Check the template is marked as active
  3. Verify context data matches the schema requirements
  4. Review the template for Jinja2 syntax errors
  1. Check context data is being passed correctly by the tool
  2. Verify variable names match the schema keys exactly
  3. Use {{ variable | default('N/A') }} for optional fields
  1. Include a <style> tag within the template
  2. Use inline styles for critical elements
  3. Avoid referencing external stylesheets
  1. Verify Auto-Resize is enabled in the tool configuration
  2. Avoid fixed heights in CSS
  3. Use flexible layouts (flexbox, grid)