--- title: Reliability Tips subtitle: Write robust prompts and handle edge cases slug: going-to-production/reliability-tips --- The difference between a demo and production-ready automation is reliability. This page covers techniques for writing prompts that work consistently, handling dynamic pages, and validating results. --- ## Writing robust prompts ### Anatomy of a good prompt Every prompt needs four components: 1. **Main goal** (required) — What should happen 2. **Guardrails** — Constraints and boundaries 3. **Payload** — Data to use in form fields 4. **Completion criteria** (required) — How to know when done ``` Your goal is to fill out the contact form with the provided information. Only fill out required fields. Skip optional fields unless you have data for them. Here is the information: {{contact_data}} COMPLETE when the form is submitted and you see a confirmation message. TERMINATE if you see an error message or the form cannot be submitted. ``` ### What works **Be explicit about completion.** The AI needs to know when to stop. "COMPLETE when you see 'Order confirmed'" is unambiguous. Without this, the AI might keep navigating or stop too early. **Don't forget the submit button.** A common failure mode is the AI completing after filling form fields but before clicking Submit. Be explicit: "COMPLETE when you have clicked the Submit button AND see a confirmation message." The AI might consider the form "done" once all fields are filled—make clear that submission is part of the goal. **Use visual descriptions.** "Click the blue Submit button at the bottom of the form" works better than "click Submit"—there might be multiple buttons, and visual context helps the AI pick the right one. Describe position, color, icons, and surrounding text. **Start general, then refine.** Begin with simple prompts and add specifics based on failures. Over-specified prompts are brittle; the AI handles variation better when you describe goals rather than exact steps. **Include termination criteria.** Tell the AI when to give up: "TERMINATE if login fails or account is locked." Without this, the AI might keep trying forever or fail silently. **Reference visual indicators.** "The invoice download link has a PDF icon next to it" helps the AI identify the right element when there are multiple links with similar text. ### What doesn't work **Vague goals.** "Do the thing on the website" gives the AI nothing to work with. Be specific about what outcome you want. **Missing completion criteria.** Without knowing when to stop, the AI keeps navigating indefinitely or terminates at arbitrary points. **Action lists without context.** "Click button A, then B, then C" breaks when the layout changes or buttons move. Describe the goal instead, and let the AI figure out the steps. **HTML element names.** "Click the `