> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agi.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Task Design & Prompting

> Write prompts the phone agent executes reliably.

A phone task is one natural-language instruction executed on a real device. The difference between a flaky task and a reliable one is almost always the prompt. Five principles cover most of it.

## 1. One errand per task

Size each [`phone_run_task`](/api-reference/tools/phone-run-task) to a single errand, and chain follow-ups in the same session.

**✅ Good - focused:**

```text theme={null}
Open Settings and report the current battery percentage.
```

**❌ Bad - a whole afternoon in one prompt:**

```text theme={null}
Check my battery, then go through all my unread email, reply to the
important ones, find me a flight to Denver, and update my calendar.
```

Oversized tasks burn their timeout, risk `terminal: "iteration_limit"`, and lose all progress on failure. Several tasks in one session get separate timeout budgets and keep completed results. See [Cross-app workflows](/guides/use-cases/cross-app-workflows).

## 2. Name apps and targets precisely

The agent operates the real UI - ambiguity on a phone means tapping the wrong thing.

```text theme={null}
Open WhatsApp (the green one, not WhatsApp Business) and find my chat with
"Sam Rivera". If there are multiple matches, list them and ask me instead
of guessing.
```

* Name the app as it appears on the device. When unsure what is installed,
  check first with [`phone_get_state`](/api-reference/tools/phone-get-state) -
  it lists launchable apps with label and package name.
* Spell out contact names, account names, and which screen or tab to use.
* Give the agent an explicit escape hatch: *"if you're unsure, stop and ask
  me"* - that surfaces as a handoff instead of a wrong guess.

## 3. Gate anything that acts

Reading is safe to automate; **sending, buying, deleting, and changing settings deserve a confirmation gate in the prompt:**

```text theme={null}
Draft the message and show it to me first. Wait for my OK before sending.
```

```text theme={null}
Stop and ask me before any login or payment screen, and before granting
any permissions.
```

Sensitive moments the phone detects itself - logins, confirmations, CAPTCHAs - always come back as `needs_user_control` regardless. The gate covers the judgment calls above that bar. See [Security](/guides/best-practices/security).

## 4. Specify the output you want

The task's `result` is your return value - define its shape:

```text theme={null}
Check my three travel apps for SFO→DEN flights next Friday. Report the
three cheapest as a list: airline / departure time / price, one per line.
If an app shows no results, say so explicitly rather than skipping it.
```

Structured results make the next task's prompt (and your client's reasoning) precise. Ask for "not found" to be reported explicitly so silence never has to be interpreted.

## 5. Set boundaries for read-only work

Tell the agent what *not* to do, so observation doesn't become action:

```text theme={null}
Summarize my unread email from this morning. Don't reply to anything,
don't archive anything, don't open links.
```

## Quick checklist

* [ ] One errand, not a workflow
* [ ] Apps, contacts, and screens named exactly
* [ ] Confirmation gate on anything that sends, buys, deletes, or changes settings
* [ ] Output format specified, including the "not found" case
* [ ] Read-only boundaries stated
* [ ] "Ask me if unsure" escape hatch included

## Related

<CardGroup cols={2}>
  <Card title="Task lifecycle" icon="arrows-spin" href="/guides/concepts/task-lifecycle">
    What happens after you press go
  </Card>

  <Card title="Performance" icon="bolt" href="/guides/best-practices/performance">
    Timeouts and task sizing
  </Card>
</CardGroup>
