Skip to content

CLI reference

The mpaka CLI is the recommended way to submit Python from a terminal. It handles request creation, idempotency, polling, result output, and process exit status for you.

Install from the mPaka download page. It provides the current one-line installers, supported platform list, manual downloads, and verification details.

Check the installed version:

Terminal window
mpaka --version

Check for an update without applying it, install the latest release, or select an exact release:

Terminal window
mpaka self-update --check
mpaka self-update
mpaka self-update --version v0.4.1

The CLI connects to https://api.mpaka.dev by default. You do not need to set an endpoint for the mPaka service.

Account commands use a saved account session. They do not create or replace the MPAKA_API_KEY required for workload commands.

Terminal window
mpaka register --email user@example.com
mpaka login --email user@example.com
mpaka whoami
mpaka logout

register and login prompt for the password without echoing it. For non-interactive input, send one password through standard input:

Terminal window
printf '%s\n' "$MPAKA_PASSWORD" | mpaka login \
--email user@example.com \
--password-stdin

Passwords are not accepted as command-line arguments. Registration creates an account and requires a password of at least 12 characters; it does not guarantee admission to a private beta workspace.

The api-keys commands use the saved account session, not MPAKA_API_KEY. Creating, rotating, and deleting keys requires an owner account:

Terminal window
mpaka api-keys create --name development
mpaka api-keys list
mpaka api-keys rotate <KEY_ID>
mpaka api-keys delete <KEY_ID>

list returns key metadata only. create and rotate print the new token once to standard output and do not save it; with --json, the token is still included in the output. Treat this output as secret: avoid shell tracing, CI log capture, and build artifacts, then store it in a secret manager or export it as MPAKA_API_KEY. Rotation invalidates the previous token. Deleting a key revokes it. See API keys for storage and recovery guidance.

First create a key in the web console and set MPAKA_API_KEY. Then submit one file:

Terminal window
mpaka run --file script.py

Or read the source from standard input:

Terminal window
printf 'print(6 * 7)\n' | mpaka run --stdin

--file and --stdin are mutually exclusive. The CLI rejects empty source and source larger than 16 KiB before making the request.

Option Default Purpose
--timeout-ms <MS> 3000 Wall-clock limit requested for the workload.
--memory-mb <MB> 128 Memory limit requested for the workload.
--cpu-profile <PROFILE> API default Named CPU profile supported by the API.
--vcpu-count <N> API default Explicit vCPU count; conflicts with --cpu-profile.
--memory-profile <PROFILE> API default Named memory profile supported by the API.
--environment <ID> none Reuse a ready Python dependency environment.
--idempotency-key <KEY> generated Stable identity for retrying the same submission.
--max-poll-attempts <N> 240 Positive limit on status observations.

When the idempotency key is omitted, the CLI generates a UUID and prints it to standard error before submission. Keep that key when a connection failure makes the outcome ambiguous. Reuse it only with the same source and limits.

The initial response counts as polling attempt one. Further attempts are made at 250 ms intervals. With the default 240-attempt budget, the CLI observes for about one minute. If the budget is exhausted, it exits non-zero and reports the execution ID and last known status; the execution may still continue in the service.

In its default foreground mode, mpaka run prints the execution ID, status, mode, exit code, stdout, and stderr. A foreground run exits with status zero only when:

  • the lifecycle status is completed;
  • the mode is not mock_no_code_execution; and
  • the program exit code is 0.

A failed, timed-out, cancelled, non-executing, non-zero, or incomplete result causes a non-zero CLI exit status.

Use --async to return the accepted execution without polling. Then wait or inspect it separately:

Terminal window
mpaka run --file script.py --async --json
mpaka executions wait <EXECUTION_ID> --wait-timeout-ms 60000 --json
mpaka executions get <EXECUTION_ID>

The wait deadline only limits how long the local command polls; the remote execution continues. If the deadline expires, the CLI reports the last known state and exits non-zero. A zero exit from mpaka run --async means the API accepted the request; it does not mean the Python program succeeded. Likewise, mpaka executions wait exits zero when it successfully retrieves a result, even if that execution failed. Check terminal status, mode, and exit code using the same success rules.

Use resource profiles and Python environments

Section titled “Use resource profiles and Python environments”

Use mpaka limits to discover the bounds and CPU and memory profiles currently supported by the API. The supported values can depend on the service configuration, so read the response before choosing a profile:

Terminal window
mpaka limits
mpaka limits --json
mpaka run --file script.py --cpu-profile high_cpu --memory-profile high_memory
mpaka run --file script.py --vcpu-count 2 --memory-mb 512

A CPU profile cannot be combined with --vcpu-count, and a memory profile cannot be combined with --memory-mb.

Create a reusable environment from a text file containing up to 32 pinned name==version requirements:

requests==2.32.3
Terminal window
mpaka environments create --requirements requirements.txt
mpaka environments wait <ENVIRONMENT_ID> --wait-timeout-ms 60000
mpaka run --file script.py --environment <ENVIRONMENT_ID>

Environment creation is asynchronous. A successful wait ends at ready; a failed environment is printed and returns a non-zero exit status. The wait deadline includes API requests and polling intervals. If it expires, the CLI prints the latest response and exits non-zero; it does not cancel the remote build. Environment creation is available only when enabled and configured for the API deployment.

List or inspect environments, including a later page or JSON response:

Terminal window
mpaka environments list --page 1 --page-size 25
mpaka environments list --page 2 --page-size 50 --json
mpaka environments get <ENVIRONMENT_ID> --json

list defaults to page 1 with 25 items. wait defaults to a 60-second deadline; use --wait-timeout-ms to choose another positive duration.

These commands use MPAKA_API_KEY:

Terminal window
mpaka executions list
mpaka executions get <EXECUTION_ID>
mpaka executions cancel <EXECUTION_ID>

list displays the first server-bounded page of execution summaries. get prints full lifecycle and result fields. cancel requests cancellation and prints the state returned by the service. Completion can win a race with a cancellation request, so the returned terminal status is authoritative.

Add --json when another program consumes the result:

Terminal window
mpaka executions list --json
mpaka executions get <EXECUTION_ID> --json
mpaka executions cancel <EXECUTION_ID> --json

List JSON uses the same paginated envelope as the API:

{
"items": [],
"page": 1,
"page_size": 25,
"total": 0,
"has_next": false
}

Inspection commands exit zero when their API request succeeds, including mpaka executions wait, even when the execution data says failed, timed_out, or cancelled. A local wait timeout exits non-zero. Use the returned status in automation. This differs from a foreground mpaka run, whose exit status reflects whether the submitted program completed successfully.

mpaka limits reports API request bounds and available resource profiles. mpaka quota reports tenant quota, while mpaka usage reports provisioned execution resource usage, not a monetary charge:

Terminal window
mpaka limits --json
mpaka quota --json
mpaka usage --period 30d --group-by day --json

Usage defaults to 30d and accepts 1d through 366d; --group-by currently accepts day. See the HTTP API for the underlying endpoints and usage fields.

Workload commands fail before dispatch if MPAKA_API_KEY is missing or blank. Invalid credentials, invalid IDs, transport failures, and API error responses also produce a non-zero CLI exit status. The CLI does not print passwords or stored account session tokens. The api-keys create and api-keys rotate commands intentionally print a new API key token once to standard output, including with --json, so you can save it securely.

See Troubleshooting for corrective actions.