# Python IDE for Android Automation: Studio Tour

> Tour the Python IDE inside Macro Automation Studio: run an Android macro on an emulator or cloud device, read the console, and debug with breakpoints.

Source: https://automationmacro.com/docs/studio (Studio, updated 2026-09-04)

Macro Automation Studio (MAS) is a desktop app with a sidebar of pages and a Code Editor, a Python IDE for Android automation. This page walks through both, then covers running a script, reading logs, the debugger, the Claude Code terminal and the file rules.

## The sidebar

The sidebar has three groups. Build pages create macros, Run pages execute them, Account pages manage your account.

| Page | What it is for |
|---|---|
| **Macros** | Your projects. Create a project, open it in the Code Editor, delete it. |
| **Marketplace** | Free bots to download, and the place to publish your own. See [Marketplace](/docs/marketplace). |
| **Agent** | Describe a task and get a macro. See [MAS Agent](/docs/agent). |
| **Device Groups** | Local emulators and cloud devices grouped for runs. Start and stop macros here. See [Device groups](/docs/device-groups). |
| **Cloud Devices** | Create, start, stop and watch cloud devices. See [Cloud devices](/docs/cloud-devices). |
| **Scheduler** | Timed runs on local devices. See [Scheduler](/docs/scheduler). |
| **Port Usage** | Which device ports are reserved right now, and by what. |
| **Proxies** | One proxy per device. See [Proxies](/docs/proxies). |
| **Runs** | Every run on your account with status, device, start, end and duration. |
| **API Keys** | Keys for the REST API and the MCP server. See [API keys](/docs/api-keys). |
| **Integrations (MCP)** | Connect Claude Code, Cursor or another MCP client. See [MCP](/docs/mcp). |
| **Webhooks** | Endpoints that receive run events. See [Webhooks](/docs/webhooks). |
| **Subscription** | Plan, devices, credits and payment. See [Billing](/docs/billing). |
| **Help** | The in-app help center. |

New to Python? [MAS Agent](/agent) writes the macro for you from a plain description, and the result is a normal project you open in the Code Editor.

## Open the Code Editor: a Python IDE for Android automation

1. Open **Macros** and click a code project. New projects are created with **Create New Project**, as shown in [Getting started](/docs/getting-started).
2. The editor opens on `src/app.py`.

The layout: a toolbar across the top, the **Explorer** on the left with **Code Files** and **Assets**, editor tabs in the middle, the **Console** below, and the **Git** view and **Debugger** panel on demand.

The editor is Monaco with a Python language server (basedpyright) running against MAS's own Python environment. You get completion and hover text for the `mas` package, diagnostics as you type, and Go to Definition, which opens the SDK source for reading. The language server starts once the Python environment is ready.

Toolbar essentials: **Save** (<kbd>Ctrl</kbd>+<kbd>S</kbd>), **Open in editor** for an external editor installed on your computer, **Show in File Explorer**, and **Publish** to send the project to the Marketplace.

## Run a script

1. Pick a device from the device list. **Local emulators** are listed by port; **Cloud devices** by name. A stopped cloud device starts when you click Run.
2. Click **Run** (<kbd>F5</kbd>). If the project has an argument form or argparse arguments, the "Run" dialog opens with the fields. Fill them in and click **Run Script**.
3. Follow the Console. Click **Stop** (<kbd>Shift</kbd>+<kbd>F5</kbd>) to end the run.

On a local device MAS launches the script from its own Python environment as `python -u -m src.app`, with the project root as the working directory and on `PYTHONPATH`. Arguments from the dialog are appended. The script finds MAS through environment variables:

| Variable | Value |
|---|---|
| `MAS_RPC_PORT` | The port of the RPC server MAS opened for this run |
| `MAS_RPC_HOST` | `localhost` |
| `MAS_DEVICE_ID` | The target device |
| `MAS_SESSION_TOKEN` | A token for this run |

`import mas` reads these, which is why a script started from a plain terminal reports "Could not discover RPC port".

On a cloud device the run happens server-side. MAS first uploads a snapshot of your working tree, then the Console shows "Syncing code" lines and the run's output. The **Device** button opens a live view of the cloud device next to the code. Details are on [Git projects and code sync](/docs/git-and-code-sync).

## Read the logs

The Console has a filter: **All**, **Output** (stdout, including `print`), **Errors** (stderr), **System** (messages from MAS about the run) and **Engine** (the device layer). **Clear console** empties it. `mas.log("text", level="warning")` writes a leveled line. Lines longer than 64 KB are split rather than dropped.

The Console is per session. For history, open **Runs**: it keeps every run on your account with the macro, the device, timestamps, duration and the exit IP when a proxy was used. Scheduled runs also save their output to a file; see [Scheduler](/docs/scheduler).

## Debug a Python macro

The debugger runs on local emulators. It is not offered for cloud devices.

1. Click in the gutter next to a line, or press <kbd>F9</kbd>, to set a breakpoint.
2. Pick a local emulator and click **Debug**.
3. The script pauses at the breakpoint. Use the controls to step, then **Continue**.

Each breakpoint has three optional fields in the **Breakpoints** list:

| Field | What it does |
|---|---|
| **When** | A Python expression. The breakpoint pauses only when it is true. |
| **Hits** | A hit count: `5`, `== 5`, `>= 10` or `% 5`. |
| **Log** | Turns the breakpoint into a logpoint: it prints the message to the Console and does not pause. Use `{expression}` placeholders. |

| Control | Key |
|---|---|
| Continue, Pause | <kbd>Pause</kbd> pauses a running script |
| Step over | <kbd>F10</kbd> |
| Step into | <kbd>F11</kbd> (steps into `mas` calls as well) |
| Step out | <kbd>Shift</kbd>+<kbd>F11</kbd> |
| Run to cursor | <kbd>Ctrl</kbd>+<kbd>F10</kbd> |
| Rerun | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F5</kbd> |
| Stop debugger | Toolbar button |

While paused, the panel shows the **Call Stack**, a **Watch** list (**Add watch**), the **Variables** of the selected frame, and an **Evaluate expression** box. A variable's value can be copied or replaced with **Set value**. Two toggles change when the session pauses: **Pause on entry** and **Pause on uncaught exceptions**.

Variable inspection has limits: 200 variables per scope, 50 children per expanded value, two levels of nesting, and values cut at 500 characters. Names that start with an underscore are hidden.

## The Claude Code terminal in the editor

The **Claude** button opens a terminal that runs Claude Code inside the project folder. MAS does not ship Claude Code; it looks for your own `claude` command on the PATH, in the usual install folders and in your login shell. If it is missing, the panel says "Claude Code was not found" with a link to the installer.

- **New** starts a fresh session, **Continue** resumes the latest one, and the project history lists earlier sessions to resume or rename.
- The terminal has MAS's Python environment on its PATH, and pasting an image attaches it to the conversation.
- MAS places three skills in `.claude/skills/` inside the project: `writing-macro-script`, `generating-args-form` and `generating-runtime-dashboard`. They teach Claude the `mas` SDK, argument forms and runtime dashboards, and they stay out of git through `.git/info/exclude`.
- Marketplace scripts are read-only, so the terminal is disabled for them.

## Asset Lab and UI Builder

Two helper apps open from the editor.

- In the **Assets** panel, **Open Asset Helper** launches [Asset Lab](/docs/asset-lab). The same panel lists your Image Library: search by name or ID, **Upload** images, create folders, and **Copy ID** for use in `mas.images`.
- **Add Args UI** and **Add Runtime UI** launch [UI Builder](/docs/ui-builder) with a new argument form or runtime dashboard. Once a project has one, the buttons read **Edit Args UI** and **Edit Runtime UI**.

## Files, folders and limits

Projects live under `C:\ProgramData\MacroAutomationStudio\projects` on Windows and `~/Library/Application Support/MacroAutomationStudio/projects` on a Mac, one folder per project named `<id>_<name>`. Each project is a git repository; see [Git projects and code sync](/docs/git-and-code-sync).

Scripts run in a Python 3.13 environment that MAS creates with `uv`, separate from any Python on your computer, with the `mas` package installed. The same environment powers the language server and the Claude terminal.

The editor writes only inside the project folder and enforces these rules:

| Rule | Limit |
|---|---|
| File size | 5 MB per file |
| Extensions | `.py`, `.json`, `.txt`, `.md`, `.yaml`, `.yml`, `.toml`, `.ini`, `.cfg`, `.conf`, `.csv`, `.xml` |
| File names | Up to 255 characters, no trailing dot or space, no Windows device names such as `CON` or `COM1` |
| Paths | Relative, up to 1024 characters, no `..` |

Images are not project files. They go to the Image Library (10 MB each; jpg, jpeg, png, gif or webp) and are referenced by ID.

> [!TIP]
> You can edit the project folder with any editor. MAS watches the folder and reloads changed files.
