Skip to main content

SpatialAI SDK

Python SDK for VisionLibra ToF depth sensors and cameras.

Physical AI starts with Spatial Intelligence + AI Agents.

pip install spatialai

Five lines to spatial intelligence:

from spatialai import Camera

cam = Camera()
result = cam.detect_people()
print(result)
# {'people': 1, 'nearest_m': 1.42, 'positions': [...], 'source': 'simulator'}

Status — v0.3 (alpha)

Feature Status
Simulator (all products, depth frames included) ✅ works everywhere
Spatial Mini / DM0301 over I²C (native protocol @ 0x41) ✅ beta — Linux SBCs, pip install "spatialai[dm0301]"
Spatial Home / DMOS5030 over UART (protocol v1.4.4) ✅ beta — any OS via USB-serial, pip install "spatialai[dmos5030]"
load_model() + presence-core, occupancy-home-v1 ✅ free, shipped with the SDK
Spatial Vision / Robot real backends (UVC) 🚧 in development — simulator only for now
Remaining marketplace models, agents, fleet 🚧 in development — load_model() raises with waitlist info

Hardware backends are implemented straight from the DOMI datasheets and protocol docs with full protocol-level test coverage; they carry a beta label until validated on production modules.

Models

Two production models ship free with the SDK today:

from spatialai import Camera

cam = Camera("spatial-home", simulate=True)
cam.load_model("occupancy-home-v1")    # room occupancy from depth CV
cam.load_model("presence-core")        # presence/approach with debouncing

for frame in cam.stream(hz=10, duration=5):
    occ = frame.models["occupancy"]
    print(f"people={occ['people']} pets={occ['pets']} occupied={occ['occupied']}")

occupancy-home-v1 is classic depth computer vision — background estimation, foreground clustering, person/pet size classification — so it needs no GPU and runs on a Raspberry Pi. Announced models that haven't shipped (people-tracking-v3, forklift-safety, …) raise ModelNotAvailableYet with waitlist instructions instead of failing silently.

Simulator — works on any machine

Every device can run in simulator mode, which generates realistic distance and people-detection streams. It is the default whenever no hardware is detected, so the quickstart above always runs.

from spatialai import Camera

cam = Camera("spatial-vision", simulate=True)
for frame in cam.stream(hz=10, duration=3):
    print(f"people={frame.people} nearest={frame.nearest_m:.2f}m")

Try it from the terminal:

spatialai demo                  # live simulated distance readout
spatialai demo --device spatial-vision
spatialai scan                  # look for real hardware on I2C

Real hardware — Spatial Mini (DM0301, I²C)

The DM0301 speaks its own register protocol at I²C address 0x41 (it is pin-compatible with the VL53L4CD, but not protocol-compatible — don't use ST drivers). Wiring on a Raspberry Pi: VIN→3V3, GND→GND, SDA→GPIO2, SCL→GPIO3, XSHUT pulled high.

sudo raspi-config          # enable I2C
pip install "spatialai[dm0301]"
from spatialai import Sensor

lock = Sensor("spatial-mini")      # auto-detects the sensor at 0x41
print(lock.distance_m())           # 0.734

for reading in lock.stream(hz=20):
    if reading.distance_m < 0.5:
        print("presence!", reading)

Real hardware — Spatial Home (DMOS5030, UART)

Wire the module to any USB-serial adapter (115200 8N1 by default) and pass the port:

pip install "spatialai[dmos5030]"
from spatialai import Camera

cam = Camera("spatial-home", port="/dev/ttyUSB0")   # COM3 on Windows
cam.load_model("occupancy-home-v1")
print(cam.infer()["occupancy"])

Defaults to 25×25 depth at 5 fps (fits 115200 baud). For the full 100×100 resolution pass resolution=(100, 100), baud=921600, fps=10.

API overview

  • Camera(device_id=None, simulate=None) — unified entry point. .detect_people(), .stream(hz, duration), .distance_m(), .info()
  • Sensor(device_id) — alias of Camera tuned for 1D sensors.
  • spatialai.devices() — catalog of supported products.
  • Exceptions: DeviceNotFound, HardwareNotSupportedYet.

Roadmap

Depth-frame backends for Spatial Home (DMOS5030A serial), Spatial Vision (DMOM2508CL) and Spatial Robot (DMAS2M001), on-device people tracking models, and the agent/fleet APIs. Follow along at visionlibra.adamaohappy.workers.dev/developer.html.

License

MIT

Release files for spatialai 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spatialai 0.3.1
File Size Uploaded
spatialai-0.3.1.tar.gz 25.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spatialai 0.3.1
File Interpreter ABI Platform
spatialai-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.3 kB

Release files / spatialai-0.3.1.tar.gz

Download URL spatialai-0.3.1.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bf7c0c8a57ff786e8ac5ec6fc3159920cf30da0faca0f4725b334f4dd1bd7391
BLAKE2b-256 checksum
How to use checksums
fa10bb13dab02fdfca8a6fc7d0ff3a68fe6c15ab1646ddd39bc376325b5fe0fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / spatialai-0.3.1-py3-none-any.whl

Download URL spatialai-0.3.1-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfd800166239c9d83e928d0be36ab790bf25c0d08048445d6c30ad9e0827c59d
BLAKE2b-256 checksum
How to use checksums
b6f90890780d310174c95194b61451979fc79cd590677e6d32995b52daba4067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page