OpenAI Agents SDK apps usually integrate with Nullspace in one of two ways:
ShapeUse When
Tool wrapperThe model loop stays in your app and calls Nullspace for isolated command or file work.
FunctionThe whole Agents SDK app should run in Nullspace as a managed job or service.

Wrap Nullspace As A Tool

Use this pattern when an Agents SDK app should create a machine, run a bounded command, and return a concise result to the agent. Your application process stays in control of credentials, retries, cleanup, tracing, handoffs, and approval state.
python -m pip install openai-agents nullspace-sdk
export OPENAI_API_KEY=sk-...
export NULLSPACE_API_KEY=ns_live_...
export NULLSPACE_API_URL=https://api.your-nullspace-domain
import asyncio

from agents import Agent, Runner, function_tool
from nullspace import Machine


@function_tool
def run_in_nullspace(command: str) -> str:
    """Run a short shell command in an isolated Nullspace machine."""
    with Machine.create(template="base", timeout=300) as machine:
        result = machine.commands.run(command, shell=True, timeout=120)
        return result.stdout[-4000:] or result.stderr[-4000:]


agent = Agent(
    name="Machine Operator",
    instructions="Use the machine tool for commands that need isolated execution.",
    tools=[run_in_nullspace],
)


async def main() -> None:
    result = await Runner.run(agent, "Use a machine to print Python's platform.")
    print(result.final_output)


asyncio.run(main())

Deploy An Agents SDK Job

Use Functions when the whole Agents SDK app should run as a managed process instead of calling a machine from your local process.
function.py
import nullspace

function = nullspace.Function(
    "openai-agents-job",
    mode="job",
    template="base",
    workdir="/workspace/project",
    install="python -m pip install -e .",
    entrypoint="python main.py",
    env=nullspace.Env(required=["OPENAI_API_KEY"]),
    outputs=nullspace.Outputs(paths=["result.json", "reports"]),
)
nullspace functions deploy
nullspace functions run openai-agents-job \
  --input-json '{"task":"summarize the deployment plan"}' \
  --env OPENAI_API_KEY="$OPENAI_API_KEY" \
  --json
See the OpenAI Agents SDK job example for a complete project.

Deploy An Agents SDK Service

Use mode = "service" when your Agents SDK app exposes an HTTP API, chat backend, or internal coordinator.
function.py
import nullspace

function = nullspace.Function(
    "openai-agents-service",
    mode="service",
    template="base",
    workdir="/workspace/project",
    install="python -m pip install -e .",
    entrypoint="python -m uvicorn app:app --host 0.0.0.0 --port 8000",
    service=nullspace.Service(
        port=8000,
        readiness={"type": "http", "path": "/health", "timeout_seconds": 30},
    ),
    policy=nullspace.Policy(public_url=True),
)

State Boundary

Nullspace owns Function runs, service instances, backing machines, logs, outputs, URLs, and cleanup. OpenAI Agents SDK tracing, handoffs, and approval state stay owned by the Agents SDK app. Store framework run persistence in your database, a volume, or app-managed storage. The generic process-level Function path is the supported path today. A future native Nullspace machine client adapter can make Nullspace machines feel like an Agents SDK machine backend, but it should not own the model loop, tracing, handoffs, approval state, or framework run persistence.