Spaces tools
Create, run, stream and serve from a Space: the Spaces tools with their parameters, results and errors.
Space lifecycle#
Register, provision, list and release Spaces.
| Tool | Description |
|---|---|
add_space | Add an existing computer as a Space by address and token. |
remove_space | Forget a registered Space without touching it. |
list_spaces | List the Spaces this connection can see. |
create_space | Create a Space: a new sandbox on this computer, on one of your computers, or in the cloud. |
network_show | Show a Space's network: preset, what it opens, where it is enforced, what is always blocked. |
network_log | List what a Space tried to reach and its network blocked. |
network_set | Tighten a Space's network: internet, none or custom lists. Opening more is the user's to do. |
delete_space | Delete a Space's sandbox and forget it. |
stop_space | Turn a Space off: stop it (disk kept, memory freed) or, with suspend, suspend it (memory kept). |
resize_space | Change a Space's vCPUs, memory or disk size. |
start_space | Turn a Space back on: resume or boot it. |
add_space#
Add an existing computer as a Space by address and token.
Tries a GetCapabilities handshake with the Space's cua-spacesd first. A local:<name> or cloud:<name> id without one is still a Space, with an empty capability set (its declared services, tunnels and public URLs work); a direct URL without one is added as an MCP Space when it answers MCP initialize (service mcp), and refused with spacesd_not_available when it answers neither. The Space is stored in ~/.cua/spaces.json and its token in ~/.cua/spaces-credentials.json (0600). Re-adding the same address updates it.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:add_space; mutating, idempotent |
| Swift SDK | SpacesConnection.addSpace(url:token:) |
| Rust | Spaces::add |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | none | Display name. Default: the guest's hostname. |
service | string | mcp | For an MCP endpoint URL: the service name to register it under. Default mcp. |
token | string | none | The spacesd token (or the bearer an MCP endpoint needs). Stored in a separate 0600 credentials file, never in spaces.json. |
url | string | required | The Space's cua-spacesd: http(s)://host:port (port defaults to 3211), host:port, or a Space id (cloud:<name>, local:<name>). Any other MCP endpoint (for example http://host:8765/mcp) is added as a Space with one MCP service and no spacesd capabilities. |
Result#
JSON: the registered Space (id, name, provider, spacesd_version, features, os, services, added_at) and phase: "ready".
Errors#
invalid_argument, unauthenticated
remove_space#
Forget a registered Space without touching it.
Only the registration and its stored token are removed. The sandbox keeps running, including a Space in your cloud (its cloud resources and relay computer stay); delete_space deletes a Space that create_space made.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:remove_space; mutating, idempotent |
| Swift SDK | SpacesConnection.removeSpace(_:) |
| Rust | Spaces::remove |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
JSON: {"removed": <Space>}, the registration that was removed.
Errors#
invalid_argument, not_found, ambiguous_sandbox
list_spaces#
List the Spaces this connection can see.
Every registered Space (cloud, local, direct and relay) with its id (local:<name>, cloud:<name>, direct:<host:port>, relay:<computer-id>), provider, spacesd version (empty without one) and supported features as of the last handshake. The signed-in account's computers on the relay are listed too: those are the names create_space accepts as on="host:<computer>". A Space a computer provides carries host (that computer's id) and host_name; group them under it when you show them. A Space in your cloud carries cloud (the provider: aws, gcp, modal), cloud_place (account and region, to show with it) and cloud_delete (where delete_space can delete it: here, host:<computer>, or elsewhere). A durable Space (create_space durable=true) carries durable (its name, by which it is found wherever it runs now).
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:list_spaces, in spaces:readonly; read-only, idempotent |
| Swift SDK | SpacesConnection.spaces() |
| Rust | Spaces::list |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
labels | map of string | none | Only the Spaces that carry every one of these labels (set by create_space). |
Result#
JSON: an array of Spaces (id, name, provider, spacesd_version, features, os, services, added_at, for a Space one of your computers provides host and host_name, for a Space that can be turned off and on power (suspend or stop) and power_state, and for a Space in your cloud cloud, cloud_place and cloud_delete, and for a relay computer the relay cannot reach now status (offline or not sharing)), parent (a Space one of your computers provides: that computer's Space id, relay:<computer>; null for a computer or any other Space) and default (true for the Space the account chose as its default, false for every other; false for all when signed out or the relay does not answer), each with phase: ready, or offline for a relay computer the relay cannot reach now (a computer that is off or stopped sharing, or a Space that is gone and left its record; relay_unregister_space removes it).
Errors#
invalid_argument, relay, unauthenticated
create_space#
Create a Space: a new sandbox on this computer, on one of your computers, or in the cloud.
Creates a new sandbox where on says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries cloud and cloud_place, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:<name>. Cua Cloud (on="cloud") has ended and fails with an error that says so. kind (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and runtime (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on="auto" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on="host:<computer>" creates the Space on a computer set up with cua host setup --share both (for example "spin up 2 macOS Spaces on my spare Mac mini" is on="host:spare mac mini", image="macos", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on="host:<id>"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:<computer> with host set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on="direct:<addr>" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on="auto") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with durable, and delete_space deletes it for good.
| Providers | cloud only (cloud:<name>), local only (local:<name>), relay only (relay:<computer-id>) |
| Platforms | all (macos, windows, linux) |
| Metering | cloud |
| Approval | permission spaces:create_space; destructive |
| Swift SDK | Spaces.create(options) |
| Rust | Spaces::create |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
allow | string[] | none | Destinations to allow (addresses or CIDRs) on top of network. |
command | string[] | none | Entrypoint override (argv), for example ["python", "-m", "my_mcp", "--port", "8765"]. |
count | integer | none | How many Spaces to create, 1 to 8 (default 1), all with the same settings (a name gets -2, -3, ... suffixes). With more than one the result is an array. At least 0. |
deny | string[] | none | Destinations to block (addresses, CIDRs or all). |
durable | boolean | false | Keep it on the user's machines (with on auto): when its machine goes away it is created again on another one, with the same name (its disk starts fresh); list_spaces shows it with durable (its name), and delete_space deletes it for good. Default false. |
env | map of string | none | Guest environment variables. |
image | string | none | Guest image. Default: the canonical Linux image (ghcr.io/trycua/linux:24.04), whose variant follows the kind. |
instance_type | string | none | With on a linked cloud (aws, hetzner, ...): the machine type its host must be (c7g.xlarge, cax41). Default: the elastic pool picks the cheapest that fits (cloud_plan shows it). |
kind | "auto" | "container" | "vm" | "microvm" | auto | What kind of computer. Default auto (from the image). auto: From the image: macOS and Windows images are VMs, an image with a container rootfs is a container, a disk-only image is a VM. container: A container (gVisor, or runc locally). vm: A virtual machine (QEMU or Lume locally, KubeVirt in the cloud). microvm: A microVM: the image's container rootfs booted with its own kernel (Firecracker on Linux with KVM; on a Mac, Virtualization.framework or Apple's Containerization). |
labels | map of string | none | Labels kept with the Space and shown by list_spaces (labels): up to 64 pairs; keys and values are not empty; keys up to 63 bytes, values up to 256. Not with durable or reuse. |
name | string | none | Name. Default: a generated friendly name such as brave-otter. |
network | string | none | Its network: internet (default: the internet and its own tree; this computer, the local network, cloud metadata and other trees are blocked), none, or custom / custom:none with allow and deny. Presets that open more (localhost:<ports>, lan, unprotected) are the user's to choose: refused here. |
on | string | none | Where it runs: local (this computer, free), auto (the least-loaded of the user's computers that can take it: this one and the ones signed in to the user's account that provide Spaces, Modal only when connected and no computer has room), aws, gcp or modal (your own cloud account, billed there), or host:<computer>: one of the user's own computers that provides Spaces (cua host setup --share both on it), named by id or by words from its name ("host:spare mac mini" matches "Mac mini (spare)" or dillons-mac-mini). Default: the user's default location (cua config set default.on, CUA_DEFAULT_ON), else local; never auto unless asked. Not direct:<addr>: that is one already-running Space at a fixed address, attached with add_space, not a host this can create on. An existing computer is added with add_space, not created. |
parent | string | none | Create it as a child of this Space (id or name): it joins the parent's tree, and its network is no more open than the parent's. |
region | string | none | With on a linked cloud: the region (Hetzner location) its host must be in. Default: any the cloud offers. |
reuse | boolean | false | Return a reachable registered Space in the same location that has the requested services instead of creating one (get-or-create). Default false. |
runtime | string | auto | Which engine. Default auto: the safest one for the location and kind. Local: gvisor or runc (containers), qemu or lume (VMs). Cloud: gvisor (containers), kubevirt (VMs). Anything else fails with invalid_placement, listing the valid values. |
services | map of integer | none | Named services (name to guest port), for example {"mcp": 8765}. Each is probed for readiness and reachable with list_tools / call_tool (service=<name>). |
spacesd | boolean | true | Whether the image runs cua-spacesd. Default: true for the canonical images (and no image) and, on this machine's containers and microVMs, for any other image (a static cua-spacesd is put into it); false elsewhere. false runs the image as it is. A Space without it has an empty capability set: only its services work. |
timeout | integer | 600 | Seconds to wait for readiness (local). Default 600. At least 0. |
wait | boolean | true | Wait until the Space is ready (its spacesd, or its declared services). Default true. |
Result#
JSON: the registered Space, phase: "ready" and reused (true when reuse returned an existing Space); with wait: false, {"id", "phase": "starting"} at once; with count above 1, an array of them.
Errors#
invalid_argument, invalid_placement, sandbox, timeout, ambiguous_host, limit_exceeded
Notes#
- Local needs a container engine, QEMU or Lume (
cua runtime doctor).
network_show#
Show a Space's network: preset, what it opens, where it is enforced, what is always blocked.
Shows a Space's network: its preset (internet by default: the internet and its own tree, with this computer, the local network, cloud metadata and other trees blocked), what it opens beyond that, where the rules are enforced (outside the guest), or why it has no network (a runtime that can't protect it yet starts it without network), and what is always blocked. When a connection fails, check here before retrying: a blocked destination stays blocked.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:network_show, in spaces:readonly; read-only, idempotent |
| Swift SDK | Spaces.network(space) |
| Rust | Spaces::network_info |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
JSON: settings (preset, lists), summary, widenings (what it opens beyond internet), enforcement (enforced, no_network, open, refused), point, note, parent, root, always_blocked, notice_pending.
Errors#
invalid_argument, not_found, ambiguous_sandbox
network_log#
List what a Space tried to reach and its network blocked.
Lists what a Space on this computer tried to reach and its network blocked. When a connection from a Space fails or hangs, call this: if the destination is here, it is blocked on purpose (this computer, the local network, cloud metadata or another tree), and retrying won't help. Tell the user what was blocked in plain words; changing it is theirs to do.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:network_log, in spaces:readonly; read-only, idempotent |
| Swift SDK | Spaces.network_log(space) |
| Rust | Spaces::network_events |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
JSON array, most recent first: reason (platform:metadata, default:host-loopback, default:lan, user:deny, default:none, ...), dst, proto, count, last_unix.
Errors#
invalid_argument, not_found, ambiguous_sandbox, wrong_provider, sandbox
network_set#
Tighten a Space's network: internet, none or custom lists. Opening more is the user's to do.
Changes a Space's network to internet, none, or custom (from internet) / custom:none with allow and deny (addresses or CIDRs). It can only tighten: anything that opens more than the Space has now (this computer's localhost, the local network, No protection, an allow beyond its preset) is refused; the user does that with cua network set or the app. A child stays within its parent's. tree=true gives its children the same settings. Applies at once where the runtime can, else at the Space's next start (applied).
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:network_set; mutating, idempotent |
| Swift SDK | Spaces.set_network(space, settings, widen, tree) |
| Rust | Spaces::set_network |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
allow | string[] | none | Destinations to allow (addresses or CIDRs). |
deny | string[] | none | Destinations to block (addresses, CIDRs or all). |
network | string | required | internet, none, or custom / custom:none with allow and deny. Opening more than the Space has now is the user's to do (cua network set, or the app): refused here. |
space | string | required | Space id or name. |
tree | boolean | none | Its child Spaces take the same settings (each within its parent's). |
via | string | none | Where its internet traffic leaves: internet (its own network) or space:<name> (a Space of its tree). This computer and a SOCKS5 proxy are the user's to choose (cua network set --via). Unset: the exit it has. A child keeps its parent's. |
Result#
JSON: applied (now or next_start) and network (as network_show).
Errors#
invalid_argument, not_found, ambiguous_sandbox, wrong_provider, sandbox
delete_space#
Delete a Space's sandbox and forget it.
Deletes the sandbox of a Space that create_space made (cloud: metering stops; local: the instance is deleted; on one of your computers, on="host:...": that computer deletes it and it leaves the relay) and forgets it. A Space in your cloud (list_spaces: cloud, cloud_place, cloud_delete) is deleted permanently through the records of the device that created it: cloud_delete "here" deletes it from this device; "host:<computer>" asks that host (it must be online, and only its owner may); "elsewhere" is refused with where it was created: delete it there, or remove_space. Another Space added by address (direct:, relay:) is only forgotten: cua did not create it. Any hotspot on the Space is stopped first. To forget a Space without deleting anything, use remove_space.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:delete_space; destructive |
| Swift SDK | Spaces.delete(space) |
| Rust | Spaces::delete |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
Text: what was deleted (Deleted <id> (...)), or Removed <id> (...) for a Space added by address.
Errors#
invalid_argument, not_found, ambiguous_sandbox, sandbox
stop_space#
Turn a Space off: stop it (disk kept, memory freed) or, with suspend, suspend it (memory kept).
Turns a Space off the way its provider can. By default it stops: a local VM (QEMU or Lume) shuts down with its disk kept and gives its memory back to the machine, a local container stops or is suspended as its runtime can, a Space one of your computers provides is stopped by that computer, and a Space in your own cloud (on="aws", "gcp") is stopped there: compute billing stops, its disk stays (storage is still billed); a Hetzner server (on="hetzner") is stopped too, but Hetzner keeps billing a stopped server, so delete it to stop the charge. suspend=true suspends a local container or QEMU VM instead: its memory is kept (so it still uses it) and it resumes where it was. Anything streaming from the Space and any hotspot on it end first. A Modal sandbox, a Space added by address and your own computers on the relay cannot be turned off (wrong_provider); delete_space deletes a Space instead. start_space turns it on again.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:stop_space; mutating, idempotent |
| Swift SDK | Spaces.stop(space) |
| Rust | Spaces::stop |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
suspend | boolean | false | Suspend it instead: keep its memory so it resumes where it was (a local container or QEMU VM). Default false: stop it, keeping its disk and giving its memory back to the machine. |
Result#
JSON: space, state (suspended or stopped), power (suspend or stop) and message.
Errors#
invalid_argument, not_found, ambiguous_sandbox, wrong_provider, sandbox, relay, permission_denied, cloud
Notes#
- list_spaces says which Spaces turn off (
power:suspendorstop; absent when it cannot) and how they were left (power_state).
resize_space#
Change a Space's vCPUs, memory or disk size.
Gives a local VM Space (QEMU) another shape: cpus vCPUs, memory_mb MiB of memory, a disk grown to disk_gb GiB; what you leave out stays. The VM shuts down and boots again from its own disk, so its files stay but its memory and running processes do not; a stopped one boots. A disk never shrinks. Returns once it is ready again. Containers, Lume VMs and Spaces on other computers are refused (wrong_provider).
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:resize_space; mutating, idempotent |
| Swift SDK | Spaces.resize(space, cpus, memory_mb, disk_gb) |
| Rust | Spaces::resize |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
cpus | integer | none | vCPUs. At least 0. |
disk_gb | integer | none | Grow the disk to this many GiB (a disk never shrinks). At least 0. |
memory_mb | integer | none | Memory in MiB. At least 0. |
space | string | required | Space id or name. |
Result#
JSON: space, cpus, memory_mb, disk_gb (what it has now) and message.
Errors#
invalid_argument, not_found, ambiguous_sandbox, wrong_provider, sandbox, timeout
start_space#
Turn a Space back on: resume or boot it.
Turns a Space stop_space turned off on again: resumes a suspended one, boots a stopped one (a Space one of your computers provides, or one in your cloud, joins the relay again), and leaves a running one as it is. Returns once it answers again (bounded). The same Spaces turn on as turn off.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:start_space; mutating, idempotent |
| Swift SDK | Spaces.start(space) |
| Rust | Spaces::start |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
JSON: space, state (running), power (suspend or stop) and message.
Errors#
invalid_argument, not_found, ambiguous_sandbox, wrong_provider, sandbox, relay, permission_denied, cloud, timeout
Commands and files#
Run shell commands and move files in and out of a Space.
| Tool | Description |
|---|---|
space_bash | Run a shell command inside the Space. |
space_job | Run a long command in the Space as a background job: tail its log, cancel it, or get woken when it ends. |
space_write | Write literal text to a path inside the Space. |
upload | Send a local file or folder into the Space. |
send_file | Send a host file or folder into the Space's Downloads, verified by sha256 on arrival. |
download | Fetch a file or folder out of the Space. |
space_bash#
Run a shell command inside the Space.
Runs through the spacesd's ProcessService with /bin/sh -c. Output is stdout, then [stderr] and stderr, then [exit N]; each stream keeps its last 16000 characters when longer.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:space_bash; destructive |
| Swift SDK | Space.bash(_:) |
| Rust | Space::bash |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
command | string | required | Command line, run with /bin/sh -c (cmd.exe /C on Windows guests). |
space | string | required | Space id or name. |
timeout | integer | 60 | Seconds before the command is killed. Default 60. At least 0. |
Result#
Text: stdout, then [stderr] and stderr, then [exit N].
Errors#
invalid_argument, not_found, ambiguous_sandbox, timeout
space_job#
Run a long command in the Space as a background job: tail its log, cancel it, or get woken when it ends.
Use this instead of space_bash for anything that takes more than a minute (builds, test suites, installs, waiting on CI). start returns a job id at once and the command keeps running when you stop, disconnect, or the Space's daemon restarts. Read it with logs (pass the returned next_offset as offset to read on; follow_ms waits for output) or status; stop it with cancel; list shows the Space's jobs. Pass notify: true to be woken: the Space's thread gets one message JOB <id> <state> exit=<n> ... with the end of the log, and as an agent member you receive it as your next turn, so you can end your turn instead of polling. until makes a job that waits for a file, a port, a command or a pull request's required checks; its end is the condition. Output is stdout and stderr together. Linux and macOS guests.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:space_job; destructive |
| Swift SDK | Space.job(_:) |
| Rust | Space::job |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
action | string | required | start (begin a job), status (state and the end of its log), logs (read the log from a byte offset), cancel (stop it) or list (this Space's jobs, newest first). |
command | string | none | start: the command line, run with /bin/sh -c in the background. It keeps running when you or your connection go away. Give this or until. |
cwd | string | none | start: the directory to run in. Default: the Space user's home. |
env | map of string | none | start: environment variables for the command. |
follow_ms | integer | 0 | logs: when there is nothing new after offset and the job is running, wait up to this many milliseconds (at most 25000) for output or for the job to end. Default 0. At least 0. |
job | string | none | status, logs, cancel: the job id start returned. |
limit | integer | none | logs: most bytes to return (default 16000, at most 262144). At least 0. |
name | string | none | start: a short label for the job ("unit tests"), shown in listings and in the message that wakes you. |
notify | boolean | false | start: wake me when the job ends. The Space's thread gets one message with the job's result and the end of its log, addressed to you when you are an agent member of the Space (so you can finish your turn and sleep), and the person gets a notification. Default false. |
offset | integer | none | logs: the byte offset to read from (the next_offset of the previous call). Without it: the last limit bytes. At least 0. |
space | string | required | Space id or name. |
timeout | integer | none | start: seconds before the job is stopped. Default: none. At least 0. |
until | object | none | start: wait for a condition instead of running command. The job ends when the condition holds (exit 0), or after timeout. |
until.command | string | none | Wait for this shell command to exit 0. |
until.file | string | none | Wait for this path to exist in the Space. |
until.host | string | 127.0 | With port: the host. Default 127.0.0.1. |
until.interval | integer | 5 | Seconds between checks (1 to 300). Default 5 (30 for pr_checks). At least 0. |
until.port | integer | none | Wait for this TCP port to accept connections (on host, default 127.0.0.1). 0 to 65535. |
until.pr_checks | string | none | Wait for a GitHub pull request's required checks to finish with gh (signed in inside the Space): a number, a URL or owner/repo#123. The job exits 0 when they pass and 1 when one fails. |
wake | string | none | start with notify: the agent member to wake instead of you. |
Result#
JSON. start: job, state, log_command and a hint. status, logs: job, name, state (running, exited, cancelled, timed_out or lost), exit_code, signal, started_at and ended_at (unix seconds), elapsed_s, size (log bytes), and for logs offset, next_offset, text and more. cancel: the final status. list: jobs.
Errors#
invalid_argument, not_found, ambiguous_sandbox, wrong_provider
Notes#
- A job is a command that outlives the call, the connection and a restart of the Space's daemon; its state is files in the Space (
~/.cua/jobs/<id>). Guests that are not Windows.
space_write#
Write literal text to a path inside the Space.
Written through FilesystemService, verified by sha256; no shell is involved, so nothing needs quoting.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:space_write; destructive |
| Swift SDK | Space.write(_:to:) |
| Rust | Space::write |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
content | string | required | The exact file contents. |
path | string | required | Absolute path in the Space. Parent directories are created. |
space | string | required | Space id or name. |
Result#
Text: wrote <path> (<n> bytes, sha256 <hex> verified in Space).
Errors#
invalid_argument, not_found, ambiguous_sandbox, transfer_failed
Notes#
- Literal text: no local file is read and nothing is shell-quoted, which is the whole reason it exists next to space_bash.
upload#
Send a local file or folder into the Space.
Files stream through FilesystemService in chunks with a sha256 check; a folder is copied file by file (empty directories included, symlinks skipped). No size cap.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:upload; destructive |
| Swift SDK | space.files.send(_:to:within:) |
| Rust | Space::upload |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
dest | string | <guest home>/<name> | Absolute destination path in the Space; an existing file there is replaced. Default: <guest home>/<name>, or <name> (1).ext when that is taken (nothing is replaced). |
path | string | required | Host path (file or folder). |
space | string | required | Space id or name. |
Result#
JSON: source, dest, kind (file or folder), files, directories, bytes, sha256 (single file) and verified.
Errors#
invalid_argument, not_found, ambiguous_sandbox, transfer_failed, io
Notes#
- Without
destnothing in the Space is replaced: a taken<home>/<name>lands as<name> (1).ext. An explicitdestis written as given and replaces a file already there.
send_file#
Send a host file or folder into the Space's Downloads, verified by sha256 on arrival.
The same transfer the Cua Spaces pop-out's Teleport drop zone performs: files land in the Space user's ~/Downloads through the spacesd's TeleportService (chunked, resumable, every file verified by sha256 before it is published). A transfer that does not land, or lands corrupted, is an error and not a reported success.
respect_ignorefiles (default true) applies ONLY when path is a folder. It honors .gitignore and .ignore at the folder root and in every subdirectory (each scoped to its own subtree, so a nested ignore file overrides its parent), plus .dockerignore at the root only. All three use gitignore semantics: negation (!), directory-only patterns (foo/), anchoring, */?/[...], **, comments, last-matching-rule-wins. As in git, an excluded directory is pruned and ! cannot re-include anything beneath it. .git/ is always skipped and symlinks are never followed. For a single named file it has NO effect.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:send_file; destructive |
| Swift SDK | Space.sendFile(_:into:respectingIgnoreFiles:) |
| Rust | Space::send_file |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | required | Host path (file or folder) to send. |
respect_ignorefiles | boolean | true | Honor .gitignore / .ignore (nested) and .dockerignore (root only) when sending a folder. Default true. No effect on a single named file. |
space | string | required | Space id or name. |
target_directory | string | ~/Downloads | Subdirectory of the Space user's ~/Downloads to land in. ~/Downloads and ~/Downloads/<sub> are accepted too. Default: ~/Downloads itself. |
Result#
JSON: source, destination, dest, kind, files (each path, size, sha256), bytes, respect_ignorefiles, skipped_by_ignorefiles, skipped_count, skipped_by_guest and verified.
Errors#
invalid_argument, not_found, ambiguous_sandbox, transfer_failed, io
Notes#
- Unlike
upload, the copy is verified in the Space by sha256 before the call returns: a transfer that does not land, or lands corrupted, is an error and not a reported success. respect_ignorefilesapplies only when the path is a folder, with gitignore semantics; a file named explicitly is always sent.- A file of the same name already in the Space is kept: the new copy lands as
name (1).extand its path is infiles.
download#
Fetch a file or folder out of the Space.
Files stream through FilesystemService and are verified by sha256; a folder is copied recursively.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:download, in spaces:readonly; read-only, idempotent |
| Swift SDK | Space.download(_:into:) |
| Rust | Space::download |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
dest | string | ~/Downloads/cua-spaces | Host destination directory. Default ~/Downloads/cua-spaces. |
path | string | required | Absolute path in the Space (file or folder). |
space | string | required | Space id or name. |
Result#
JSON: source, dest, kind, files, bytes, sha256 (single file) and verified.
Errors#
invalid_argument, not_found, ambiguous_sandbox, transfer_failed, io
Notes#
- Nothing on the host is overwritten: when
destalready has an entry of that name the copy lands asname (1).ext(orname (1)for a folder), anddestin the result is the path used.
Streams and display#
Stream a Space's desktop or windows, and show a Space to the operator.
| Tool | Description |
|---|---|
stream_endpoint | Return a ticketed media endpoint for the Space's desktop or one window. |
list_space_windows | List the windows open inside the Space. |
stream_space_window | Draw one Space window on the operator's desktop. |
show_space_pip | Pin the Space as picture-in-picture on the operator's desktop. |
hide_space_pip | Unpin the picture-in-picture window. |
open_space_viewer | Open the full Space viewer on the operator's desktop. |
stream_endpoint#
Return a ticketed media endpoint for the Space's desktop or one window.
Opens a media session (StreamService.OpenMedia) for the desktop or one window and returns its ticketed WebSocket URL (rcdp wire v2, see libs/cua/proto/MEDIA.md). The ticket is short-lived, bound to that one session, and safe to put in a URL; it is not the Space's token. Works for every provider because the token comes from the SDK, not from the guest.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:stream_endpoint; mutating, idempotent |
| Requires (spacesd) | desktop_stream |
| Swift SDK | Space.streamEndpoint(forceRefresh:) |
| Rust | Streams::open |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
app_name | string | none | Stream the largest visible window of this app (case-insensitive substring). Ignored when window_id is set. |
display | string | none | Display id for a desktop stream. Default: the primary display. |
max_fps | integer | 30 | Maximum frames per second. Default 30. At least 0. |
space | string | required | Space id or name. |
ticket_ttl | integer | 60 | Ticket lifetime in seconds (at most 600). Default 60. At least 0. |
window_id | string | none | Window handle from list_space_windows. Streams that window. |
Result#
JSON: space, media_session_id, ws_url (ticket included), ticket, ticket_expires_at, codec (h264, bgra or png), wire_version, frame_size and needs_gateway_headers.
Errors#
invalid_argument, not_found, ambiguous_sandbox, spacesd_not_available, capability_missing, stream
Notes#
- Giving the caller frames is a different act from presenting the Space to an operator.
- Replaces local_rcdp, which only worked for Local macOS Spaces and read its token over ssh.
list_space_windows#
List the windows open inside the Space.
The windows a viewer can stream now, from StreamService.ListTargets: on screen, sized, normal app windows (no hidden, minimized or system-UI windows), each with its handle, title, app and bounds.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:list_space_windows, in spaces:readonly; read-only, idempotent |
| Requires (spacesd) | windows |
| Swift SDK | Space.windows() |
| Rust | Streams::windows |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
app_name | string | none | Only windows of this app (case-insensitive substring). |
space | string | required | Space id or name. |
Result#
JSON: an array of windows (window_id, epoch, title, app_name, app_id, pid, bounds, on_screen, focused, available, limitation).
Errors#
invalid_argument, not_found, ambiguous_sandbox, spacesd_not_available, capability_missing
stream_space_window#
Draw one Space window on the operator's desktop.
FOR THE HUMAN. Opens a bidirectional window on the operator's desktop showing one Space window (the Cua Spaces app draws it from a media ticket). Pass app_name to auto-pick that app's largest visible window, or an exact window_id.
| Providers | all (cloud, local, direct, relay) |
| Platforms | macos (the operator's computer) |
| Metering | free |
| Approval | permission spaces:stream_space_window; mutating, idempotent |
| Requires (spacesd) | window_stream |
| Requires (this computer) | operator_display |
| Swift SDK | space.operatorDisplay.streamWindowToOperatorDesktop(_:) |
| Rust | OperatorDisplay::stream_window |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
app_name | string | none | Auto-pick this app's largest visible window, e.g. "Firefox". |
space | string | required | Space id or name. |
title | string | none | Label for the operator's window. Default: the window title. |
window_id | string | none | Exact window handle from list_space_windows (overrides app_name). |
Result#
Text: Streaming <window> of <space> to your desktop (bidirectional).
Errors#
invalid_argument, not_found, ambiguous_sandbox, spacesd_not_available, capability_missing, host_capability_missing, stream
Notes#
- Operator-side: the pixels land on the human's computer, so the platform axis is the operator's OS and not the Space's.
show_space_pip#
Pin the Space as picture-in-picture on the operator's desktop.
FOR THE HUMAN, NOT FOR YOU. Pins an always-on-top picture-in-picture overlay of the Space onto the user's own desktop. Call it only when the user asks to see a Space; never to observe your own work.
| Providers | all (cloud, local, direct, relay) |
| Platforms | macos (the operator's computer) |
| Metering | free |
| Approval | permission spaces:show_space_pip; mutating, idempotent |
| Requires (spacesd) | desktop_stream |
| Requires (this computer) | operator_display |
| Swift SDK | space.operatorDisplay.pinPictureInPictureOnOperatorDesktop() |
| Rust | OperatorDisplay::pin_pip |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
Text: Pinned <space> as picture-in-picture on your desktop.
Errors#
invalid_argument, not_found, ambiguous_sandbox, spacesd_not_available, capability_missing, host_capability_missing
hide_space_pip#
Unpin the picture-in-picture window.
| Providers | all (cloud, local, direct, relay) |
| Platforms | macos (the operator's computer) |
| Metering | free |
| Approval | permission spaces:hide_space_pip; mutating, idempotent |
| Requires (this computer) | operator_display |
| Swift SDK | space.operatorDisplay.unpinPictureInPictureFromOperatorDesktop() |
| Rust | OperatorDisplay::unpin_pip |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
Text: Unpinned <space> from your desktop.
Errors#
invalid_argument, not_found, ambiguous_sandbox, host_capability_missing
open_space_viewer#
Open the full Space viewer on the operator's desktop.
FOR THE HUMAN, NOT FOR YOU. Opens a live viewer window on the user's own desktop. Never call it to obtain a screenshot or to check on your own work; use the screenshot tool for that.
| Providers | all (cloud, local, direct, relay) |
| Platforms | macos (the operator's computer) |
| Metering | free |
| Approval | permission spaces:open_space_viewer; mutating, idempotent |
| Requires (spacesd) | desktop_stream |
| Requires (this computer) | operator_display |
| Swift SDK | space.operatorDisplay.openViewerOnOperatorDesktop() |
| Rust | OperatorDisplay::open_viewer |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
space | string | required | Space id or name. |
Result#
Text: Opened the <space> viewer on your desktop.
Errors#
invalid_argument, not_found, ambiguous_sandbox, spacesd_not_available, capability_missing, host_capability_missing
Services#
Discover and call the MCP services inside a Space.
| Tool | Description |
|---|---|
list_tools | List the MCP services and tools reachable inside the Space. |
call_tool | Call a service tool inside the Space. |
space_service | Keep a command running in the Space: restarts, health checks, start on boot, logs. |
list_tools#
List the MCP services and tools reachable inside the Space.
Lists the tools of an MCP service INSIDE the Space. service is any service the Space declares (an MCP server the image runs, reached over streamable HTTP; no spacesd needed) or driver, the spacesd's own cua-driver registry (screenshot, click, type, launch apps, accessibility, ...). The default is driver, or the only declared service of a Space without spacesd. With no name, returns a scannable overview; pass name=<substring> for full input schemas. Then invoke them with call_tool. The reply names every service the Space exposes.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:list_tools, in spaces:readonly; read-only, idempotent |
| Swift SDK | space.services.list() |
| Rust | Services::list_tools |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | none | Substring filter; matching tools come back with full input schemas. |
service | string | driver | Service. A service the Space declares (see list_spaces), reached over generic MCP (streamable HTTP), or driver (the spacesd's cua-driver registry; mcp, cua-driver and computer-server are aliases unless the Space declares a service by that name). Default: driver, or the only declared service of a Space without spacesd. |
space | string | required | Space id or name. |
Result#
JSON: service, count, tools (name and description; with name, also inputSchema), services, contract_version, and a hint when no filter was given.
Errors#
invalid_argument, not_found, ambiguous_sandbox, mcp
call_tool#
Call a service tool inside the Space.
Returns the tool's content parts unchanged, images included. A tool-level failure comes back with isError, not as a transport error.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:call_tool; destructive |
| Swift SDK | space.services.call(_:on:_:) |
| Rust | Services::call_tool |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
arguments | object | {} | Arguments object for the tool. Default {}. |
service | string | driver | Service (see list_tools). Default: driver, or the only declared service of a Space without spacesd. |
space | string | required | Space id or name. |
tool | string | required | Tool name from list_tools. |
Result#
The called tool's own result, unchanged: its content parts (images included), structuredContent and isError.
Errors#
invalid_argument, not_found, ambiguous_sandbox, mcp
Notes#
- Open world twice over: the callee is a tool the SDK has never seen.
space_service#
Keep a command running in the Space: restarts, health checks, start on boot, logs.
Keeps a command running in the Space: cua-spacesd starts it at once, starts it again by its restart policy when it ends (waiting longer after each quick failure, up to a minute), restarts it when its health check (http, tcp or check, one of them) fails 3 times in a row, starts it when the Space boots unless start_on_boot is false, and keeps its output in a log file in the Space (logs). stop keeps it stopped, across a reboot too, until start. add with a name that exists replaces it.
| Providers | all (cloud, local, direct, relay) |
| Platforms | all (macos, windows, linux) |
| Metering | free |
| Approval | permission spaces:space_service; destructive |
| Swift SDK | space.keepRunning.service(_:) |
| Rust | Space::keep_service |
Parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
action | string | required | add (or replace), list, start, stop, restart, remove or logs. |
check | string | none | add: health check, a shell command that exits 0 when healthy. |
command | string | none | add: the shell command line to keep running. |
http | string | none | add: health check, a URL that answers 2xx or 3xx. |
name | string | none | Service name (every action but list): lowercase letters, digits, -, _ and .. |
restart | string | none | add: when to start it again: always (default), on-failure or never. |
space | string | required | Space id or name. |
start_on_boot | boolean | none | add: start it when the Space boots (default true). |
tail_bytes | integer | none | logs: bytes from the end (default 64 KiB). At least 0. |
tcp | string | none | add: health check, host:port that accepts a connection. |
Result#
JSON: add, start, stop and restart give the service (name, command, state, pid, restarts, last_end, probe_error, restart, start_on_boot, log_path); list gives services; logs gives logs (text); remove gives removed.
Errors#
invalid_argument, not_found, ambiguous_sandbox, capability_missing