Skip to main content

A Python programming model and runtime for closed-loop robot agents whose perception, planning, and control run at different rates.

Project description

Retriever logo


Retriever

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.

Docs Website Source
GoldenRetriever examples Hub packs License


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 Flow declares when it runs, and each edge declares how data is sampled before step(...) 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:

  • @io defines typed message envelopes.
  • Flow[I, O] defines node logic.
  • flow @ clock declares 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 runtime, then run a live webcam demo in one line:

pip install "retriever-core[demo]"
python -c "from retriever import hub; hub.use('openretriever/webcam-demo:run')()"

hub.use(...) fetches the openretriever/webcam-demo pack, checks its dependencies, and hands back the run function, which drives a Camera -> ColorDetector -> Display closed loop over your webcam.

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:

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-core and imported as retriever.
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debug_retriever-0.1.6.tar.gz (420.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debug_retriever-0.1.6-py3-none-any.whl (476.1 kB view details)

Uploaded Python 3

File details

Details for the file debug_retriever-0.1.6.tar.gz.

File metadata

  • Download URL: debug_retriever-0.1.6.tar.gz
  • Upload date:
  • Size: 420.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for debug_retriever-0.1.6.tar.gz
Algorithm Hash digest
SHA256 bd4af33c7c59ba509bc1d38b601a0e771f097a0d150f7e8e4eb7a701057a92ef
MD5 99c949b26d1ea32b1da25dbeef38f7ae
BLAKE2b-256 9d8318cbd3a561543c5869ec249318b5c61e7fa8eb04555e3762e1fe5ab83437

See more details on using hashes here.

File details

Details for the file debug_retriever-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for debug_retriever-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7d4e2d1ae9faa996f678f8fe4ff8b26b0d29e128844b3507d9e05612c9476125
MD5 4188025d2d43ff15fd88180950beeabf
BLAKE2b-256 576ea5d7cbf5a1598c242e86a8f200af25f8ba375b4698b74de121a92ca76b03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page