Skip to main content

Rive AI Agent

The Rive Editor includes a built-in AI Coding Agent that understands the Rive Luau API, can create and modify scripts, build animations, manage ViewModels, and more. No API keys, external apps, or setup required.


What the AI Agent Knows

The agent is initialized with:

  • Complete Rive Luau type definitions — all types (Node<T>, Layout<T>, Converter<T>, PathEffect<T>, ListenerAction<T>, TransitionCondition<T>, Paint, Path, Vector, Mat2D, Color, Renderer, etc.)
  • Scripting conventions — factory functions, lifecycle callbacks, the self pattern
  • Editor context — access to all artboards, objects, scripts, animations, and ViewModels in your file

Available Tools

The AI agent has access to 14 specialized tools for interacting with different parts of the Rive editor.

Scripting Tools

ToolWhat It Does
text_editorView, create, and edit script files. Supports viewing file contents, creating new files, replacing text, and appending.
script_diagnosticsGet linter errors and warnings for a specific script or all scripts in the workspace.
get_scriptsList all scripts with their return types (node, layout, converter, pathEffect, listenerAction, transitionCondition, tests, none).
run_testsExecute a Test script and see pass/fail results.
recompile_all_scriptsCommit all script changes to the Luau VM so the runtime picks them up.
grepSearch for patterns across all scripts. Supports case-sensitive, whole-word, and regex matching.
read_consoleRead print output and errors from script execution. Filter by script name, entry type, or text content.

Editor Tools

ToolWhat It Does
animation_editorCreate and modify state machines and linear animations. Create layers, states, transitions, conditions, and keyframes.
layout_editorCreate flexbox-style layouts with alignment, padding, gaps, and text nodes.
viewmodel_editorCreate ViewModels with typed properties, create instances, set up data bindings between objects and ViewModel properties.
component_editorAdd component (artboard) instances to artboards. Supports node, leaf, and layout modes.
open_file_editorManage artboards — list, create, rename, resize, and set as active.
query_core_object_toolQuery and modify properties of any Rive object by ID. List children, get/set property values.
path_editorCreate shapes with paths, fills, and strokes. Build vector graphics programmatically.

Tool Command Schemas (What to Include in Prompts)

When asking the AI to use a tool, include the command shape explicitly (command + required fields). This reduces retries and malformed calls.

text_editor

  • Required: command, path
  • Command-specific fields:
    • view: optional view_range
    • create: text (and create_new: true for new files)
    • str_replace: old_string, new_string
    • insert: text

animation_editor

  • Required: command
  • Common command schemas:
    • createStateMachine: name, optional linearAnimations, layers
    • createLinearAnimations: linearAnimations
    • updateStates: states with id, optional animationId, x, y
    • createTransitions: states with id, transitions
    • createConditions: transitions with id, conditions
    • modifyKeyFrames: animationId, optional add / change / delete

layout_editor

  • Required: command
  • Typical creation fields: parent/layout target, sizing, direction, alignment, padding, gap, and children/text payload.

viewmodel_editor

  • Required: command
  • Typical fields: view model name, property definitions (type + name), instance creation, and binding payloads.
  • Important behavior: bindViewModelToComponent can create missing target property/instance names when not found.

component_editor

  • Required: command
  • Use addComponents for regular component instances.
  • Use addComponentList only with a ViewModel list property; the list auto-generates children at runtime.
  • Do not manually add children under a component list container.

read_console

  • Optional filters: script_name, entry_type, text_search
  • Pagination: limit, offset, optional reverse

grep

  • Required: pattern
  • Optional: case_sensitive, match_whole_word, regular_expression, inclusion_set

Important Operational Constraints

  • The script console is not live introspection: read_console can only read entries that were already produced by a prior run.
  • Script paths are flat in Rive: no folders/slashes and no .lua/.luau extensions.
  • Prefer ViewModels for data binding workflows; state machine inputs are a legacy/deprecated path unless explicitly required.
  • When binding strings to text, bind to the Text Run, not the parent Text object.
  • get_scripts return type none means a utility/module script (shared logic, not attachable behavior).
  • Scripts run in pure Luau + Rive APIs, not Roblox runtime globals (game, workspace, Instance).
  • Keep integer-style runtime values 32-bit safe unless you explicitly target wider numeric behavior.
Prompt pattern

Use: Goal + target object names + exact tool command fields. Example: “Use script_diagnostics on PlayerController, then text_editor.str_replace to fix type errors, then recompile_all_scripts.”


What This Teaches You (Even Without AI)

The tool workflow maps directly to a strong manual scripting loop in the editor:

  1. Write or edit a typed script (factory + protocol callbacks).
  2. Run diagnostics and fix all warnings/errors.
  3. Recompile so runtime bytecode updates.
  4. Trigger behavior in the scene (Play, pointer interaction, state changes).
  5. Inspect console output and iterate.
  6. For shared logic, add/update tests and run them before recompiling.

This loop is valuable even if you never use the AI assistant, because it mirrors how Rive actually validates and executes scripts.


Tips for Working with the AI

Be Specific

The more context you provide, the better the results.

# Less effective
"Make a button"

# More effective
"Create a Node script that draws a rounded rectangle button
at position (100, 50) with size 200x60. The button should
change color on pointerDown and have an Input<string> for
the label text."

Reference Existing Elements

If your file already has ViewModels, artboards, or scripts, mention them by name.

"Update the 'GameController' script to read the 'score'
property from the 'PlayerData' ViewModel and display it
using the draw() function."

Iterate

The AI can see its own output. Build incrementally:

  1. "Create a basic Node script that draws a circle"
  2. "Add an advance() function that makes it pulse"
  3. "Add a pointerDown handler that changes the color"
  4. "Run the tests to make sure everything compiles"

Common Workflows

Creating a New Script

  1. Describe what you want the script to do
  2. The AI uses text_editor to create the file
  3. It runs script_diagnostics to check for errors
  4. It calls recompile_all_scripts to commit to the VM

Setting Up Data Binding

  1. "Create a ViewModel called 'PlayerData' with properties: score (number), name (string), isActive (boolean)"
  2. "Bind the 'score' property to the text run in my artboard"
  3. "Create a Node script that updates the score on pointerDown"

Building Animations

  1. "Create a state machine called 'ButtonSM' with Idle and Pressed states"
  2. "Add transitions between the states"
  3. "Create linear animations for each state"
  4. "Add keyframes for the opacity property"

Debugging

  1. "Read the console output for the 'GameController' script"
  2. "Run diagnostics on all scripts"
  3. "Search for all uses of 'playerHealth' across scripts"

Limitations

The AI agent cannot:

  • Preview or render animations visually
  • Access external files, APIs, or the internet
  • Undo its own actions (but you can use editor undo)
  • Interact with runtime runtimes (web, iOS, Android)
  • Access Rive community files or external .riv files

The AI agent works within your current file only. It sees the artboards, scripts, ViewModels, and objects in the file you have open.


Quick Reference

TaskWhat to Ask
Write a script"Create a [Node/Layout/Converter/PathEffect] script that..."
Fix errors"Run diagnostics and fix any issues"
Find code"Search for 'functionName' across all scripts"
Check output"Read the console output"
Create animation"Create a state machine with..."
Set up data"Create a ViewModel with..."
Build layout"Create a flex layout with..."
Add component"Add the 'Button' artboard as a component"

See Also: Script Types Overview, Welcome

Next Steps