Write Relo with AI
Before you start: the basics and host actions.
A coding agent can help you build a screen, fix a layout bug, or add an interaction. The useful part is being able to check its work: read the document, run the interaction, and see the result on a device.
Relo keeps layout, bindings, and event handlers in XML. A button's handler shows which state it changes or which service it calls. Components declare their props. Your agent can follow the same code you review, and the shared engine can check the document before it reaches your app.
This guide covers using AI while developing your application. If you want an agent inside your app to generate UI for users, start with Build AI-driven apps.
Give the agent your actual source
Start with a checkout that matches the Relo version your app uses. Point the agent to the screen it should change, its component definitions, and the host actions it can call. A working example is more useful than asking it to infer an API from a component name.
In this repository, these are useful starting points:
| Source | What the agent can learn |
|---|---|
backend/app/ui/screens/ | Complete screens with their initial data |
components/xml/ | Component props, slots, styles, and event handlers |
components/registry/index.json | Available component families and dependencies |
backend/app/assistant/skills/ui-authoring/SKILL.md | Layout, bindings, accessible labels, and verification patterns |
backend/app/assistant/skills/mini-apps/SKILL.md | Persistent lists and service-backed interactions |
backend/app/assistant/skills/maps/SKILL.md | The example host's map component and selection events |
Keep this reference source current when you upgrade. Foldkit's AI setup guide and Effect's guide to giving agents library source describe the same useful practice: let the agent inspect the implementation and examples for the version you run.
Add project instructions
Tell your coding agent where your UI lives and how to check it. For example, add the following to your project's agent instructions, adjusting the paths and commands to your application:
Before changing Relo UI:
- Read the screen and its component definitions.
- Read backend/app/assistant/skills/ui-authoring/SKILL.md.
- Use component props and style presets from the source, not guessed APIs.
- Keep temporary input state local. Save durable data through registered actions.
- Check the complete document and test the interaction you changed.
- Preview on the target platform, including narrow widths and larger text.
The included skills contain concrete rules: use explicit bindings for typed values, give controls distinct accessible labels, let text shrink and wrap in rows, and keep generated response cards content-sized. They also show how to handle failed actions and write useful interaction assertions.
These files are included with the assistant example. A coding agent can read them from the checkout; they are not automatically installed into your editor.
Ask for an observable change
Give the agent a task with a result you can test:
In the travel screen, add a saved-only filter.
Use the existing card and button components. Keep the filter in local state.
Show an empty message when no saved stays match.
Verify that saving a stay makes it appear in the filtered view, and that
removing the last saved stay shows the empty message.
That gives the agent a screen, a state owner, a component vocabulary, and expected behavior. Review the resulting XML alongside the checks it ran.
Check the result before previewing
The Components CLI can find missing definitions and assemble a complete document. The shared-core relo validate command checks document structure. relo verify runs interaction steps against mocked services, so an agent can check that pressing a button changes the displayed result or sends the expected action.
The assistant example also exposes verify_ui and verify_behavior development tools. Its generation backend applies local corrections for recognized mistakes, then reruns verification. This can fix an escaped attribute or a malformed mock envelope without sending the entire candidate back to the model.
See Skills, verification, and correction for the tools, their inputs, and where those corrections run. A successful behavior check covers the supplied steps; use the browser and a native device or simulator to check layout, editing, and focus.
Ship the document when it is ready
AI can shorten the time between a bug report and a tested fix. Server-driven UI shortens the next part: getting that fix to people using your mobile app.
For example, an agent can adjust a checkout form, you can review and test it, and your backend can serve the updated document to compatible clients. A change that uses the client's existing components and actions can follow your server deployment schedule, without waiting for another app binary to be distributed.
This is why delivery matters even when writing native code gets easier. You still write native code when you need a new capability. Once that capability is installed, you can keep improving the screens that use it at the pace of your backend releases.
See Deploy UI changes for compatibility, rollout, and app distribution requirements.