Build a scene with an assistant
The chain from the widget list to a rendered image: rules, document, dry run, draft, publish, and preview.
- For
- Anyone who lets an assistant design scenes, and developers who want to understand what it does along the way
- Prerequisite
- a connected assistant with the area Scenes, see Connect an AI assistant
- Where
- a conversation with your assistant
By the end, your assistant has built a scene from widgets, checked it, saved it as a draft, and shown you a rendered image of it. The way from idea to image is a chain of six steps, and every tool description names the next one, so an assistant doesn't have to guess the order.
Steps
-
View the widgets.
list_widgetsnames the widgets a scene is made of: the core widgetstext,image,video,shape,graphic,document, andzone, which are always there, and the widgets of the apps your organization has installed. Each entry shows the identifier, app, name, a sentence, the required fields, and whether the app is installed. A widget of an app that isn't installed can be written into a document but runs on no display. -
Get the rules.
get_widget_schemareturns the complete JSON Schema of a widget's configuration (Draft 2020-12): every field withtitleanddescription, the required fields underrequired, and underexamplesat least one complete example configuration. Taking an example and swapping the values is the shortest way.One value no schema lists: the
graphicIdof the core widgetgraphic. It is a fixed identifier from the graphics library.list_graphicslists it with category and keywords, searchable by intent with German words such as "pfeil" (arrow) or "kaffee" (coffee). -
Build the document. A scene document has three fields:
JSON{ "canvas": { "width": 1920, "height": 1080, "backgroundColor": "#ffffff" }, "widgets": [ { "id": "wgi_01K7Z9M4T0W14MCPTEXT000001", "appId": "core", "widgetType": "text", "appVersionPin": "0.0.0", "frame": { "x": 0, "y": 0, "w": 1920, "h": 1080 }, "zIndex": 0, "config": { "content": "Welcome" } } ], "transitions": { "in": { "kind": "fade", "durationMs": 600 }, "out": { "kind": "fade", "durationMs": 600 } }}A scene has no resolution. Every widget sits by its
framein units of the canvas, and the short edge of the canvas always measures 1080: 16:9 is 1920 × 1080, 9:16 is 1080 × 1920. Each display renders as sharply as its device and package allow. A zone is a widget withappId: "core"andwidgetType: "zone". It splits the scene, and itsconfignamesname,primary, andcontent: a single item, an own sequence, or a playlist. At most one zone isprimary, and that main zone sets how long the scene runs. Zones don't overlap, and a widget inside a zone sits there without a frame of its own.configcomes from step 2. -
Run a dry run.
validate_scenechecks the document without saving anything: the structure, the rules of the zones, the referenced media, and every configuration against the schema of its widget. Each finding names the widget and the field:JSON{ "valid": false, "findings": [ { "severity": "BLOCKING", "type": "ConfigSchemaIncompatible", "message": "widget 'wgi_…' (text): config/content must NOT have fewer than 1 characters", "widgetId": "wgi_…", "field": "/content" } ]}BLOCKINGprevents publishing later,WARNINGdoesn't. A widget that sticks out past the edge of the canvas is reported and stops nothing. -
Create or change the draft.
create_scenecreates a draft from the document, andupdate_scenereplaces the document of an existing scene. Both run the dry run again and write nothing at all if a finding blocks. Both needconfirm: true, and without it they only describe what they would do.To change an existing scene, start with
get_scene_document. It returns the document of the draft and itsversion. Change that document, check it withvalidate_scene, and send it whole toupdate_scenewithexpectedVersionfrom the same answer, so that someone else's change in between isn't overwritten. There is no way to change a single widget, and an assistant that rebuilds the document from scratch loses every setting it didn't know about. -
View and refine.
render_scenerenders a published version and returns the image as a PNG in the answer. A pure draft has no version, so publish it first withpublish_scene. That doesn't put it on a display as long as none has it assigned. The image answers what no schema can: whether the text stays in its box, whether something is covered, whether the colors work. If something is off, continue withupdate_sceneand publish again.
Check the result
get_sceneshows the scene with its widgets and no open issue.- The image from
render_sceneshows what you asked for. - What a display actually shows answers
get_player_screenshot, with the most recent capture of the device. If there is none yet,send_player_commandwithcommand: "screenshot"requests one.
If something goes wrong
| Symptom | Meaning | Solution |
|---|---|---|
create_scene or update_scene returns findings and saves nothing |
A finding blocks. | Fix the fields the findings name and run validate_scene again. |
update_scene answers conflict |
Someone changed the scene in between. | Read the document again with get_scene_document and apply the change to the new state. |
render_scene says there is no version |
The scene is still a pure draft. | Publish it with publish_scene, then render. |
render_scene says no preview is available |
Your environment has no snapshot service set up. | Check the result with get_player_screenshot on a display instead. |
| A widget appears in the document but not on the display | Its app isn't installed in your organization. | Install the app, or use a core widget instead. |
Was this helpful?