A Python programming model and runtime for closed-loop robot agents whose perception, planning, and control run at different rates.
Project description
Programming Closed-Loop Modular Robot Agents
A Python programming model and runtime for robot agents whose perception, planning, and control run at different rates. You write down how often each part runs and how it handles data that arrives out of sync, so the timing lives in the graph instead of in hand-written glue code — and any run can be recorded and replayed exactly.
Retriever is the core/runtime package for typed, multi-rate robot pipelines. Robot applications rarely run as one neat synchronous loop: cameras, state estimators, planners, VLMs, VLAs, controllers, operators, and logs all update at different rates. Retriever makes those timing boundaries explicit while keeping the authoring model close to normal Python.
Use Retriever when a robot system needs:
- Closed loops: perception, memory, planning, control, monitoring, and even environment wrappers can live in one cyclic graph.
- Explicit timing: each
Flowdeclares when it runs, and each edge declares how data is sampled beforestep(...)executes. - Debuggable execution: run the graph on a backend, or step it in-process with normal Python breakpoints.
- Portable backends: author one typed graph, then run it in-process, with multiprocessing, or on a distributed backend.
- Reusable components: typed payloads, registries, and Hub surfaces make robot software easier to publish and compose.
System-level robot integrations, simulator stacks, and heavier model packages belong in the maintained reference examples layer: GoldenRetriever and Retriever Hub packs. This repository stays focused on the runtime core.
The authoring style is intentionally close to functional reactive programming: compose small stateful stream functions, make time explicit, and put the sampling rule on the edge. In day-to-day code, .then(...) is the fluent composition surface; retriever.connect(...) is the same edge written as a standalone function.
Canonical Runtime Workflow
from retriever import Flow, Latest, Pipeline, Rate, Trigger, io
@io
class Number:
value: int
@io
class Doubled:
value: int
class Source(Flow[None, Number]):
def __init__(self) -> None:
super().__init__()
self.count = 0
def step(self, _): # type: ignore[override]
self.count += 1
return Number(value=self.count)
class Double(Flow[Number, Doubled]):
def step(self, input: Number) -> Doubled:
return Doubled(value=input.value * 2)
pipe = Pipeline("quickstart")
with pipe:
source = Source() @ Rate(hz=2)
double = Double() @ Trigger("value")
source.then(double, sync=Latest())
pipe.run(backend="multiprocessing", duration=1.0)
The important pieces are small:
@iodefines typed message envelopes.Flow[I, O]defines node logic.flow @ clockdeclares when a node runs.source.then(target, sync=...)wires a Flow-to-Flow edge in the fluent style.retriever.connect(source, target, sync=...)is the explicit equivalent when chaining is not the clearest shape.Pipeline.run(...)executes on a backend.Pipeline.step(...)runs in-process for debugging and replay.
Install
Use Python 3.11 or newer.
The public package target is retriever-core; the Python import package and executable command are both retriever:
python -m pip install retriever-core
retriever --version
retriever init my-retriever-app --bootstrap-pixi
cd my-retriever-app
retriever run hello
For repository demos, clone the source checkout because the example files, graph renderers, and visualization assets live in the repository. With retriever-core installed, run everything through the retriever command:
git clone https://github.com/openretriever/retriever
cd retriever
retriever install --bootstrap-pixi
retriever run webcam-mock
retriever run webcam
retriever run webcam-mock runs camera -> color detector -> display with
synthetic frames and stdout, so it works on headless machines and in agent
runs. retriever run webcam requests a real webcam and uses --visualize auto
so Rerun is used when available and stdout is used otherwise. Hold red or blue
paper/objects in front of the camera to see detections.
Useful follow-up commands from the source checkout:
retriever run basic-flow
retriever run rt-execution
retriever run stepper
retriever run record
retriever tasks
retriever run <name> is the stable command surface for examples and diagnostics. Curated names (webcam-mock, stepper, record, …) are the public path; raw repository task names still work with retriever run <task> as a source-checkout escape hatch.
Step And Checkpoint Graphs
Checkpointable graph debugging is a Python API, not a separate CLI namespace. Define the graph in Python, inspect or render its IR, then step it in-process with normal breakpoints and your own checkpoint artifact:
import json
from pathlib import Path
pipe.validate()
for i in range(10):
result = pipe.step(dt=0.1)
checkpoint = {"now": result.now, "executed": result.executed}
Path(f"checkpoint-{i:03d}.json").write_text(json.dumps(checkpoint, indent=2))
pipe.close_stepper()
Python is the executable source of truth. Saved IR/HTML is the portable graph description for inspection and reproducibility; executing directly from saved IR should remain a future, versioned contract rather than the default promise.
Retriever Hub
Hub loads a module by name from a public repo — no clone, no checkout. Install the debug runtime plus Rerun, then run a 60-second live webcam demo in one line:
python -m pip install "debug-retriever[demo]==0.1.8" rerun-sdk && retriever demo webcam --seconds 60 --visualize rerun --refresh
hub.use(...) fetches the openretriever/webcam-demo
pack, checks its dependencies, and drives a Camera -> ColorDetector -> Rerun
closed loop over your webcam with image and bounding-box overlays. Use
--visualize stdout for terminal-only output or --visualize both for Rerun plus
stdout.
Hub refs are ordinary strings: {org}/{name}[:Export][@version]. Use the CLI to validate the ref shape offline, inspect a module through the same loader as hub.use(...), and locate the local cache:
retriever hub parse openretriever/hello-world:HelloFlow
retriever hub inspect openretriever/hello-world --json
retriever hub cache-dir
hub inspect may fetch from the Hub index and GitHub unless the module is already cached. Use retriever --dry-run hub inspect <ref> when you only want to check the ref shape without network access. In Python, load the same export with from retriever import hub; hub.use("openretriever/hello-world:HelloFlow").
Documentation Path
The hosted Starlight docs are the public docs front door:
- Overview — recommended path.
- Install — package target and source-checkout commands.
- Visual Quickstart — mock smoke, webcam color detection, and Rerun.
- Examples and Results — commands paired with expected output.
- Debug and Visualize — graph render, stepper, record, and replay.
- GoldenRetriever Overview — GoldenRetriever as the applied examples and reference-pack layer.
- GoldenRetriever Example Catalog — applied perception, memory, language, composition, simulation, visualization, and typing guides.
The repository docs/ tree remains available for deeper source-local reference
and release maintenance.
Source code lives at github.com/openretriever/retriever. GoldenRetriever source lives at github.com/openretriever/golden-retriever, but most users should start from the hosted GoldenRetriever example catalog.
Runtime Surfaces
Retriever has two execution modes on purpose:
# Backend execution
pipe.run(backend="multiprocessing", duration=3.0)
pipe.run(backend="dora", duration=3.0)
# In-process debugging
result = pipe.step(dt=0.1)
print(result.executed)
pipe.close_stepper()
Backend execution is for realistic scheduling, process boundaries, and deployment behavior. In-process stepping is for debugging logic, replaying incidents, and making timing bugs inspectable with normal Python tools.
Ecosystem Boundary
The intended public split is:
- Core runtime: this repository, published as
retriever-coreand imported asretriever. - GoldenRetriever examples: GoldenRetriever for robot-facing examples and pack candidates.
- Project website: openretriever.org.
Development
Contributor tasks run through the same retriever command from a source
checkout:
retriever install # set up the environment
retriever run test # full test suite
retriever run p0-release-readiness
retriever run public-surface-check # external launch check before announcing
The source checkout uses Pixi as its environment and task
backend, and retriever run <task> wraps it. For focused test subsets, run
pytest in the environment directly:
pixi run python -m pytest tests/core/test_public_surface_rt.py -q
pixi run python -m pytest tests/core/test_hub_ref_rt.py tests/core/test_hub_check_rt.py tests/core/test_hub_loader_rt.py tests/core/test_hub_use_rt.py -q
See docs/contributing.md for the full development workflow.
Clone and Stay in Sync
git clone https://github.com/openretriever/retriever
cd retriever
git pull # normal pulls fast-forward
main is the canonical branch; a fresh clone and ordinary git pull are all you need.
License
Retriever is licensed under the Apache License 2.0 (Apache-2.0). See LICENSE for the full license text and THIRD_PARTY_NOTICES.md for bundled third-party JavaScript notices.
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 debug_retriever-0.1.8.tar.gz.
File metadata
- Download URL: debug_retriever-0.1.8.tar.gz
- Upload date:
- Size: 421.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0f9a6d7af51e103c6afbfb13259ffd62e963e79e8b7771d25ec6c16bd3432fb
|
|
| MD5 |
24f15f553a56a0be6d298916274bbd17
|
|
| BLAKE2b-256 |
1e47a8986f93b74138051f5fd4e1f164eda7145aec93bd102d4515ce03fb0869
|
File details
Details for the file debug_retriever-0.1.8-py3-none-any.whl.
File metadata
- Download URL: debug_retriever-0.1.8-py3-none-any.whl
- Upload date:
- Size: 477.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
250a67a97a03f85caba937599e82079db2d934401aad311e2022e735eef7e648
|
|
| MD5 |
d6e8fb8c11dca27392b120eeef0eceef
|
|
| BLAKE2b-256 |
cc2f9ba6cb76729dec6eed3af89baeeb77afba73497878216478105faeb555e6
|