Quick Start
Verdict tells you, in real time, whether your robot succeeded or failed at each task.
Install
Python 3.9+. The package is intuition-sdk; the import name is intuition.
pip install --index-url https://mirrors.aliyun.com/pypi/simple/ \ --extra-index-url https://intuition-robot-monitor.oss-cn-shanghai.aliyuncs.com/dl/simple/ \ --trusted-host mirrors.aliyun.com \ intuition-sdk
Full install options are in section 1 below.
Get your API key
Stream, then read the verdict
import intuition
robot = intuition.Robot(
api_key="ak_XXXXXXXXXXXXXXXX", # ← your key from the dashboard
name="robot-01", # ← a name for THIS robot
server="http://<your-relay>:8080", # ← your cloud URL (on the dashboard)
)
robot.attach_video("env", device="test:") # ← synthetic test pattern, no camera needed
robot.run() # stream + live dashboard; Ctrl-C to stop
# read the verdict from anywhere in your code:
s = robot.status()
if s and s.latest.verdict == "fail":
stop_the_line()device="test:" runs with zero hardware.
What you'll see
SESSION 0 cycles waiting for the first verdict…
cameras env● ~7s/cycle Ctrl-C to stop & save
An empty verdict list is normal at first — verdicts appear once a reviewer marks a cycle.
What's next
- Use a real camera — intuition detect
- Attach all 3 cameras
- Bind each verdict to a part
- Wire verdicts into your backend / MES
Time to first verdict: about 5 minutes — full reference below.
1 · Install
Distribution name intuition-sdk, import name intuition.
pip install --index-url https://mirrors.aliyun.com/pypi/simple/ \ --extra-index-url https://intuition-robot-monitor.oss-cn-shanghai.aliyuncs.com/dl/simple/ \ --trusted-host mirrors.aliyun.com \ intuition-sdk
pip install intuition
— that is a different, abandoned package. Always install intuition-sdk from our index.
Verify the install:
intuition --version
2 · Find your camera
List every capture device on this machine:
intuition detect
The device argument is cross-platform:
/dev/video0or"0"on Linux"0"on macOS- the friendly device name on Windows
"test:"— synthetic test pattern, no camera needed
Run the doctor to check ffmpeg / encoders / SRT / server reachability:
intuition doctor --server http://<your-relay>:8080
3 · Create the Robot + attach cameras
A Robot is one machine identified by its name.
import intuition
robot = intuition.Robot(
api_key="ak_XXXXXXXXXXXXXXXX", # ← your API key from the dashboard
name="robot-01", # ← a name for THIS robot (reuse it to keep history)
server="http://<your-relay>:8080", # ← your cloud URL (shown on the dashboard)
)
robot.attach_video("env", device="0") # workspace cam (Linux also /dev/video0)
robot.attach_video("wrist_l", device="1") # left wrist cam
robot.attach_video("wrist_r", device="2") # right wrist cam
# No camera yet? use device="test:" for a synthetic test pattern.
# options (defaults): width=1280, height=720 (auto-probed), fps=30, bitrate_kbps=4000Camera options
input_format="h264"— native-H.264 copy path.encoder="auto"(default) hardware-first, software fallback.
attach_video() returns the Robot (chainable).
4 · Stream with run()
run() streams every camera and blocks until Ctrl-C, showing a live dashboard:
robot.run() # blocks; Ctrl-C to stop and save this run's verdicts
✔ SUCCESS SN-48213 · 3s ago SESSION 48 cycles ✔44 ✘3 ⚠1 success 93.6% streak ✔5 worst run ✘✘ SN-48207–SN-48208 RECENT ✔ ✔ ✘ ✔ ✔ ✔ ⚠ ✔ ✔ ✔ (last 10) time cycle verdict 14:22:01 SN-48213 ✔ success 14:21:44 SN-48212 ✘ fail 14:21:29 SN-48211 ✔ success cameras env● wrist_l● wrist_r● ~7s/cycle Ctrl-C to stop & save
On Ctrl-C it saves a CSV + JSON of this run.
run() options
run()— stream + dashboard, block, export.run(status=False)— stream only.run(block=False)— return immediately.run(poll_interval=2.0)— verdict poll interval.run(export_dir="…")— export folder.
5 · Read the verdict
robot.status() returns a dot+dict object, or None if no verdict yet.
s = robot.status() # snapshot; None until the first verdict
if s and s.latest.verdict == "fail": # same as s["latest"]["verdict"]
print("last cycle failed:", s.latest.cycle_id)
print("success rate:", s.success_rate) # 0.0 – 1.0
print("totals:", s.totals.fail, "fail /", s.totals.total, "total")Status object shape
| Field | Type | Meaning |
|---|---|---|
| robot_id | str | Cloud id. |
| cameras | list | Camera names. |
| latest.verdict | success | fail | uncertain | None | Newest verdict (None until first). |
| latest.ts | str | None | Timestamp. |
| latest.cycle_id | str | None | Cycle id. |
| latest.source | str | None | "human" now, model id later. |
| history | list | Past verdicts; sort by ts if needed. |
| success_rate | float | Success ratio. |
| totals | {success, fail, uncertain, total} | Counts. |
| streak | {verdict, length} | Current streak. |
Live polling with .latest
robot.latest is safe to poll in a loop:
import time
while True:
if robot.latest.verdict == "fail": # None until the first verdict
stop_the_line()
time.sleep(2)It is a real dict — json.dumps(s) works.
6 · Cycles & part serial
Wrap each task in robot.cycle() with your own part_serial:
with robot.cycle(part_serial="SN-48213"):
run_one_task() # the verdict for this cycle binds to SN-48213
# Or open / close explicitly:
cid = robot.begin_cycle(part_serial="SN-48214") # returns the cycle_id
run_one_task()
robot.end_cycle()cycle() constructs; begin_cycle() opens + returns id; emitting is fail-open.
7 · Backend / MES integration
Poll from your backend using the same ak_ key.
import intuition, time
# A read-only loop: the SAME account key (ak_) — one key streams and reads.
robot = intuition.Robot(api_key="ak_XXXXXXXXXXXXXXXX", name="robot-01",
server="http://<your-relay>:8080")
seen = None
while True:
v = robot.latest
if v.cycle_id and v.cycle_id != seen: # a new judged cycle
seen = v.cycle_id
if v.verdict == "fail":
open_reject_bin(v.cycle_id) # your action
elif v.verdict == "success":
pass_to_next_station(v.cycle_id)
time.sleep(2)Prefer raw HTTP? One GET with your API key:
curl -H "Authorization: Bearer ak_XXXXXXXXXXXXXXXX" \ "http://<your-relay>:8080/v1/status?robot_name=robot-01"
8 · CLI reference
| Command | What it does |
|---|---|
| intuition detect | List capture devices (--json for machine output). |
| intuition doctor | Check ffmpeg / encoders / SRT / server. |
| intuition --version | Print the SDK version. |
9 · Configuration
| Variable | Effect |
|---|---|
| INTUITION_SERVER | Default server when server= is omitted. |
| INTUITION_EXPORT_DIR | Export folder for run(). |
| INTUITION_NO_STATUS | Disable the live dashboard. |
| INTUITION_NO_PROBE | Skip capture-mode probing. |
| INTUITION_FFMPEG | Path to a specific ffmpeg binary. |
| srt_latency_ms=120 | SRT latency buffer (ms). |
| protocol="srt" | Informational; transport auto-picked. |
import os, intuition
robot = intuition.Robot(api_key=os.environ["INTUITION_API_KEY"],
name="robot-01", server=os.environ["INTUITION_SERVER"])10 · Errors & troubleshooting
Exceptions
| Exception | When |
|---|---|
| AuthError | ak_ rejected (401 on /v1/claim). |
| ClaimError | Server unreachable / wrong URL. |
| IntuitionError | Base class (e.g. no cameras attached). |
try:
robot.run()
except intuition.AuthError:
print("bad key — copy the ak_ key again from the dashboard")
except intuition.ClaimError:
print("cannot reach the cloud — check server= and your network")Common problems
- pip finds nothing → use the section-1 command with intuition-sdk.
- No cameras → intuition detect, or device="test:".
- ffmpeg missing → intuition doctor; set INTUITION_FFMPEG.
- Blank dashboard → verdicts appear after a reviewer marks a cycle.
11 · Security
Your account has ONE API key (ak_) — it streams and reads.
- One key streams + reads; rotatable on the dashboard.
- Video is AES-encrypted over SRT when supported.
- Never commit your key; rotate on leak.
- Give the key only to systems that need it; read it from an env var.