Examples

Runnable Python scripts and small sample datasets for Actuator's Python SDK, ML-native closed-loop training control, and custom RL environments.

For full end-to-end guides, see the Quickstart, Recipes & YAML Guide, Reinforcement Learning Guide, and Python SDK Guide.


Python Scripts

Script What it shows Quick run
quickstart_sdk.py actuator.train(), catalog browsing via list_catalog(), reading run.verdict, programmatic run.chat(), and run.export(). Defaults to a read-only --dry-run; pass --run to train. python examples/quickstart_sdk.py
attach_control_trl.py Attaching ControlConfig (SafetyGuard, PreservationAnchor, AdaptiveKLController, PlateauEarlyStop) to any Hugging Face / TRL trainer with attach_control(). Runs a zero-GPU local walkthrough when invoked directly. python examples/attach_control_trl.py
custom_rl_env.py Subclassing RolloutEnvironment, registering a custom env: environment, and exporting a standalone GRPO reward callable (examples/custom_rl_env.py:json_answer_reward). python examples/custom_rl_env.py

Sample Datasets (examples/data/)

Small local JSONL fixtures used by quickstarts, dry-runs, and tests:

File Format Intended method
examples/data/tiny-sft.jsonl Prompt / completion JSONL SFT and distillation smoke runs
examples/data/tiny-dpo.jsonl prompt / chosen / rejected pairs DPO and ORPO preference smoke runs
examples/data/tiny-grpo.jsonl Prompts with check metadata GRPO / RL smoke runs
examples/data/squad-json-train.jsonl Structured JSON extraction SFT rows (see examples/data/squad-json-provenance.json and THIRD-PARTY-NOTICES.md) Structured-output fine-tuning

Production Recipes & Notebooks

  • 34 ready-to-run YAML recipes (SFT, Vision, DPO/KTO/ORPO, GRPO/Agentic RL, Distillation, Merge, Abliterate, Export): run actuator recipes list or browse recipes/catalog/.
  • 12 free 1-click Colab notebooks: browse notebooks/.