> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# nebius ai job run

## Name

`nebius ai job run`

Package a local Python script and run it on a freshly provisioned Nebius VM as a\

one-off Job, streaming the container logs to stdout and following the job to\

completion.\


Inputs:\

\<file.py>        The entry script. Set it here or with 'entry' in nebius.yaml.\

the directory    The CLI packages the script directory so sibling imports work.\

A config entry uses its config directory as the packaged root.\

dependencies     Supply requirements.txt or --image for dependencies.\

Do not include a local virtual environment.\

Its binaries cannot run on the VM.\

\-- args...       The CLI passes arguments after '--' directly to sys.argv.\

Example: 'run main.py -- --epochs 10'.\


Packaging:\

The compressed package must fit within 64 KiB.\

The CLI excludes caches, virtual environments, VCS metadata, and bytecode.\

The CLI also excludes these case-sensitive secret file patterns at every depth:\

.env, .env.\*, \*.env, credentials.json, application\_default\_credentials.json, .netrc, .pypirc, id\_rsa, id\_dsa, id\_ecdsa, id\_ed25519, \*.key, \*.pem\

These exact example names bypass only the secret defaults:\

.env.example, .env.sample, .env.template\

Use --include-secret-file RELATIVE\_PATH to authorize one exact file for this invocation.\

Repeat the flag for each file.\

Resolve each path relative to the packaged root.\

Use .nebiusignore to add project exclusions with a subset of .gitignore syntax.\

Project rules in .nebiusignore still apply, including to explicitly authorized files.\

Built-in cache, VCS, and control-file exclusions still apply.\

YAML cannot authorize secret files.\

Use --show-context to preview included files and excluded paths.\


Behavior for automation:\


* In foreground mode, stdout carries only the job's container logs.\

  Job ID, progress, artifact hints, and the BETA banner go to stderr.\

* With --detach, explicit --format json or yaml returns the full Operation\

  on stdout. Its id identifies the operation; resource\_id identifies the Job.\

  Use `--format 'jsonpath={.resource_id}'` to extract the Job ID.\

  Without these formats, stdout is empty.\

* By default, the command exits when the job reaches a terminal state.\

  The exit code depends on that state. Use --detach to exit after submission.\

* Ctrl+C (SIGINT) stops following only; the job keeps running.\


The CLI does not return the script's exit code. A non-zero script exit marks the job as FAILED.\


Config file:\

By default the command reads ./nebius.yaml when it exists. Use --run-config to\

point to another file (distinct from the global --config, which selects the CLI\

profile). CLI flags override values from YAML. Use --init to create a starter\

nebius.yaml and .nebiusignore without submitting a job. Select hardware before\

you run the generated configuration.\


Artifacts:\

By default the command creates or reuses a managed project bucket.\

Each submission mounts a unique path `runs/{job-name}/{run-id}/` at /outputs.\

The script receives this directory as NEBIUS\_OUTPUT\_DIR.\

Reusing a name does not deduplicate a submission.\

Use --output BUCKET\_ID\_OR\_S3\_URI to choose a bucket, or --no-output to\

disable artifact storage.\

Explicit output destinations keep their existing paths.\


Setup: Create a profile with 'nebius profile create'. Set a platform and preset\

via flags or nebius.yaml. These parameters have no defaults.\

List Compute platforms and presets for your project:\

nebius compute platform list --parent-id PROJECT\_ID --all --format yaml\

Choose hardware supported by Serverless in your project.\

The project defaults from the active profile.\

If --subnet-id is omitted, the backend uses the project's default subnet in the workload region.\

The backend provisions the runtime identity. Image, disk, and timeout have defaults (see the\

flags below).\

BETA: jobs only (no serving/endpoints), no SSH, script directory ≤64 KiB gzip.

## Synopsis

```
nebius ai job run [file.py] [-- args...]
  --detach
  --disk-size
  --dry-run
  --env
  --env-secret
  --image
  --include-secret-file
  --init
  --name
  --no-output
  --output
  --parent-id
  --platform [required]
  --preset [required]
  --run-config
  --show-context
  --subnet-id
  --timeout
  --volume
```

## Examples

# Replace PLATFORM\_NAME and PRESET\_NAME with CPU hardware selected for your project.

nebius ai job run main.py --platform PLATFORM\_NAME --preset PRESET\_NAME

# Pass arguments through to the script as sys.argv.

nebius ai job run main.py --platform PLATFORM\_NAME --preset PRESET\_NAME -- --epochs 10

# Select a GPU platform and a CUDA image.

nebius ai job run main.py --platform gpu-h100-sxm --preset 1gpu-16vcpu-200gb --image nvcr.io/nvidia/pytorch:25.05-py3

# Set platform and preset in nebius.yaml before you run these commands.

nebius ai job run main.py --detach

# Submit the job and print the Operation as JSON.

nebius ai job run main.py --detach --format json

## Options

`--detach` (bool)

Submit the job and exit immediately without streaming logs or waiting for completion.

`--disk-size` (string)

Disk size of the VM. The service checks the minimum size for the boot image.

Format: `quantity`; default: `250Gi`; examples: `100Gi`, `1Ti`

`--dry-run` (bool)

Validate the job request without creating or running a job.

`--env` (string array)

Set an environment variable. Repeat this flag for each variable.

Format: `KEY=VALUE`

`--env-secret` (string array)

Set an environment variable from a MysteryBox secret. SECRET\_SELECTOR is a secret name, a secret ID, a version ID, or SECRET\_ID\@VERSION\_ID. Repeat this flag for each variable.

Format: `KEY=SECRET_SELECTOR`

`--image` (string)

Container image for the script. Use a CUDA or ML image for GPU platforms.

Default: `python:3.12-slim`

`--include-secret-file` (string array)

Include one exact protected `RELATIVE_PATH` from the packaged root. Repeat for each file. This flag overrides only the secret defaults for this invocation. The exact example names .env.example, .env.sample, .env.template bypass the secret defaults. Project rules and other built-in exclusions still apply. YAML cannot authorize secret files.

`--init` (bool)

Create starter nebius.yaml and .nebiusignore files, then exit without submitting a job.

`--name` (string)

Job name (default: 'run-' plus the script's base name).

`--no-output` (bool)

Do not mount an output bucket or set NEBIUS\_OUTPUT\_DIR.

Mutually exclusive with: `--output`.

`--output` (string)

Output bucket to mount at /outputs and expose as NEBIUS\_OUTPUT\_DIR. Use 'auto' to create/reuse the managed project bucket, or pass a storage bucket ID/name or s3://bucket URI.

Default: `auto`

Mutually exclusive with: `--no-output`.

`--parent-id` (string)

Project ID to create the job in (default: the active profile's project).

`--platform` (string)* \[required]*

Compute platform name for your project. Required; set --platform or platform: in nebius.yaml.

`--preset` (string)* \[required]*

Resource preset name for the selected platform. Required; set --preset or preset: in nebius.yaml.

`--run-config` (string)

Path to a YAML run config file (default: ./nebius.yaml when it exists). CLI flags override YAML. Distinct from the global --config, which selects the CLI profile.

`--show-context` (bool)

Preview included files, excluded paths, reasons, and the compressed size without an API request.

`--subnet-id` (string)

Subnet ID (default: the project's default subnet in the workload region).

`--timeout` (duration: 2h30m10s)

Job timeout. The service checks it asynchronously after initial provisioning.

Format: `duration`; range: `5m` to `168h`; default: `1h`

`--volume` (string array)

Mount a volume. Repeat this flag for each volume.

Format: `RESOURCE_ID:MOUNT_PATH[:ro|rw]`; examples: `storagebucket-...:/outputs:rw`

## Exit Codes

<table>
  <thead>
    <tr>
      <th>Exit code</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `0`
      </td>

      <td>
        The job completed or the API accepted the detached submission.
      </td>
    </tr>

    <tr>
      <td>
        `1`
      </td>

      <td>
        The job failed or the CLI received an unknown error.
      </td>
    </tr>

    <tr>
      <td>
        `5`
      </td>

      <td>
        The job had an infrastructure failure or the CLI had an internal error.
      </td>
    </tr>

    <tr>
      <td>
        `6`
      </td>

      <td>
        The service cancelled the job or you stopped following it with Ctrl+C.
      </td>
    </tr>
  </tbody>
</table>

All other exit codes have the standard CLI meaning. See [CLI exit codes](https://docs.nebius.com/cli/exit-codes.md).

## Global Options

`-h, --help` (bool)

Show this message.

`-p, --profile` (string)

Set a profile for interacting with the cloud.

`--format` (string)

Output format. Supported values: yaml|json|jsonpath|table|text.

`-f, --file` (string)

Input file. For 'update' commands automatically set --full=true.

`-c, --config` (string)

Provide path to config file.

`--debug` (bool)

Write debug logs to stderr. Commands save debug logs in the config directory under logs/, except help and shell completion.

`-I, --impersonate-service-account-id` (string)

Impersonate into the service account and use its token for a command.

`--color` (bool)

Enable colored output.

`--no-browser` (bool)

Do not open browser automatically on auth.

`--insecure` (bool)

Disable transport security.

`--auth-timeout` (duration: 2h30m10s)

Set the timeout for the request including authentication process, default is 15m0s.

`--per-retry-timeout` (duration: 2h30m10s)

Set the timeout for each retry attempt, default is 20s.

`--retries` (uint)

Set the number of retry attempts, 1 is disable retries, default is 3.

`--no-check-update` (bool)

Suppress check for updates.

`--no-progress` (bool)

Suppress progress indicators and spinners.

*Auto generated on 23-Nov-2026*
