Skip to main content

The Universal Runtime for Embodied AI

Project description

OpenCastor

OpenCastor

The Universal Runtime for Embodied AI

PyPI CI License Python Discord

56,006 lines of code ยท 2,233 tests ยท Python 3.10โ€“3.12
Connect any AI model to any robot hardware through a single YAML config.


๐Ÿš€ Install in 10 Seconds

curl -sL opencastor.com/install | bash
Other platforms

Windows 11 (PowerShell):

irm https://raw.githubusercontent.com/craigm26/OpenCastor/main/scripts/install.ps1 | iex

Docker:

docker compose up

Manual:

git clone https://github.com/craigm26/OpenCastor.git
cd OpenCastor
python3 -m venv venv && source venv/bin/activate
pip install -e ".[dev]"

Supports Linux, macOS (Apple Silicon & Intel), Windows 11, Raspberry Pi, Docker. Installer flags: --dry-run, --no-rpi, --skip-wizard

โœจ What's New in v2026.2.20.10

  • 8 AI providers โ€” Anthropic, Google, OpenAI, HuggingFace, Ollama, llama.cpp, MLX, Claude OAuth proxy
  • Tiered brain architecture โ€” reactive rules โ†’ fast inference โ†’ deep planning
  • Hailo-8 NPU vision โ€” on-device YOLOv8 object detection at ~250ms
  • OAK-D stereo depth camera โ€” RGB + depth via DepthAI v3
  • Community Hub โ€” browse, install, and share robot recipes with castor hub
  • Interactive wizard โ€” provider selection, auth, messaging setup with recall of previous choices
  • castor doctor โ€” full system health diagnostic

๐Ÿ”„ Self-Improving Loop (Sisyphus Pattern)

Your robot learns from its mistakes. After each task, the Sisyphus Loop analyzes what happened, identifies failures, generates fixes, verifies them, and applies improvements automatically.

Episode โ†’ PM (Analyze) โ†’ Dev (Patch) โ†’ QA (Verify) โ†’ Apply
  • Disabled by default โ€” opt-in via castor wizard or YAML config
  • 4 cost tiers โ€” from $0 (local Ollama) to ~$5-15/mo (Claude)
  • Auto-apply preferences โ€” config tuning only, behavior rules, or manual review
  • Rollback โ€” undo any improvement with castor improve --rollback <id>
  • ALMA consolidation โ€” cross-episode pattern analysis for deeper learning
castor improve --episodes 10    # Analyze last 10 episodes
castor improve --status         # View improvement history

๐Ÿง  Tiered Brain Architecture

OpenCastor doesn't send every decision to a $0.015/request cloud API. Instead, it routes through three layers โ€” only escalating when needed:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    MESSAGING LAYER                       โ”‚
โ”‚         WhatsApp ยท Telegram ยท Discord ยท Slack            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   API GATEWAY                            โ”‚
โ”‚            FastAPI ยท REST ยท Webhooks ยท JWT               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚               TIERED BRAIN STACK                         โ”‚
โ”‚                                                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Layer 3: PLANNER         Claude Opus ยท ~12s       โ”‚  โ”‚
โ”‚  โ”‚  Complex reasoning, multi-step plans, novel tasks  โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  Layer 2: FAST BRAIN      HF / Gemini ยท ~500ms    โ”‚  โ”‚
โ”‚  โ”‚  Classification, simple Q&A, routine decisions     โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  Layer 1: REACTIVE        Rule engine ยท <1ms       โ”‚  โ”‚
โ”‚  โ”‚  Obstacle stop, boundary enforce, emergency halt   โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  PERCEPTION                              โ”‚
โ”‚  Hailo-8 NPU (YOLOv8) ยท OAK-D Depth ยท Camera ยท IMU    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚               RCAN SAFETY KERNEL                         โ”‚
โ”‚    Physical bounds ยท Anti-subversion ยท Audit chain       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  DRIVER LAYER                            โ”‚
โ”‚       PCA9685 ยท Dynamixel ยท GPIO ยท Serial ยท I2C         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                  [ YOUR ROBOT ]

Cost-effective by default. The reactive layer handles 80% of decisions at zero cost. The fast brain handles another 15%. The planner only fires for genuinely complex tasks.

๐Ÿค– Supported AI Providers

Provider Models Latency Best For
Anthropic claude-opus-4-6, claude-sonnet-4-5 ~12s Complex planning, safety-critical reasoning
Google gemini-2.5-flash, gemini-2.5-pro, gemini-3-flash-preview ~500ms Multimodal, video, speed
OpenAI gpt-4.1, gpt-4.1-mini, gpt-5 ~2s Instruction following, 1M context
HuggingFace Transformers, any hosted model ~500ms Fast brain layer, classification
Ollama llava:13b, any local model Varies Privacy, offline, zero cost
llama.cpp GGUF models ~200ms Edge inference, Raspberry Pi
MLX Apple Silicon native (mlx-lm, vLLM-MLX) ~50ms Mac M1-M4, 400+ tok/s
Claude OAuth Proxy-authenticated Claude ~12s Team/org deployments

Swap providers with one YAML change:

agent:
  provider: "anthropic"
  model: "claude-opus-4-6"

๐Ÿ‘๏ธ Vision & Perception

Hailo-8 NPU โ€” On-Device Object Detection

No cloud API calls needed. The Hailo-8 neural processing unit runs YOLOv8 locally:

  • 80 COCO object classes โ€” people, vehicles, animals, furniture, and more
  • ~250ms inference โ€” fast enough for real-time obstacle avoidance
  • Zero API cost โ€” all processing happens on the edge

OAK-D Stereo Depth Camera

RGB + depth streaming via DepthAI v3. Get 3D spatial awareness for navigation, manipulation, and mapping.

perception:
  camera:
    type: "oakd"
    depth: true
    resolution: "1080p"
  npu:
    type: "hailo8"
    model: "yolov8n"
    confidence: 0.5

๐Ÿ›ก๏ธ Safety First

OpenCastor implements defense-in-depth safety, inspired by ContinuonAI principles and fully RCAN spec compliant:

Layer What It Does
Physical Bounds Workspace limits, joint constraints, force capping
Anti-Subversion Prompt injection defense, input sanitization
Work Authorization Dangerous commands require explicit approval
Tamper-Evident Audit Hash-chained logs at /proc/safety โ€” any tampering is detectable
Emergency Stop Hardware and software e-stop, reactive layer < 1ms
castor audit --verify        # Verify audit chain integrity
castor approvals             # View/approve dangerous commands
castor privacy --config r.yaml  # Show sensor access policy

๐Ÿ“ฆ Quick Start

1. Install & Configure

curl -sL opencastor.com/install | bash
castor wizard

The wizard walks you through provider selection, API keys, hardware config, and optional messaging setup (WhatsApp/Telegram). It remembers your previous choices.

2. Run

castor run --config my_robot.rcan.yaml

3. Open the Dashboard

http://localhost:8501

4. Diagnose Issues

castor doctor

Minimal Python Example

from castor.providers import get_provider
from castor.drivers.pca9685 import PCA9685Driver

brain = get_provider({"provider": "anthropic", "model": "claude-opus-4-6"})
driver = PCA9685Driver(config["drivers"][0])

while True:
    frame = camera.capture()
    thought = brain.think(frame, "Navigate to the kitchen, avoid obstacles.")
    if thought.action:
        driver.move(thought.action["linear"], thought.action["angular"])

๐Ÿช Community Hub

Browse, install, and share robot recipes:

castor hub search "delivery bot"
castor hub install @alice/warehouse-picker
castor hub publish my_robot.rcan.yaml

Recipes are shareable RCAN configs โ€” complete robot personalities with perception, planning, and safety settings bundled together.

๐Ÿ”ง CLI Reference

Setup & Config
castor wizard                          # Interactive setup wizard
castor quickstart                      # Wizard + demo in one command
castor configure --config robot.yaml   # Interactive config editor
castor install-service --config r.yaml # Generate systemd unit file
castor learn                           # Step-by-step tutorial
castor doctor                          # Full system health check
castor fix                             # Auto-fix common issues
Run & Monitor
castor run --config robot.yaml         # Perception-action loop
castor run --config robot.yaml --simulate  # No hardware needed
castor gateway --config robot.yaml     # API gateway + messaging
castor dashboard                       # Streamlit web UI
castor demo                            # Simulated demo
castor shell --config robot.yaml       # Interactive command shell
castor repl --config robot.yaml        # Python REPL with robot objects
castor status                          # Provider/channel readiness
castor logs -f                         # Structured colored logs
castor benchmark --config robot.yaml   # Performance profiling
Hardware & Recording
castor test-hardware --config robot.yaml  # Test motors individually
castor calibrate --config robot.yaml      # Interactive calibration
castor record --config robot.yaml         # Record a session
castor replay session.jsonl               # Replay a recorded session
castor watch --gateway http://127.0.0.1:8000  # Live telemetry
Hub & Fleet
castor hub search "patrol bot"         # Browse community recipes
castor hub install @user/recipe        # Install a recipe
castor hub publish config.yaml         # Share your recipe
castor discover                        # Find RCAN peers on LAN
castor fleet                           # Multi-robot status (mDNS)
Safety & Admin
castor approvals                       # View/approve dangerous commands
castor audit --since 24h               # View audit log
castor audit --verify                  # Verify chain integrity
castor privacy --config robot.yaml     # Sensor access policy
castor token --role operator           # Issue JWT
castor upgrade                         # Self-update + health check

๐Ÿ—๏ธ Supported Hardware

Pre-made RCAN presets for popular kits, or generate your own:

Kit Price Preset
Waveshare AlphaBot / JetBot ~$45 presets/waveshare_alpha.rcan.yaml
Adeept RaspTank / DarkPaw ~$55 presets/adeept_generic.rcan.yaml
SunFounder PiCar-X ~$60 presets/sunfounder_picar.rcan.yaml
Robotis Dynamixel (X-Series) Varies presets/dynamixel_arm.rcan.yaml
Hailo-8 + OAK-D Vision Stack ~$150 presets/hailo_oakd_vision.rcan.yaml
DIY (ESP32, Arduino, custom) Any Generate with castor wizard

๐Ÿซ STEM & Second-Hand Hardware

OpenCastor explicitly supports the parts that students, educators, and hobbyists actually have โ€” donated kits, school surplus, eBay finds, and sub-$50 Amazon staples. If you found it at Goodwill, a school auction, or a makerspace scrap bin, there's probably a preset for it.

Kit Typical New Price Where to Find Used Preset
LEGO Mindstorms EV3 ~$300 new School surplus, eBay $30-80 presets/lego_mindstorms_ev3.rcan.yaml
LEGO SPIKE Prime ~$320 new STEM program donations, eBay $80-150 presets/lego_spike_prime.rcan.yaml
VEX IQ System ~$250 new Robotics team surplus, school auctions $50-120 presets/vex_iq.rcan.yaml
Makeblock mBot ~$50 new eBay $10-25, Amazon Warehouse presets/makeblock_mbot.rcan.yaml
Arduino + L298N (DIY) ~$8-15 total Makerspace bins, AliExpress presets/arduino_l298n.rcan.yaml
ESP32 + Motor Driver (DIY) ~$6-12 total AliExpress, hackerspaces presets/esp32_generic.rcan.yaml
Yahboom ROSMASTER X3 ~$150-200 Amazon Warehouse, eBay presets/yahboom_rosmaster.rcan.yaml
Elegoo Tumbller / Smart Car ~$35-40 new Amazon Warehouse $15-25, eBay presets/elegoo_tumbller.rcan.yaml
Freenove 4WD Car (Pi-based) ~$40 new eBay $15-25 (Pi not included) presets/freenove_4wd.rcan.yaml
Cytron Maker Pi RP2040 ~$10 new Hackerspaces, STEM lab surplus presets/cytron_maker_pi.rcan.yaml

๐Ÿ” Not sure what you have? See the Hardware Identification Guide for a decision tree: "I found this at a thrift store, now what?"

Tips for Second-Hand Hardware

  • Test first, code later. Run castor test-hardware --config <preset>.rcan.yaml to verify each motor and sensor before writing any autonomy code.
  • Cables are the most common failure point. LEGO connector cables, USB-B ports, and servo leads are all cheap to replace.
  • Clone boards are fine. Arduino Uno clones with CH340 USB chips work perfectly. You may need to install the CH341SER driver on Windows.
  • Battery health matters. Test battery packs under load โ€” many donated robots have degraded cells that drop voltage and confuse motor drivers.
  • Community firmware exists for almost every kit. Check the firmware/ directory in this repo for Arduino sketches and MicroPython scripts.

๐Ÿค Contributing

OpenCastor is fully open source (Apache 2.0) and community-driven.

Areas we need help with: driver adapters (ODrive, VESC, ROS2), new AI providers (Mistral, Grok, Cohere), messaging channels (Matrix, Signal), sim-to-real (Gazebo / MuJoCo), and tests.

๐Ÿ“„ License

Apache 2.0 โ€” built for the community, ready for the enterprise.


Built on the RCAN Spec by Craig Merry

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

opencastor-2026.2.20.10.tar.gz (403.4 kB view details)

Uploaded Source

Built Distribution

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

opencastor-2026.2.20.10-py3-none-any.whl (353.6 kB view details)

Uploaded Python 3

File details

Details for the file opencastor-2026.2.20.10.tar.gz.

File metadata

  • Download URL: opencastor-2026.2.20.10.tar.gz
  • Upload date:
  • Size: 403.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for opencastor-2026.2.20.10.tar.gz
Algorithm Hash digest
SHA256 0831691be57d5d621b32aeb61451dacfcb37f13e2ccb8b5b0f82ef0924afd160
MD5 7c7efdbcdf10c6ad2c33a663385441b4
BLAKE2b-256 ccbf4868d55bdf638028ab3957d3234a03a9cc82c7fb12efc41e5f96fecf6532

See more details on using hashes here.

File details

Details for the file opencastor-2026.2.20.10-py3-none-any.whl.

File metadata

File hashes

Hashes for opencastor-2026.2.20.10-py3-none-any.whl
Algorithm Hash digest
SHA256 48bb0bbdc9599c851c5e66948c1440fa4ece9d09ea4385755ba05f13230e0def
MD5 fadff43fef17004d41d451c584f7203a
BLAKE2b-256 d0d4afcd088cc0a93b3090494339dc8b2c5fc43200856fb00771a7c8d1af1902

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