Python SDK
Deployments, sessions, robots
Programmatic equivalents of reflex deploy, reflex sessions, and reflex robots.
These helpers mirror the CLI command groups and return plain dicts. They all
accept api_key= and convex_url= overrides.
Deployments
import reflex
deployment = reflex.create_deployment(
name="kitchen-policy-v3",
model_id="model_abc123",
)
reflex.run_deployment_doctor(deployment["id"])| Function | Description |
|---|---|
create_deployment(*, name, model_id, robot_schema_id=None, runtime=None, mode="dry_run", spec=None) | Create a deployment. |
create_deployment_from_spec(path) | Create from a JSON/YAML spec file. |
list_deployments() | List deployments. |
get_deployment(deployment_id) | Fetch one deployment. |
run_deployment_doctor(deployment_id) | Readiness check (CLI: reflex doctor). |
Sessions
authorize_session is low-level — it returns a grant (a session id plus a
scoped credential for driving your own transport). Most users want
reflex connect or
run_from_config instead.
grant = reflex.authorize_session(
deployment_id="deploy_abc123",
robot_id="robot_xyz789",
mode="dry_run",
)
session_id = grant["sessionId"]
# ...later
reflex.promote_session(session_id, mode="apply_actions")
reflex.close_session(session_id)| Function | Description |
|---|---|
authorize_session(*, artifact_id=None, deployment_id=None, robot_id=None, base_model="pi0.5", runtime=None, mode="dry_run", client_session_id=None) | Authorize a session; returns {sessionId, ...} plus a scoped credential. Low-level. |
promote_session(session_id, *, mode="apply_actions") | Promote dry_run → apply_actions. |
close_session(session_id, *, reason="sdk_closed") | Close the session. |
list_sessions(*, status=None) | List sessions. |
Robots
schema = reflex.register_robot_schema(
name="so101-v1",
schema="./so101.schema.json",
)
robot = reflex.register_robot(
name="lab-arm-01",
robot_schema_id=schema["id"],
)
token = reflex.create_pairing_token(robot["id"], ttl_seconds=600)| Function | Description |
|---|---|
register_robot_schema(*, name, schema, robot_kind=None) | Register a schema (YAML/JSON path or dict). |
list_robot_schemas() | List schemas. |
register_robot(*, name, robot_schema_id, robot_kind=None, calibration_id=None) | Register a physical robot. |
list_robots() | List robots. |
create_pairing_token(robot_id, *, ttl_seconds=None) | Mint a pairing token. |
claim_pairing_token(token) | Claim a pairing token from the robot side. |
heartbeat_robot(robot_id, *, session_id=None, deployment_id=None, ...) | Report a heartbeat for a connected robot. |
Receipts
for r in reflex.list_receipts(deployment_id="deploy_abc123")["receipts"]:
print(r["id"], r["timestamp"])