Hardsim Python SDK
Project description
Hardsim SDK (v0)
Phase 1 SDK goals:
submit(...)/run(...)to create cloud simulation jobsstep(...)alias for cloud-routed environment stepsstatus(...),wait(...), anddownload(...)for lifecycle + artifactswatch(...)live terminal status stream for jobscancel(...)for queued/running jobsupload_input(...)helper for local URDF/USD (default API presigned upload, optional direct S3 mode)upload_input_asset(...)helper that returns stable Hardsimasset_idsubmit_assets(...)one-call strict real submit (auto-upload local assets, then submit)- Retries + typed exceptions for robust client behavior
Install from PyPI:
pip install hardsim
Install (editable during development):
pip install -e ./sdk
# optional direct-S3 upload helper dependencies:
pip install -e "./sdk[s3]"
Release process is documented in docs/sdk-release.md.
3-line usage:
import hardsim as hs
job = hs.submit(robot="s3://bucket/franka.urdf", scene="table_top_v0", num_envs=64, steps=2000)
hs.wait(job.job_id)
paths = hs.download(job.job_id, "./outputs")
Environment variables:
HARDSIM_API_KEY(required)HARDSIM_API_URL(defaulthttp://localhost:8000)HARDSIM_HTTP_TIMEOUT_S(default30)HARDSIM_HTTP_RETRIES(default3)HARDSIM_HTTP_BACKOFF_S(default0.5)HARDSIM_INPUT_S3_BUCKET(used for direct-S3upload_input(...)fallback or explicit direct mode)HARDSIM_INPUT_S3_PREFIX(defaulthardsim/inputs)HARDSIM_INPUT_S3_REGION/HARDSIM_INPUT_S3_ENDPOINT_URL(optional)
Production base URL:
export HARDSIM_API_URL=https://api-sim.hardlightsim.com
Idempotent create (recommended for client retries):
job = hs.step(
robot="s3://bucket/franka.urdf",
scene="table_top_v0",
num_envs=64,
steps=2000,
control={"task_mode": "fr3_pick_lift_block_v1", "fix_base": True},
idempotency_key="train-run-42-shard-0001",
)
Local file upload helper:
import hardsim as hs
client = hs.HardsimClient.from_env()
robot_uri = client.upload_input("./assets/franka.urdf")
job = client.submit(robot=robot_uri, scene="table_top_v0", num_envs=64, steps=2000)
Asset ID flow (recommended for repeated jobs / dashboard parity):
robot_asset_id = client.upload_input_asset("./assets/franka.urdf", asset_kind="robot")
scene_asset_id = client.upload_input_asset("./assets/cabinet_scene.usd", asset_kind="scene")
job = client.submit_assets(
robot_asset_id=robot_asset_id,
scene_asset_id=scene_asset_id,
robot_asset_type="urdf",
num_envs=64,
steps=2000,
)
One-call strict real submit (recommended for enterprise jobs):
import hardsim as hs
client = hs.HardsimClient.from_env()
job = client.submit_assets(
robot_asset="./assets/franka.urdf", # local path or s3:// URI
scene_usd="./assets/cabinet_scene.usd", # local path or s3:// URI
num_envs=64,
steps=2000,
scene_id="franka_cabinet_oige_v1",
control={"task_mode": "fr3_pick_lift_block_v1", "fix_base": True},
)
Direct-S3 upload mode (requires boto3 + AWS creds):
robot_uri = client.upload_input(
"./assets/franka.urdf",
bucket="my-bucket",
key_prefix="hardsim/inputs",
prefer_presigned=False,
)
Managed training APIs:
create_training_run(...)get_training_run(run_id)wait_training_run(run_id, ...)watch_training_run(run_id, ...)pause_training_run(run_id),resume_training_run(run_id),cancel_training_run(run_id)list_run_checkpoints(run_id),get_latest_checkpoint(run_id)checkpoint_init_asset_idis supported oncreate_training_run(...)
Live terminal monitoring:
import hardsim as hs
job = hs.submit(robot="s3://bucket/franka.urdf", scene="table_top_v0", num_envs=64, steps=2000)
hs.watch(job.job_id, poll_interval_s=2.0)
run = hs.create_training_run(
project_id="proj_demo",
name="managed-loop",
rollout_template={"job_template": {"job_type": "rollout"}, "rollout_parallelism": 1, "episodes_per_iteration": 1},
trainer_spec={"image_uri": "ghcr.io/acme/train:latest", "entrypoint": "python train.py", "resources": {"gpu": 1}},
loop_policy={"max_iterations": 1},
)
hs.watch_training_run(run["run_id"], poll_interval_s=5.0)
Reference trainer image for /v1/training-runs testing:
- image source:
examples/managed_training/smoke_trainer/ - usage doc:
docs/trainer-smoke-image.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hardsim-0.1.2.tar.gz.
File metadata
- Download URL: hardsim-0.1.2.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da453bd505cdcbb102b449cd27c891632c4a30656c4c3c1d09ffb6d5911e3367
|
|
| MD5 |
71fbc00ef0a4a85d60e93911697b7297
|
|
| BLAKE2b-256 |
d981484f815ec4dd8695d452a7942058277de456252885ed55fc4c9ef1fef260
|
File details
Details for the file hardsim-0.1.2-py3-none-any.whl.
File metadata
- Download URL: hardsim-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2caa15451b1924dcbd51d1369418ff77cf0e989f6c56e30369c37ef98bdac886
|
|
| MD5 |
cbee1eb9cd6e98ff385a20741d0aaa20
|
|
| BLAKE2b-256 |
089ededaf2722812369d1c0935801a69b322cad49536e137860e31e828cca9e9
|