Skip to main content

Python SDK for connecting to Decart's Oasis action-to-video model.

Project description

decart-oasis

Python SDK for connecting to Decart's Oasis 3 action-to-video world model. You open a session, set a scene with a prompt, send driving actions, and get back the generated camera frames — actions in, frames out.

This package is intentionally lightweight — just the gRPC client and VP9/JPEG frame decoding (no torch / ML / Jupyter stack). The RL examples, depth-collision reward, and notebook visualization live in the separate oasis-demo package, which depends on this one.

Full reference: docs/python-sdk.mdx (rendered on the Decart docs site).

Install

pip install decart-oasis

Requires Python 3.10+.

API key

Connecting requires a Decart API key. Set DECART_API_KEY (read automatically) or pass it in:

export DECART_API_KEY="sk-..."
from decart_oasis import A2VClient

client = A2VClient()                 # reads DECART_API_KEY
client = A2VClient(api_key="sk-...") # or pass it explicitly

Quickstart

from decart_oasis import A2VClient

with A2VClient() as client:                       # opens the session, closes it on exit
    client.prompt("driving in an urban area")     # set the scene
    result = client.infer(                         # 4 actions in -> 4 frames per stream out
        [[0.2, 0.0], [0.2, 0.0], [0.2, 0.1], [0.2, 0.1]]
    )

front_frames = result.frames["front"]              # list of 4 RGB frames (H x W x 3, uint8)

A2VClient is a context manager: entering it calls initialize(), exiting it calls close() (even on error).

The session lifecycle

Without the with form, drive the four phases yourself:

client = A2VClient()
client.initialize()                       # open session, authenticate, negotiate format
client.prompt("driving on a highway")     # set/reset the scene (sequence restarts at 0)
result = client.infer(actions)            # send 4 actions, get 4 frames per stream
client.close()                            # finish the session, release the channel
  • initialize() returns the advertised streams (left_forward, front, right_forward).
  • prompt(text) sets the scene; calling it again resets the world-model rollout.
  • infer(actions) must be called after a prompt; loop it to keep driving.
  • close() ends the session.

Actions and frames

Each infer call takes a chunk of four [throttle, steering] actions and returns four frames per stream.

  • throttle in [-1, 1] — forward (+) / brake or reverse (-)
  • steering in [-1, 1] — left (-) / right (+)
import numpy as np

actions = np.array(
    [[0.15, -0.10], [0.20, -0.04], [0.22, 0.04], [0.18, 0.10]],
    dtype=np.float32,
)                                      # shape (4, 2), values in [-1, 1]
result = client.infer(actions)

result.sequence_num                    # server tick (0, 1, 2, ...; resets on prompt)
result.frames["front"]                 # list of 4 numpy RGB frames, shape (512, 768, 3)
set(result.frames)                     # {"left_forward", "front", "right_forward"}

Actions must be shape (4, 2), finite, and within [-1, 1], or infer raises ValueError.

Endpoint

The SDK uses the hosted Oasis server by default (https://oasis-grpc.decart.ai). Override it via the constructor, or DECART_ROBOTICS_ENDPOINT with A2VClient.from_env():

client = A2VClient("localhost:50051", tls=False)   # local insecure
client = A2VClient.from_env()                       # reads DECART_ROBOTICS_ENDPOINT

https:// endpoints use TLS; http:// uses an insecure channel. For bare host:port endpoints TLS is on by default — pass tls=False for local/debug. The load balancer pins a session after Initialize via the x-session-target initial-metadata header, which the SDK captures and replays on later Prompt/Infer/Finish calls. Output frames are negotiated as VP9 and decoded with PyAV.

Errors

All SDK errors subclass DecartRoboticsError. Errors returned by the service are raised as A2VError with a .code, .message, and .details.

from decart_oasis.exceptions import A2VError, DecartRoboticsError

try:
    with A2VClient() as client:
        client.prompt("driving in an urban area")
        client.infer(actions)
except A2VError as exc:
    print(f"service error {exc.code}: {exc.message}")   # e.g. ERROR_CODE_INVALID_API_KEY
except DecartRoboticsError as exc:
    print(f"client error: {exc}")

Development

This repo is a uv workspace; from the repo root:

uv sync                       # installs decart-oasis + oasis-demo editable
uv run pytest sdk/tests
uv run ruff check sdk

Protobuf source lives in sdk/protos/; generated modules are committed under sdk/decart_oasis/_proto/ so users do not need protoc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decart_oasis-0.0.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decart_oasis-0.0.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file decart_oasis-0.0.1.tar.gz.

File metadata

  • Download URL: decart_oasis-0.0.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for decart_oasis-0.0.1.tar.gz
Algorithm Hash digest
SHA256 224a36532bf00dd8fc09d0e67744c6324f8543458e173c1ed477cd28727794a2
MD5 ad2f904afa8b08d11279c75ec5ad0865
BLAKE2b-256 90a1a05c349f0b24d29b6532b0e96e64797129bc7af8b30474aaaa22bf6804df

See more details on using hashes here.

Provenance

The following attestation bundles were made for decart_oasis-0.0.1.tar.gz:

Publisher: publish.yml on DecartAI/decart-robotics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file decart_oasis-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: decart_oasis-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for decart_oasis-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8f4912ca8e45b6a7f20825de3e5ca11b23958aca11292535170cc6e0b271561
MD5 a50c53d75c30d00a8f46869975ce015f
BLAKE2b-256 08d25a893b1c158d5efbdf1606ae30b2f6297c6fc68fbeacce27791de710518a

See more details on using hashes here.

Provenance

The following attestation bundles were made for decart_oasis-0.0.1-py3-none-any.whl:

Publisher: publish.yml on DecartAI/decart-robotics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page