Skip to main content
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.
Agent DeploymentThe 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 sandbox, 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==0.1.9"
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 Sandbox


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


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


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


asyncio.run(main())

Deploy An Agents SDK Job

Use Agent Deployments when the whole Agents SDK app should run as a managed process instead of calling a sandbox from your local process.
name = "openai-agents-job"
mode = "job"
template = "base"
workdir = "/workspace/project"
install = "python -m pip install -e ."
entrypoint = "python main.py"

[env]
required = ["OPENAI_API_KEY"]

[outputs]
paths = ["result.json", "reports"]
nullspace agent deploy .
nullspace agent 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.
name = "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]
port = 8000
readiness = { type = "http", path = "/health", timeout_seconds = 30 }

[permissions]
public_url = true

State Boundary

Nullspace owns deployment runs, service instances, backing sandboxes, 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 deployment path is the supported path today. A future native NullspaceSandboxClient adapter can make Nullspace sandboxes feel like an Agents SDK sandbox backend, but it should not own the model loop, tracing, handoffs, approval state, or framework run persistence.