> 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/guides/input.md).

# Input: tap, swipe, type, keys

Sometimes the only way to drive a device is to touch it. Every `Sandbox` handle has typed input methods over the unified control endpoint. They return the agent result dict (Python) or promise (TypeScript).

{% tabs %}
{% tab title="Python" %}

```python
sb = orchard.sandbox("my-pixel")
sb.tap(540, 1200)                     # tap at pixel (x, y)
sb.swipe(540, 1600, 540, 400, ms=250) # drag (scroll up), over 250 ms
sb.key("back")                        # home / back / recents / power / volup / voldown / enter …
sb.text("hello@example.com")          # type into the focused field
sb.type_text("hello@example.com")     # alias of text()
sb.tap_text("Sign in")                # find an element by its label and tap it
sb.launch("com.android.settings")     # launch by package id (iOS: bundle id)
# start an exported activity, with an optional intent action, data and extras:
sb.launch_intent("com.android.settings", ".Settings")
sb.launch_intent("com.example.app", ".DeepLinkActivity",
                 action="android.intent.action.VIEW", data="myapp://open/42")
```

{% endtab %}

{% tab title="TypeScript" %}

```ts
const sb = orchard.sandbox("my-pixel");
await sb.tap(540, 1200);
await sb.swipe(540, 1600, 540, 400, 250);
await sb.key("back");
await sb.text("hello@example.com");
await sb.tapText("Sign in");
await sb.launch("com.android.settings");
await sb.launchIntent("com.android.settings", ".Settings");
await sb.launchIntent("com.example.app", ".DeepLinkActivity",
  { action: "android.intent.action.VIEW", data: "myapp://open/42" });
```

{% endtab %}
{% endtabs %}

Coordinates are device pixels. Pair input with a screenshot to drive a device by sight:

{% tabs %}
{% tab title="Python" %}

```python
png = sb.screenshot()                 # raw PNG/JPEG bytes
# …decide where to tap from the image…
sb.tap(x, y)
```

{% endtab %}

{% tab title="TypeScript" %}

```ts
const png = await sb.screenshot();    // Uint8Array
await sb.tap(x, y);
```

{% endtab %}
{% endtabs %}

The device receives key names as-is. Common ones are `home`, `back`, `recents`, `power`, `volup`, `voldown`, and `enter`. An unknown parameter or a bad action returns a `400` error, which the SDK raises as `BadRequest`.

`launch_intent` is Android only. It starts one named activity component. The activity must be exported, because the launch runs as the shell user and the device refuses a component that is not exported. Pass a relative class (`.MainActivity`) or a full class name, plus an optional intent `action`, a `data` URI and string `extras`.

> The same input surface is available from the [CLI](https://github.com/TheFlash2k/orchard/tree/main/docs/cli/commands/input.md) (`orchard input …`) and the [MCP server](https://github.com/TheFlash2k/orchard/tree/main/docs/mcp/README.md), so an LLM agent can see a screenshot and tap.


---

# 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/guides/input.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.
