This example uses examples/python/functions/minimal_job/function.py to package a small Python project, run it as a job, and collect declared outputs.

Setup

uv pip install "nullspace-sdk[cli]"
export NULLSPACE_API_KEY=ns_live_...
export NULLSPACE_API_URL=https://api.your-nullspace-domain
cd examples/python/functions/minimal_job

CLI

nullspace functions deploy

nullspace functions run minimal-job-function \
  --input-json '{"subject":"functions"}' \
  --env EXAMPLE_FUNCTION_GREETING=hello \
  --json

nullspace functions logs minimal-job-function --run fnrun_123
nullspace functions outputs minimal-job-function --run fnrun_123
nullspace functions status minimal-job-function --run fnrun_123
nullspace functions delete minimal-job-function --yes
Expected output includes a successful run status, a stdout line beginning with minimal job wrote result.json, and output metadata for result.json plus reports/summary.txt.

Python

The companion run.py script uses the same function contract through the SDK:
from pathlib import Path

from nullspace import Function

project = Path(__file__).resolve().parent
function, version, manifest = Function.deploy(path=project)
call = function.spawn(
    input={"subject": "functions"},
    envs={"EXAMPLE_FUNCTION_GREETING": "hello"},
    retain_on_failure=True,
)
run = call.get(timeout=60)
outputs = call.outputs()
print(function.name, version.id, len(manifest.entries), len(outputs.outputs))
Run the complete script:
python run.py

Project Files

examples/python/functions/minimal_job/
  README.md
  main.py
  run.py
  function.py
Related: Functions and CLI reference.