Cua Docs

Build a report in a native app

Generate a financial report in Numbers on macOS by driving the native app with Cua Driver.

Numbers is a macOS-only app with no clean automation API for building a spreadsheet, charting it, and exporting a polished PDF. With Cua Driver, the agent drives the real Numbers app on a real Mac, the same way a person would, through the GUI.

This recipe is macOS-only. Numbers, Keynote, and Pages do not exist on Linux or Windows, so use a real Mac or a local macOS VM.

Before you start: install Cua Driver, grant macOS permissions, and connect your agent. For long-running jobs, configure Keep Cua Driver running.

Check Numbers.app#

On your Mac, make sure Numbers.app is installed:

open -a Numbers

Numbers ships with macOS. If you removed it, install it again from the App Store before continuing.

Ask the agent to build the report#

Give the agent the task in plain language:

Using cua-driver, fetch the last 30 days of AAPL daily closing prices. Open Numbers, create a new spreadsheet, enter Date and Close columns, add a 2D line chart, then export the document as a PDF to ~/reports/aapl-analysis.pdf.

The agent drives Numbers with launch_app, list_windows, click, type_text, set_value, and get_window_state.

Cua Driver does not include HTTP or filesystem tools. To fetch prices, the agent can drive Terminal and run curl, or drive a browser and copy the data from the page. For example:

curl "https://query1.finance.yahoo.com/v8/finance/chart/AAPL?interval=1d&range=1mo"

This Yahoo Finance endpoint is unofficial and may require a User-Agent header. If your data source needs authentication or a different format, have the agent use Terminal or the browser to retrieve it, then paste or enter the rows into Numbers.

AppleScript can help with small app commands if the agent runs it through Terminal, but the main workflow is still the agent driving the Numbers GUI through Cua Driver.

Confirm the PDF#

Confirm the exported report exists:

ls -lh ~/reports/aapl-analysis.pdf

Open it to verify the chart and table landed in the PDF:

open ~/reports/aapl-analysis.pdf

Scale this out#

One Mac builds one Numbers report at a time. To generate several reports concurrently, run the workflow in local macOS sandboxes backed by Lume and limit concurrency to the CPU and memory available on the host.

Use Run sandboxes in parallel to run the jobs concurrently, Choose and build a sandbox image to prepare Numbers and any helper tools, and Local macOS sandboxes with Lume for the VM foundation.

Numbers cannot run in Linux containers, so each concurrent worker needs its own local macOS VM.