> ## 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.

# Cross-App Workflows

> Multi-step workflows that span several apps in one session.

The most valuable phone-agent workflows span apps: research in one, verify in another, act in a third. The unit of organization is the **session** - several focused tasks on one device, in sequence, sharing context through your AI client.

## A complete example

```text theme={null}
On my phone: find the three cheapest flights from SFO to Denver next
Friday in my travel apps and note the prices. Check my calendar for
conflicts that day. Then draft a WhatsApp message to Sam with the best
option and the prices, and show it to me before sending. Stop and ask me
before any login or payment screen.
```

The assistant breaks this into several [`phone_run_task`](/api-reference/tools/phone-run-task) calls in one session - search, calendar check, message - reusing the same `session_id` so the whole workflow stays on one device. Logins and payment screens come back as `needs_user_control` handoffs, so nothing is bought or sent without you.

## Why several tasks beat one mega-task

| One giant task                | Several tasks in a session                   |
| ----------------------------- | -------------------------------------------- |
| One timeout covers everything | Each step gets its own timeout budget        |
| A failure loses all progress  | Completed steps keep their results           |
| Risks `iteration_limit`       | Each task stays well inside the action limit |
| Hard to steer mid-flight      | Your client reasons between steps and adapts |

The client is the orchestrator: it reads each task's `result`, decides the next step, and carries context forward in the next prompt.

## Session discipline

* **Pass the `session_id`** returned by the first task on every follow-up, so
  related tasks stay grouped on one phone.
* **Don't end the session between steps.** A successful task completion keeps
  the session alive; call
  [`phone_session_end`](/api-reference/tools/phone-session-end) only when the
  entire workflow is done.
* **One workflow, one device.** Sessions never span devices. For a
  second phone, start a separate task/session with that `device_id`.
* **A wrong turn doesn't kill the workflow** - cancel the current task with
  [`phone_task_cancel`](/api-reference/tools/phone-task-cancel) and dispatch a
  corrected one in the same session.

## Carrying context between tasks

Each task prompt should stand alone - include what the agent needs from earlier steps:

```text theme={null}
Earlier you found: United $128 7:05am, Frontier $89 6:15am, Southwest $112
9:40am. Now open WhatsApp and draft a message to Sam recommending the
Southwest 9:40am for $112 (best time/price balance). Show me before sending.
```

<Tip>
  Have research tasks return structured output ("list each flight as
  airline / time / price, one per line") so the next prompt can quote it
  precisely. See [Task design](/guides/best-practices/task-design).
</Tip>

## Related

<CardGroup cols={2}>
  <Card title="Devices & Sessions" icon="mobile" href="/guides/concepts/devices-and-sessions">
    The session model in depth
  </Card>

  <Card title="Session management" icon="window-restore" href="/guides/best-practices/session-management">
    Boundaries, expiry, and multi-device patterns
  </Card>
</CardGroup>
