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 and update
Section titled “Install and update”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:
mpaka --versionCheck for an update without applying it, install the latest release, or select an exact release:
mpaka self-update --checkmpaka self-updatempaka self-update --version v0.4.1The CLI connects to https://api.mpaka.dev by default. You do not need to set
an endpoint for the mPaka service.
Account commands
Section titled “Account commands”Account commands use a saved account session. They do not create or replace
the MPAKA_API_KEY required for workload commands.
mpaka register --email user@example.commpaka login --email user@example.commpaka whoamimpaka logoutregister and login prompt for the password without echoing it. For
non-interactive input, send one password through standard input:
printf '%s\n' "$MPAKA_PASSWORD" | mpaka login \ --email user@example.com \ --password-stdinPasswords 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.
Manage API keys
Section titled “Manage API keys”The api-keys commands use the saved account session, not
MPAKA_API_KEY. Creating, rotating, and deleting keys requires an owner
account:
mpaka api-keys create --name developmentmpaka api-keys listmpaka 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.
Run Python
Section titled “Run Python”First create a key in the web console and set
MPAKA_API_KEY. Then submit one file:
mpaka run --file script.pyOr read the source from standard input:
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.
Execution options
Section titled “Execution options”| 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.
Output and exit status
Section titled “Output and exit status”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.
Return before execution finishes
Section titled “Return before execution finishes”Use --async to return the accepted execution without polling. Then wait or
inspect it separately:
mpaka run --file script.py --async --jsonmpaka executions wait <EXECUTION_ID> --wait-timeout-ms 60000 --jsonmpaka 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:
mpaka limitsmpaka limits --jsonmpaka run --file script.py --cpu-profile high_cpu --memory-profile high_memorympaka run --file script.py --vcpu-count 2 --memory-mb 512A 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.3mpaka environments create --requirements requirements.txtmpaka environments wait <ENVIRONMENT_ID> --wait-timeout-ms 60000mpaka 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:
mpaka environments list --page 1 --page-size 25mpaka environments list --page 2 --page-size 50 --jsonmpaka environments get <ENVIRONMENT_ID> --jsonlist defaults to page 1 with 25 items. wait defaults to a 60-second
deadline; use --wait-timeout-ms to choose another positive duration.
Inspect and cancel executions
Section titled “Inspect and cancel executions”These commands use MPAKA_API_KEY:
mpaka executions listmpaka 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:
mpaka executions list --jsonmpaka executions get <EXECUTION_ID> --jsonmpaka executions cancel <EXECUTION_ID> --jsonList 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.
Read limits, quota, and usage
Section titled “Read limits, quota, and usage”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:
mpaka limits --jsonmpaka quota --jsonmpaka usage --period 30d --group-by day --jsonUsage defaults to 30d and accepts 1d through 366d; --group-by currently
accepts day. See the HTTP API for the underlying endpoints and
usage fields.
Credential and transport failures
Section titled “Credential and transport failures”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.