roborama-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- roborama_sdk-0.1.0/.gitignore +7 -0
- roborama_sdk-0.1.0/LICENSE +21 -0
- roborama_sdk-0.1.0/PKG-INFO +92 -0
- roborama_sdk-0.1.0/README.md +63 -0
- roborama_sdk-0.1.0/pyproject.toml +48 -0
- roborama_sdk-0.1.0/src/roborama/__init__.py +391 -0
- roborama_sdk-0.1.0/src/roborama/_client.py +204 -0
- roborama_sdk-0.1.0/src/roborama/_data/environments.json +51 -0
- roborama_sdk-0.1.0/src/roborama/_data/kits.json +45 -0
- roborama_sdk-0.1.0/src/roborama/_data/matrix.json +63 -0
- roborama_sdk-0.1.0/src/roborama/_data/pricing.json +172 -0
- roborama_sdk-0.1.0/src/roborama/_data/robots.json +106 -0
- roborama_sdk-0.1.0/src/roborama/_data/runs.json +128 -0
- roborama_sdk-0.1.0/src/roborama/_data/streams.json +11 -0
- roborama_sdk-0.1.0/src/roborama/_data/suites.json +36 -0
- roborama_sdk-0.1.0/src/roborama/_data/tasks.json +87 -0
- roborama_sdk-0.1.0/src/roborama/_data/transfer.json +19 -0
- roborama_sdk-0.1.0/src/roborama/_data/usage.json +13 -0
- roborama_sdk-0.1.0/src/roborama/_errors.py +263 -0
- roborama_sdk-0.1.0/src/roborama/_mock.py +731 -0
- roborama_sdk-0.1.0/src/roborama/_models.py +823 -0
- roborama_sdk-0.1.0/src/roborama/_resources.py +819 -0
- roborama_sdk-0.1.0/src/roborama/_stats.py +110 -0
- roborama_sdk-0.1.0/src/roborama/py.typed +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Roborama
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: roborama-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the Roborama API — statistically defensible evaluation of robot policies on physical hardware.
|
|
5
|
+
Project-URL: Homepage, https://roborama.com
|
|
6
|
+
Project-URL: Documentation, https://roborama.com/docs
|
|
7
|
+
Project-URL: API Reference, https://roborama.com/docs/api-reference
|
|
8
|
+
Project-URL: OpenAPI, https://roborama.com/openapi.json
|
|
9
|
+
Author-email: Roborama <api@roborama.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,benchmark,evaluation,robotics,robots,sdk
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Requires-Dist: httpx>=0.24
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# roborama-sdk
|
|
31
|
+
|
|
32
|
+
Official Python SDK for [Roborama](https://roborama.com) — real robots as an API. Statistically defensible evaluation of robot policies on physical hardware: every result carries `n` and a 95% confidence interval, everything is versioned (robots pin firmware, environments and suites pin revisions), and both meters (robot-hours × environment-hours) are visible in every quote.
|
|
33
|
+
|
|
34
|
+
> **Status.** The API surface is a **stable draft** of [openapi.json](https://roborama.com/openapi.json); hosted execution is in **private preview**. This SDK ships a deterministic **mock mode** so you (and your agents) can integrate today — set `ROBORAMA_MOCK=1` and every call returns fixture-shaped results with honest statistics, no hardware and no API key required.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install roborama-sdk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The distribution is `roborama-sdk`; the module is `roborama` — import statements are exactly as documented (`import roborama`).
|
|
41
|
+
|
|
42
|
+
## First call
|
|
43
|
+
|
|
44
|
+
Authentication reads `ROBORAMA_API_KEY` (keys carry the `rbr_live_` prefix) from the environment, so it's an export, not an argument.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import roborama # reads ROBORAMA_API_KEY from the environment
|
|
48
|
+
|
|
49
|
+
run = roborama.run(
|
|
50
|
+
robot="g1-edu-pro@fw2.3", # embodiment @ pinned firmware
|
|
51
|
+
environment="kitchen-std@v1.2", # versioned catalogue scene
|
|
52
|
+
policy=roborama.Policy.checkpoint( # openpi / lerobot checkpoints,
|
|
53
|
+
hf="acme/skill-v4", # containers, or hosted endpoints
|
|
54
|
+
runtime="openpi",
|
|
55
|
+
),
|
|
56
|
+
task="load_dishwasher@v2",
|
|
57
|
+
episodes="auto(ci=0.95, moe=0.03)", # size n for ±3% at 95% — or an int
|
|
58
|
+
max_budget_usd=4_000, # hard stop, metered live
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
print(run.result())
|
|
62
|
+
# n=612 success_rate=0.874 ci95=(0.846, 0.898)
|
|
63
|
+
# failure_clusters: [grasp_slip: 41, perception_miss: 22, collision: 9]
|
|
64
|
+
# robot_hours=20.4 environment_hours=20.4 cost_usd=3812
|
|
65
|
+
# artifacts: ground_truth, mcap, report_pdf, video
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Mock mode — runnable today
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
ROBORAMA_MOCK=1 python your_script.py # or: roborama.Client(mock=True)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Mock mode is deterministic and fixture-shaped: quote math follows the [public rate card](https://roborama.com/pricing), run results are shaped like the canonical runs, `max_budget_usd` hard stops raise `roborama.BudgetExceeded` with an honest `partial_result`, and Wilson intervals are computed exactly as documented. The same code runs unchanged against the hosted API once you have a key.
|
|
75
|
+
|
|
76
|
+
## The surface
|
|
77
|
+
|
|
78
|
+
- **Primitives** (module-level, one call per physical question): `roborama.run()`, `roborama.eval()`, `roborama.verify()`, `roborama.matrix()`, `roborama.threshold()`, `roborama.compare()`, `roborama.transfer()` — plus `roborama.quote()` and `roborama.usage()`.
|
|
79
|
+
- **Resources**: `roborama.runs`, `roborama.robots`, `roborama.environments`, `roborama.suites`, `roborama.tasks`, `roborama.kits`, `roborama.streams`, `roborama.keys`, `roborama.budgets`, `roborama.data`, `roborama.calibration`, `roborama.scenarios` — with the `list()`/`get()` shapes you'd expect.
|
|
80
|
+
- **Policies**: `roborama.Policy.container(...)`, `.checkpoint(...)`, `.endpoint(...)` — declared contracts, validated before any motor moves.
|
|
81
|
+
- **Results**: `run.result()` (n, rate, ci95, clusters, both meters), `run.episodes[i]` (video, MCAP, replay spec), `run.watch()` (live), `run.export(format="lerobot")`, `run.report(format="pdf")`.
|
|
82
|
+
- **Errors**: `roborama.RoboramaError` base; every code in [the error reference](https://roborama.com/docs/errors/) maps to a subclass (`budget_exceeded` → `roborama.BudgetExceeded`, carrying `err.partial_result`).
|
|
83
|
+
|
|
84
|
+
Docs: [quickstart](https://roborama.com/docs/quickstart/) · [primitives](https://roborama.com/docs/primitives/run/) · [errors](https://roborama.com/docs/errors/) · [OpenAPI](https://roborama.com/openapi.json)
|
|
85
|
+
|
|
86
|
+
## Requirements
|
|
87
|
+
|
|
88
|
+
Python ≥ 3.9. One dependency: [`httpx`](https://www.python-httpx.org/). Fully typed (`py.typed`).
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# roborama-sdk
|
|
2
|
+
|
|
3
|
+
Official Python SDK for [Roborama](https://roborama.com) — real robots as an API. Statistically defensible evaluation of robot policies on physical hardware: every result carries `n` and a 95% confidence interval, everything is versioned (robots pin firmware, environments and suites pin revisions), and both meters (robot-hours × environment-hours) are visible in every quote.
|
|
4
|
+
|
|
5
|
+
> **Status.** The API surface is a **stable draft** of [openapi.json](https://roborama.com/openapi.json); hosted execution is in **private preview**. This SDK ships a deterministic **mock mode** so you (and your agents) can integrate today — set `ROBORAMA_MOCK=1` and every call returns fixture-shaped results with honest statistics, no hardware and no API key required.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install roborama-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The distribution is `roborama-sdk`; the module is `roborama` — import statements are exactly as documented (`import roborama`).
|
|
12
|
+
|
|
13
|
+
## First call
|
|
14
|
+
|
|
15
|
+
Authentication reads `ROBORAMA_API_KEY` (keys carry the `rbr_live_` prefix) from the environment, so it's an export, not an argument.
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import roborama # reads ROBORAMA_API_KEY from the environment
|
|
19
|
+
|
|
20
|
+
run = roborama.run(
|
|
21
|
+
robot="g1-edu-pro@fw2.3", # embodiment @ pinned firmware
|
|
22
|
+
environment="kitchen-std@v1.2", # versioned catalogue scene
|
|
23
|
+
policy=roborama.Policy.checkpoint( # openpi / lerobot checkpoints,
|
|
24
|
+
hf="acme/skill-v4", # containers, or hosted endpoints
|
|
25
|
+
runtime="openpi",
|
|
26
|
+
),
|
|
27
|
+
task="load_dishwasher@v2",
|
|
28
|
+
episodes="auto(ci=0.95, moe=0.03)", # size n for ±3% at 95% — or an int
|
|
29
|
+
max_budget_usd=4_000, # hard stop, metered live
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
print(run.result())
|
|
33
|
+
# n=612 success_rate=0.874 ci95=(0.846, 0.898)
|
|
34
|
+
# failure_clusters: [grasp_slip: 41, perception_miss: 22, collision: 9]
|
|
35
|
+
# robot_hours=20.4 environment_hours=20.4 cost_usd=3812
|
|
36
|
+
# artifacts: ground_truth, mcap, report_pdf, video
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Mock mode — runnable today
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
ROBORAMA_MOCK=1 python your_script.py # or: roborama.Client(mock=True)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Mock mode is deterministic and fixture-shaped: quote math follows the [public rate card](https://roborama.com/pricing), run results are shaped like the canonical runs, `max_budget_usd` hard stops raise `roborama.BudgetExceeded` with an honest `partial_result`, and Wilson intervals are computed exactly as documented. The same code runs unchanged against the hosted API once you have a key.
|
|
46
|
+
|
|
47
|
+
## The surface
|
|
48
|
+
|
|
49
|
+
- **Primitives** (module-level, one call per physical question): `roborama.run()`, `roborama.eval()`, `roborama.verify()`, `roborama.matrix()`, `roborama.threshold()`, `roborama.compare()`, `roborama.transfer()` — plus `roborama.quote()` and `roborama.usage()`.
|
|
50
|
+
- **Resources**: `roborama.runs`, `roborama.robots`, `roborama.environments`, `roborama.suites`, `roborama.tasks`, `roborama.kits`, `roborama.streams`, `roborama.keys`, `roborama.budgets`, `roborama.data`, `roborama.calibration`, `roborama.scenarios` — with the `list()`/`get()` shapes you'd expect.
|
|
51
|
+
- **Policies**: `roborama.Policy.container(...)`, `.checkpoint(...)`, `.endpoint(...)` — declared contracts, validated before any motor moves.
|
|
52
|
+
- **Results**: `run.result()` (n, rate, ci95, clusters, both meters), `run.episodes[i]` (video, MCAP, replay spec), `run.watch()` (live), `run.export(format="lerobot")`, `run.report(format="pdf")`.
|
|
53
|
+
- **Errors**: `roborama.RoboramaError` base; every code in [the error reference](https://roborama.com/docs/errors/) maps to a subclass (`budget_exceeded` → `roborama.BudgetExceeded`, carrying `err.partial_result`).
|
|
54
|
+
|
|
55
|
+
Docs: [quickstart](https://roborama.com/docs/quickstart/) · [primitives](https://roborama.com/docs/primitives/run/) · [errors](https://roborama.com/docs/errors/) · [OpenAPI](https://roborama.com/openapi.json)
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
Python ≥ 3.9. One dependency: [`httpx`](https://www.python-httpx.org/). Fully typed (`py.typed`).
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "roborama-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official Python SDK for the Roborama API — statistically defensible evaluation of robot policies on physical hardware."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Roborama", email = "api@roborama.com" }]
|
|
14
|
+
keywords = ["robotics", "evaluation", "benchmark", "api", "sdk", "robots"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Scientific/Engineering",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
dependencies = ["httpx>=0.24"]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://roborama.com"
|
|
34
|
+
Documentation = "https://roborama.com/docs"
|
|
35
|
+
"API Reference" = "https://roborama.com/docs/api-reference"
|
|
36
|
+
OpenAPI = "https://roborama.com/openapi.json"
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = ["pytest>=7"]
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/roborama"]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.sdist]
|
|
45
|
+
include = ["src/roborama", "README.md", "LICENSE", "pyproject.toml"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
"""Roborama — real robots as an API.
|
|
2
|
+
|
|
3
|
+
Statistically defensible evaluation of robot policies on physical hardware.
|
|
4
|
+
Every result carries ``n`` and a confidence interval; everything is
|
|
5
|
+
versioned; the two meters (robot-hour × environment-hour) are visible in
|
|
6
|
+
every quote.
|
|
7
|
+
|
|
8
|
+
Authentication reads ``ROBORAMA_API_KEY`` from the environment, so it is an
|
|
9
|
+
export, not an argument::
|
|
10
|
+
|
|
11
|
+
import roborama # reads ROBORAMA_API_KEY from the environment
|
|
12
|
+
|
|
13
|
+
run = roborama.run(
|
|
14
|
+
robot="g1-edu-pro@fw2.3",
|
|
15
|
+
environment="kitchen-std@v1.2",
|
|
16
|
+
task="pick_place@v1",
|
|
17
|
+
episodes="auto(ci=0.95, moe=0.03)",
|
|
18
|
+
)
|
|
19
|
+
print(run.result()) # n=612 rate=0.874 ci95=(0.846, 0.898)
|
|
20
|
+
|
|
21
|
+
Hosted execution is in private preview. Set ``ROBORAMA_MOCK=1`` (or use
|
|
22
|
+
``roborama.Client(mock=True)``) to integrate today against a deterministic,
|
|
23
|
+
fixture-shaped mock backend — same surface, same shapes, no hardware.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from __future__ import annotations
|
|
27
|
+
|
|
28
|
+
from typing import Any, Dict, List, Optional, Union
|
|
29
|
+
|
|
30
|
+
from ._client import DEFAULT_BASE_URL
|
|
31
|
+
from ._errors import (
|
|
32
|
+
ERROR_TYPES,
|
|
33
|
+
BudgetExceeded,
|
|
34
|
+
ContractValidationFailed,
|
|
35
|
+
EnvironmentUnavailable,
|
|
36
|
+
EpisodesInvalid,
|
|
37
|
+
EstopTriggered,
|
|
38
|
+
FirmwarePinUnavailable,
|
|
39
|
+
InsufficientScope,
|
|
40
|
+
InvalidAPIKey,
|
|
41
|
+
MonthlyBudgetExceeded,
|
|
42
|
+
NotFound,
|
|
43
|
+
PolicyEndpointTimeout,
|
|
44
|
+
PublishForbidden,
|
|
45
|
+
QueueTimeout,
|
|
46
|
+
QuoteExpired,
|
|
47
|
+
RateLimited,
|
|
48
|
+
RetentionExpired,
|
|
49
|
+
RoboramaError,
|
|
50
|
+
ScenarioFormatInvalid,
|
|
51
|
+
TaskUnknown,
|
|
52
|
+
)
|
|
53
|
+
from ._models import (
|
|
54
|
+
Budget,
|
|
55
|
+
Environment,
|
|
56
|
+
Episode,
|
|
57
|
+
Export,
|
|
58
|
+
Gate,
|
|
59
|
+
InstructionRate,
|
|
60
|
+
Key,
|
|
61
|
+
Kit,
|
|
62
|
+
Pilot,
|
|
63
|
+
Policy,
|
|
64
|
+
PolicyStream,
|
|
65
|
+
PurgeReceipt,
|
|
66
|
+
Quote,
|
|
67
|
+
Report,
|
|
68
|
+
Result,
|
|
69
|
+
Robot,
|
|
70
|
+
Scenarios,
|
|
71
|
+
StageRate,
|
|
72
|
+
Stream,
|
|
73
|
+
Suite,
|
|
74
|
+
TransferReport,
|
|
75
|
+
Usage,
|
|
76
|
+
WatchEvent,
|
|
77
|
+
)
|
|
78
|
+
from ._resources import (
|
|
79
|
+
Client,
|
|
80
|
+
CompareRun,
|
|
81
|
+
EvalRun,
|
|
82
|
+
MatrixResult,
|
|
83
|
+
MatrixRun,
|
|
84
|
+
Run,
|
|
85
|
+
Task,
|
|
86
|
+
ThresholdContract,
|
|
87
|
+
TransferRun,
|
|
88
|
+
VerifyRun,
|
|
89
|
+
)
|
|
90
|
+
from ._stats import EpisodesSpec, wilson_ci
|
|
91
|
+
|
|
92
|
+
__version__ = "0.1.0"
|
|
93
|
+
|
|
94
|
+
__all__ = [
|
|
95
|
+
"__version__",
|
|
96
|
+
# primitives
|
|
97
|
+
"run",
|
|
98
|
+
"eval",
|
|
99
|
+
"verify",
|
|
100
|
+
"matrix",
|
|
101
|
+
"threshold",
|
|
102
|
+
"compare",
|
|
103
|
+
"transfer",
|
|
104
|
+
"quote",
|
|
105
|
+
"usage",
|
|
106
|
+
"gate",
|
|
107
|
+
# namespaces
|
|
108
|
+
"runs",
|
|
109
|
+
"robots",
|
|
110
|
+
"environments",
|
|
111
|
+
"suites",
|
|
112
|
+
"tasks",
|
|
113
|
+
"kits",
|
|
114
|
+
"streams",
|
|
115
|
+
"keys",
|
|
116
|
+
"budgets",
|
|
117
|
+
"data",
|
|
118
|
+
"calibration",
|
|
119
|
+
"gates",
|
|
120
|
+
"scenarios",
|
|
121
|
+
# building blocks
|
|
122
|
+
"Policy",
|
|
123
|
+
"PolicyStream",
|
|
124
|
+
"Scenarios",
|
|
125
|
+
"Client",
|
|
126
|
+
"wilson_ci",
|
|
127
|
+
"DEFAULT_BASE_URL",
|
|
128
|
+
# models
|
|
129
|
+
"Result",
|
|
130
|
+
"Quote",
|
|
131
|
+
"Usage",
|
|
132
|
+
"Budget",
|
|
133
|
+
"Robot",
|
|
134
|
+
"Environment",
|
|
135
|
+
"Suite",
|
|
136
|
+
"Episode",
|
|
137
|
+
"Export",
|
|
138
|
+
"Report",
|
|
139
|
+
"Gate",
|
|
140
|
+
"Stream",
|
|
141
|
+
"Key",
|
|
142
|
+
"Kit",
|
|
143
|
+
"Pilot",
|
|
144
|
+
"PurgeReceipt",
|
|
145
|
+
"TransferReport",
|
|
146
|
+
"StageRate",
|
|
147
|
+
"InstructionRate",
|
|
148
|
+
"WatchEvent",
|
|
149
|
+
"EpisodesSpec",
|
|
150
|
+
# handles
|
|
151
|
+
"Run",
|
|
152
|
+
"Task",
|
|
153
|
+
"CompareRun",
|
|
154
|
+
"EvalRun",
|
|
155
|
+
"VerifyRun",
|
|
156
|
+
"MatrixRun",
|
|
157
|
+
"MatrixResult",
|
|
158
|
+
"ThresholdContract",
|
|
159
|
+
"TransferRun",
|
|
160
|
+
# errors
|
|
161
|
+
"RoboramaError",
|
|
162
|
+
"InvalidAPIKey",
|
|
163
|
+
"InsufficientScope",
|
|
164
|
+
"NotFound",
|
|
165
|
+
"PublishForbidden",
|
|
166
|
+
"RateLimited",
|
|
167
|
+
"ContractValidationFailed",
|
|
168
|
+
"FirmwarePinUnavailable",
|
|
169
|
+
"EnvironmentUnavailable",
|
|
170
|
+
"TaskUnknown",
|
|
171
|
+
"ScenarioFormatInvalid",
|
|
172
|
+
"EpisodesInvalid",
|
|
173
|
+
"QuoteExpired",
|
|
174
|
+
"BudgetExceeded",
|
|
175
|
+
"MonthlyBudgetExceeded",
|
|
176
|
+
"QueueTimeout",
|
|
177
|
+
"PolicyEndpointTimeout",
|
|
178
|
+
"EstopTriggered",
|
|
179
|
+
"RetentionExpired",
|
|
180
|
+
"ERROR_TYPES",
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
_default_client: Optional[Client] = None
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def default_client() -> Client:
|
|
187
|
+
"""The lazily created client behind the module-level surface."""
|
|
188
|
+
|
|
189
|
+
global _default_client
|
|
190
|
+
if _default_client is None:
|
|
191
|
+
_default_client = Client()
|
|
192
|
+
return _default_client
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class _NamespaceProxy:
|
|
196
|
+
"""Binds a module-level namespace (``roborama.runs`` …) to the lazy default client."""
|
|
197
|
+
|
|
198
|
+
def __init__(self, attr: str) -> None:
|
|
199
|
+
self._attr = attr
|
|
200
|
+
|
|
201
|
+
def __getattr__(self, name: str) -> Any:
|
|
202
|
+
return getattr(getattr(default_client(), self._attr), name)
|
|
203
|
+
|
|
204
|
+
def __repr__(self) -> str:
|
|
205
|
+
return f"<roborama.{self._attr}>"
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
runs = _NamespaceProxy("runs")
|
|
209
|
+
robots = _NamespaceProxy("robots")
|
|
210
|
+
environments = _NamespaceProxy("environments")
|
|
211
|
+
suites = _NamespaceProxy("suites")
|
|
212
|
+
tasks = _NamespaceProxy("tasks")
|
|
213
|
+
kits = _NamespaceProxy("kits")
|
|
214
|
+
streams = _NamespaceProxy("streams")
|
|
215
|
+
keys = _NamespaceProxy("keys")
|
|
216
|
+
budgets = _NamespaceProxy("budgets")
|
|
217
|
+
data = _NamespaceProxy("data")
|
|
218
|
+
calibration = _NamespaceProxy("calibration")
|
|
219
|
+
gates = _NamespaceProxy("gates")
|
|
220
|
+
scenarios = _NamespaceProxy("scenarios")
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def run(
|
|
224
|
+
robot: str,
|
|
225
|
+
environment: str,
|
|
226
|
+
task: str,
|
|
227
|
+
policy: Optional[Union[Policy, Dict[str, Any]]] = None,
|
|
228
|
+
episodes: EpisodesSpec = "auto(ci=0.95, moe=0.03)",
|
|
229
|
+
perturbation: Optional[Dict[str, Any]] = None,
|
|
230
|
+
data: Optional[Dict[str, Any]] = None,
|
|
231
|
+
priority: Optional[str] = None,
|
|
232
|
+
max_budget_usd: Optional[float] = None,
|
|
233
|
+
interventions: Optional[str] = None,
|
|
234
|
+
**extra: Any,
|
|
235
|
+
) -> Run:
|
|
236
|
+
"""One statistically defensible answer on physical hardware.
|
|
237
|
+
|
|
238
|
+
``episodes`` is a positive int or ``auto(ci=..., moe=...)``, which sizes
|
|
239
|
+
n for a target margin of error. ``max_budget_usd`` is a hard stop,
|
|
240
|
+
metered live.
|
|
241
|
+
"""
|
|
242
|
+
|
|
243
|
+
return default_client().run(
|
|
244
|
+
robot=robot,
|
|
245
|
+
environment=environment,
|
|
246
|
+
task=task,
|
|
247
|
+
policy=policy,
|
|
248
|
+
episodes=episodes,
|
|
249
|
+
perturbation=perturbation,
|
|
250
|
+
data=data,
|
|
251
|
+
priority=priority,
|
|
252
|
+
max_budget_usd=max_budget_usd,
|
|
253
|
+
interventions=interventions,
|
|
254
|
+
**extra,
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def eval( # noqa: A001 - documented public name
|
|
259
|
+
policy: Union[Policy, Dict[str, Any]],
|
|
260
|
+
suite: str,
|
|
261
|
+
robots: List[str],
|
|
262
|
+
publish: str = "private",
|
|
263
|
+
**extra: Any,
|
|
264
|
+
) -> EvalRun:
|
|
265
|
+
"""Run a frozen, versioned suite; returns a citable attestation."""
|
|
266
|
+
|
|
267
|
+
return default_client().eval(
|
|
268
|
+
policy=policy, suite=suite, robots=robots, publish=publish, **extra
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def verify(
|
|
273
|
+
policy: Union[Policy, Dict[str, Any]],
|
|
274
|
+
scenarios: Union[Scenarios, Dict[str, Any]],
|
|
275
|
+
robots: List[str],
|
|
276
|
+
task: Optional[str] = None,
|
|
277
|
+
audit_sample: Optional[float] = None,
|
|
278
|
+
return_ground_truth: Optional[bool] = None,
|
|
279
|
+
**extra: Any,
|
|
280
|
+
) -> VerifyRun:
|
|
281
|
+
"""Physically verify the scenarios your simulator flagged."""
|
|
282
|
+
|
|
283
|
+
return default_client().verify(
|
|
284
|
+
policy=policy,
|
|
285
|
+
scenarios=scenarios,
|
|
286
|
+
robots=robots,
|
|
287
|
+
task=task,
|
|
288
|
+
audit_sample=audit_sample,
|
|
289
|
+
return_ground_truth=return_ground_truth,
|
|
290
|
+
**extra,
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def matrix(
|
|
295
|
+
policy: Union[Policy, Dict[str, Any]],
|
|
296
|
+
robots: List[str],
|
|
297
|
+
environments: List[str],
|
|
298
|
+
task: str,
|
|
299
|
+
episodes_per_cell: EpisodesSpec = "auto(ci=0.95, moe=0.05)",
|
|
300
|
+
interventions: Optional[str] = None,
|
|
301
|
+
**extra: Any,
|
|
302
|
+
) -> MatrixRun:
|
|
303
|
+
"""The embodiment × environment sweep behind a cross-embodiment claim."""
|
|
304
|
+
|
|
305
|
+
return default_client().matrix(
|
|
306
|
+
policy=policy,
|
|
307
|
+
robots=robots,
|
|
308
|
+
environments=environments,
|
|
309
|
+
task=task,
|
|
310
|
+
episodes_per_cell=episodes_per_cell,
|
|
311
|
+
interventions=interventions,
|
|
312
|
+
**extra,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def threshold(
|
|
317
|
+
policy_stream: Union[PolicyStream, Dict[str, Any]],
|
|
318
|
+
target: Dict[str, Any],
|
|
319
|
+
iterate_on: str,
|
|
320
|
+
escalate_to: str,
|
|
321
|
+
monthly_cap_usd: Optional[float] = None,
|
|
322
|
+
**extra: Any,
|
|
323
|
+
) -> ThresholdContract:
|
|
324
|
+
"""An outcome contract: push checkpoints, receive physical verdicts."""
|
|
325
|
+
|
|
326
|
+
return default_client().threshold(
|
|
327
|
+
policy_stream=policy_stream,
|
|
328
|
+
target=target,
|
|
329
|
+
iterate_on=iterate_on,
|
|
330
|
+
escalate_to=escalate_to,
|
|
331
|
+
monthly_cap_usd=monthly_cap_usd,
|
|
332
|
+
**extra,
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def compare(
|
|
337
|
+
policies: Dict[str, Union[Policy, Dict[str, Any]]],
|
|
338
|
+
robot: str,
|
|
339
|
+
task: str,
|
|
340
|
+
paired: bool = True,
|
|
341
|
+
**extra: Any,
|
|
342
|
+
) -> CompareRun:
|
|
343
|
+
"""Paired A/B on the same initial conditions — halves the n you need."""
|
|
344
|
+
|
|
345
|
+
return default_client().compare(
|
|
346
|
+
policies=policies, robot=robot, task=task, paired=paired, **extra
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def transfer(
|
|
351
|
+
policy: Union[Policy, Dict[str, Any]],
|
|
352
|
+
source: str,
|
|
353
|
+
target: str,
|
|
354
|
+
task: str,
|
|
355
|
+
**extra: Any,
|
|
356
|
+
) -> TransferRun:
|
|
357
|
+
"""Quantify the embodiment transfer gap, source vs. target."""
|
|
358
|
+
|
|
359
|
+
return default_client().transfer(
|
|
360
|
+
policy=policy, source=source, target=target, task=task, **extra
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def quote(
|
|
365
|
+
robot: str,
|
|
366
|
+
environment: str,
|
|
367
|
+
episodes: EpisodesSpec,
|
|
368
|
+
priority: Optional[str] = None,
|
|
369
|
+
) -> Quote:
|
|
370
|
+
"""Both meters, dollars, and a queue ETA — before you commit."""
|
|
371
|
+
|
|
372
|
+
return default_client().quote(
|
|
373
|
+
robot=robot, environment=environment, episodes=episodes, priority=priority
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def usage(period: Optional[str] = None) -> Usage:
|
|
378
|
+
"""Metered usage for a period (``YYYY-MM``): hours by tier, dollars, budget."""
|
|
379
|
+
|
|
380
|
+
return default_client().usage(period=period)
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def gate(
|
|
384
|
+
on: str,
|
|
385
|
+
suite: str,
|
|
386
|
+
robots: List[str],
|
|
387
|
+
fail_if: Dict[str, Any],
|
|
388
|
+
) -> Gate:
|
|
389
|
+
"""Register a CI gate: run the suite on matching refs, fail on regression."""
|
|
390
|
+
|
|
391
|
+
return default_client().gate(on=on, suite=suite, robots=robots, fail_if=fail_if)
|