This example uses examples/python/functions/openai_agents_job/function.py to package an OpenAI Agents SDK app, run it as a finite job, and collect declared outputs.

Setup

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

CLI

nullspace functions deploy

nullspace functions run openai-agents-job \
  --input-json '{"task":"summarize functions"}' \
  --env OPENAI_API_KEY="$OPENAI_API_KEY" \
  --json

nullspace functions logs openai-agents-job --run fnrun_123
nullspace functions outputs openai-agents-job --run fnrun_123
nullspace functions status openai-agents-job --run fnrun_123
nullspace functions delete openai-agents-job --yes
Expected output includes a successful run status and output metadata for result.json plus reports/summary.md.

Function Definition

function.py
import nullspace

function = nullspace.Function(
    "openai-agents-job",
    mode="job",
    install="python -m pip install -e .",
    entrypoint="python main.py",
    env=nullspace.Env(required=["OPENAI_API_KEY"]),
    outputs=nullspace.Outputs(paths=["result.json", "reports"]),
)

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={"task": "Summarize why Functions are useful."},
    envs={"OPENAI_API_KEY": "..."},
    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
Related: OpenAI Agents SDK and Functions.