Use the code-interpreter template when you want a hosted notebook-like runtime with persistent kernel state, installed data libraries, rich results, and file artifacts.
from nullspace import Machine

with Machine.create(template="code-interpreter") as machine:
    result = machine.run_code("""
import pandas as pd

df = pd.DataFrame({"x": [1, 2, 3], "y": [1, 4, 9]})
df.describe()
""")
    print(result.results[0].text)
Code cells can share state through a context:
ctx = machine.code_interpreter.create_code_context(language="python", cwd="/workspace")
machine.code_interpreter.run_code("value = 21", context=ctx)
result = machine.code_interpreter.run_code("value * 2", context=ctx)
print(result.results[0].text)