Skip to main content
Each recipe shows the same task across all four ways to drive Nullspace. Pick the tab for your client; the rest of the docs use the same pattern.
MCP exposes every CLI command as a tool (nullspace machine createnullspace.machine.create), so a local coding agent runs these recipes by asking in natural language. See Local MCP to connect Codex, Claude Code, Cursor, or VS Code.

Create a machine

from nullspace import Machine

machine = Machine.create(template="base", timeout=300)
print(machine.id)

Run a command

result = machine.commands.run("echo hello && python3 --version", shell=True)
print(result.exit_code, result.stdout)

Read and write files

machine.files.write("/workspace/hello.txt", "hi\n")
print(machine.files.read("/workspace/hello.txt"))

Expose a preview URL

machine.commands.run(
    "cd /workspace && python3 -m http.server 8080 --bind 0.0.0.0",
    shell=True, background=True,
)
print(machine.get_url(8080))

Fork a running machine

child = machine.fork()
print(child.id)

Pause and resume

snapshot = machine.hibernate()          # pause, persist full state
machine = Machine.resume(snapshot.id)   # wake where it stopped

List and clean up

for s in Machine.list():
    print(s.id, s.status)
machine.kill()

Go deeper

Build a template

Capture dependencies once and start future machines from a reusable template.

Mount a volume

Persist data independently of any one machine and mount it into many runs.

Run code interpreter

Stateful notebook-style cells, package installs, and rich results.

Run an agent

MCP, an in-machine coding-agent template, or a framework integration.