# Working with the Agent

> Steer the ExaSpark Agent with focused prompts, non-blocking choice cards, direct click-to-edit, 1-click Undo checkpoints, and log-driven error fixes.

- Canonical: https://exaspark.ai/docs/working-with-the-agent/

## The iterative build loop

Building with the ExaSpark Agent works best as a tight, observable conversation rather than a blind one-shot generator. On every turn, the Agent inspects your live project, applies coordinated frontend and backend changes, checks the running result in **Preview**, and records a clean checkpoint.

*Figure: From request to verified preview: the Agent scopes pages and data, applies visual design, builds frontend and backend together, checks for runtime errors, and saves a clean checkpoint.*

1. **State one clear outcome** — Describe the exact feature, screen, or data rule you want added or updated. Attach reference files via **+** when real brand content or layout cues apply.
2. **Follow progress and answer choice cards** — Watch tasks execute live in chat. If a product trade-off surfaces, click an option on the choice card or reply in plain English.
3. **Verify directly in Preview and Cloud** — Exercise the new button, form, or role restriction inside **Preview**, then confirm **Cloud** database rows reflect the action cleanly.
4. **Polish details in place** — Use **click-to-edit** for quick text, label, or style adjustments instead of spending another full build turn on minor visual tweaks.
5. **Lock in or revert cleanly** — Move straight to the next milestone if **Preview** looks great, or click **Undo** to return immediately to the previous checkpoint.

## Non-blocking clarifying choice cards

Real apps are full of product forks where two choices are equally valid: should checkout allow guests or require sign-in? Should bookings confirm immediately or wait for admin approval? Should memberships bill monthly, annually, or both?

Instead of guessing silently or locking your workspace behind a rigid setup wizard, the Agent posts a compact **choice card** directly in the conversation thread.

### Answering choice cards your way

Choice cards are designed to stay completely non-blocking and flexible:

- **One-click answers.** Pick a suggested option — or select multiple options when applicable — to resolve the trade-off immediately.
- **Custom replies anytime.** Ignore the preset buttons and reply in your own words if you have an exact business rule, such as `"Allow guest browsing, require Google sign-in at checkout, and enforce a 12-hour cancellation cutoff."`
- **Automatic defaults for boilerplate.** The Agent never peppers you with questions about routing syntax, database indexes, or SSL certificates — routine engineering decisions stay automatic so your attention stays on product behavior.

## Choose the fastest editing tool

ExaSpark gives you six complementary controls inside one studio. Reaching for the right tool cuts revision time and preserves your credit balance.

| What you want to change | Fastest tool | Speed & credit impact | Concrete example |
| --- | --- | --- | --- |
| **Add pages, tables, roles, or Stripe flows** | **Chat request** | Full-stack turn; updates UI, API, and **Cloud** together | `"Add an admin-only Check In button that stamps arrival time and emails a receipt"` |
| **Resolve an open business trade-off** | **Choice card** | Instant decision; prevents wrong assumptions downstream | Choosing `$20 deposit` vs `full upfront payment` when surfaced in chat |
| **Edit wording, labels, color, or spacing** | **Click-to-edit** | Fastest & lightest; avoids broad codebase passes | Rewriting a hero headline, button label, or card padding inside **Preview** |
| **Compare brand looks or page structure** | **Design Canvas** | High leverage before code; prevents full-app rewrites | Reviewing 3 homepage concepts side by side before adopting one into **Web** |
| **Revert an experiment that missed** | **1-click Undo** | Instant; leaves zero leftover patch clutter | Rolling back an overly complex sidebar layout to the prior working checkpoint |
| **Fix a crash, build failure, or deploy error** | **Ask AI to fix** | High precision; feeds exact failure logs to the Agent | Recovering a broken Preview route, production build failure, or Android build error |

## Click-to-edit vs chat requests

Understanding the clean line between **click-to-edit** and **chat** is one of the quickest productivity upgrades in ExaSpark.

### When click-to-edit wins

Use **click-to-edit** in **Preview** or **Design** whenever the change is purely local and visual: tightening a headline, fixing a typo, swapping a CTA label from `"Submit"` to `"Book my court"`, nudging padding, or tuning an accent color. You point directly at the element, change it, and keep moving.

### When chat requests win

Use **chat** whenever a change touches behavior, data, conditional states, or multiple screens at once — for example, validating a form field, adding a new **Cloud** column, restricting an endpoint to admins, wiring a Stripe webhook, or updating every card bound to a database table.

> **Example prompt (App):** Add a Check In button on the admin bookings table. When clicked, set booking status to Checked In, record the timestamp in Cloud, highlight the row in soft green, and send a short confirmation email to the guest.

## Checkpoints, Undo, and log-driven recovery

Confidence while iterating comes from knowing you can neither lose working progress nor get stuck on cryptic errors.

### 1-click Undo checkpoints

Every completed Agent turn automatically saves an immutable project checkpoint. If a turn introduces layout clutter, takes a feature in the wrong direction, or adds complexity you no longer want, click **Undo** to restore your exact prior code and configuration immediately.

Prefer **Undo** over typing `"please undo that last change"` whenever you want a clean slate. Reversing via chat can leave stray CSS overrides or unused fields behind, whereas **Undo** restores the exact earlier snapshot cleanly.

> **Note:** **Preview** database rows you created while testing live in your isolated **Cloud** tables. If an undone turn added test records you no longer need, you can remove or edit them anytime in the **Cloud** tab without touching **Live** customer data.

### Log-driven recovery with Ask AI to fix

If **Preview**, a production **Publish** build, or an **Android** package hits an error, ExaSpark surfaces an error banner with an **Ask AI to fix** button.

Always click **Ask AI to fix** rather than describing the error from memory. Clicking that button passes the exact compiler stack trace or runtime error log straight to the Agent, letting it locate the root cause, patch the underlying file, and re-verify the build automatically.

### Reporting logic bugs that do not crash

Sometimes the app compiles cleanly, yet a business rule behaves differently than you intended (for instance, a discount applies to the wrong plan, or a member sees an empty state). Send a tight four-line bug report so the Agent reproduces and fixes it on the first try:

```text
Bug report:
- Page / route: /admin/bookings
- Signed-in role: Admin (test-admin@example.com)
- What happened: Clicking "Mark Paid" shows a success toast, but refreshing resets status to Pending.
- Expected result: Status saves as Paid in the Cloud bookings table and stays Paid after refresh.
```

> **Note:** Verify the main user action in **Preview** right after each feature turn. Confirming changes while they are fresh guarantees every saved checkpoint is clean and reliable.

## Next steps

- [Multi-turn best practices](https://exaspark.ai/docs/multi-turn-best-practices/) — Sequence complex apps across milestones and avoid prompt drift.
- [How ExaSpark works](https://exaspark.ai/docs/how-exaspark-works/) — See how turns, project memory, and Preview isolation work together.
- [Troubleshooting](https://exaspark.ai/docs/troubleshooting/) — Diagnose common preview, auth, Stripe, DNS, and Android issues.
- [Code & GitHub App](https://exaspark.ai/docs/code-and-github/) — Inspect files, checkpoints, and export via the Official GitHub App.

## From the blog

- [What is an AI agent?](https://exaspark.ai/blog/what-is-an-ai-agent/) — Plain-English guide to how agents plan, verify, and use tools.
- [Common vibe coding mistakes](https://exaspark.ai/blog/vibe-coding-mistakes/) — Habits that keep multi-turn AI builds fast and reliable.
- [How ExaSpark works](https://exaspark.ai/blog/how-exaspark-works/) — Follow one project from opening prompt to live launch.
