> For the complete documentation index, see [llms.txt](https://docs.orchard.airoverflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orchard.airoverflow.com/mcp/workflows.md).

# Workflows

## The look-then-tap loop

The core pattern, repeated until the task is done:

1. `list_sandboxes` → pick a device.
2. `screenshot` → the agent sees what's actually on screen.
3. The agent reasons about where to act from the image.
4. `tap` / `type_text` / `swipe` / `tap_text`.
5. Back to step 2 to confirm and continue.

Because `screenshot` returns a real image, the model chooses pixel coordinates from the current screen rather than guessing. It works the same way a person does.

## Example: sign into an app

> *"On `my-pixel`, open Settings and turn on airplane mode."*

A capable agent will, roughly:

1. `launch_app("my-pixel", "com.android.settings")`
2. `screenshot("my-pixel")` → find the "Network & internet" row
3. `tap_text("my-pixel", "Network & internet")` (or `tap` at its coordinates)
4. `screenshot` → locate the Airplane-mode toggle
5. `tap("my-pixel", x, y)` on the toggle
6. `screenshot` → confirm it's on

## Tips

* Prefer `tap_text` when a label is unique and visible. It's more robust than pixel coordinates across screen sizes. Fall back to `screenshot` and `tap` when there's no matching label, or when several labels match.
* Use `logs_tail` to confirm an app reacted (an intent fired, a crash) when the screen alone is ambiguous.
* Give the agent a [scoped key](https://github.com/TheFlash2k/orchard/tree/main/docs/sdk/guides/scoped-api-keys.md): limit it to the one sandbox and the `input` capability so a prompt can't wander the fleet.
* `create_snapshot` before a risky sequence, `restore_snapshot` to get back to a known state.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.orchard.airoverflow.com/mcp/workflows.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
