Skip to content

Python API

The package root exposes the common entry models:

from robosmith import TaskSpec, ForgeConfig, SmithConfig

ForgeConfig and SmithConfig are aliases. TaskSpec is the central task schema passed into the training pipeline.

from robosmith import TaskSpec, ForgeConfig
from robosmith.agent.graphs.run import run_pipeline, resume_pipeline
spec = TaskSpec(task_description="A quadruped walks forward")
config = ForgeConfig(max_iterations=2)
state = run_pipeline(spec, config)
print(state["run_id"])
resumed = resume_pipeline(state["run_id"])
run_pipeline(task_spec, config=None, on_step=None) Runs the full LangGraph training workflow and returns `PipelineState`.
resume_pipeline(run_id, runs_dir=None, on_step=None) Loads `checkpoint.json`, skips completed nodes, and continues the graph.

on_step is an optional callback with (node_name, log_line).

from robosmith.config import (
Algorithm,
Decision,
EnvironmentType,
ForgeConfig,
LLMConfig,
RewardSearchConfig,
RobotType,
RunState,
SafetyConstraint,
StageRecord,
StageStatus,
SuccessCriterion,
TaskSpec,
)

Important fields:

ModelPurpose
TaskSpecStructured task description used by every pipeline stage.
SuccessCriterionMetric, operator, and threshold for success.
SafetyConstraintHuman-readable and optional metric-based safety constraint.
LLMConfigProvider, model, fast model, temperature, retries.
RewardSearchConfigCandidate count, evolution iterations, eval budget.
ForgeConfigTop-level pipeline config, paths, stage skipping, scout source.
RunStateSerializable run summary used by delivery and run inspection.
from robosmith.envs.registry import EnvRegistry, EnvEntry
from robosmith.envs.wrapper import make_env
from robosmith.envs.adapter_registry import EnvAdapterRegistry
from robosmith.envs.adapters import EnvAdapter, EnvConfig
from robosmith.envs.reward_wrapper import ForgeRewardWrapper
EnvRegistry(registry_path=None) Loads environment entries from YAML.
EnvRegistry.get(entry_id) Returns one `EnvEntry` or `None`.
EnvRegistry.search(...) Filters by robot type, environment type, framework, model, tags, or action type.
make_env(entry, **kwargs) Creates a live environment through the matching adapter.
ForgeRewardWrapper(env, reward_fn, reward_clip=100.0) Replaces environment rewards with a custom reward function.
from robosmith.stages.env_synthesis.synthesis import EnvMatch, match_task_to_env
match = match_task_to_env(spec, EnvRegistry(), framework="gymnasium")

EnvMatch contains entry, score, and match_reason.

from robosmith.trainers.base import (
LearningParadigm,
Policy,
Trainer,
TrainingConfig,
TrainingResult,
)
from robosmith.trainers.registry import TrainerRegistry
from robosmith.trainers.selector import PolicyApproach, select_policy_approach
TrainerRegistry().list_available() Returns installed training backends.
TrainerRegistry().list_all() Returns all known backends with availability, required packages, paradigm, and algorithms.
TrainerRegistry().get_trainer(algorithm, backend=None, paradigm=None) Returns a ready trainer or raises when dependencies are missing.
select_policy_approach(...) Chooses paradigm, algorithm, backend, reason, confidence, and alternatives.
from robosmith.inspect.dispatch import (
inspect_dataset,
inspect_env,
inspect_policy,
inspect_robot,
)
from robosmith.inspect.compat import check_compatibility
from robosmith.inspect.models import (
CameraSpec,
CompatReport,
DatasetInspectResult,
EnvInspectResult,
PolicyInspectResult,
RobotInspectResult,
)
dataset = inspect_dataset("lerobot/aloha_mobile_cabinet")
env = inspect_env("Ant-v5")
policy = inspect_policy("lerobot/smolvla_base")
robot = inspect_robot("path/to/robot.urdf")
report = check_compatibility(policy.model_id, dataset.repo_id)

check_compatibility(a, b, c=None) returns CompatReport with compatible, errors, warnings, and info.

from robosmith.diagnostics.trajectory_analyzer import (
analyze_trajectory,
compare_trajectories,
)
from robosmith.diagnostics.diag_models import (
ActionStats,
FailureCluster,
TrajectoryCompareResult,
TrajectoryDiagResult,
)
result = analyze_trajectory("path/to/rollout.hdf5")
comparison = compare_trajectories("rollout_a.hdf5", "rollout_b.hdf5")
from robosmith.generators.gen_wrapper import generate_wrapper
code = generate_wrapper(
policy_id="lerobot/smolvla_base",
target_id="lerobot/aloha_mobile_cabinet",
output_path="adapter.py",
use_llm=False,
)
from robosmith.agent.models.base import BaseAgent
from robosmith.agent.models.reward import RewardAgent, RewardCandidate
from robosmith.agent.models.decision import DecisionAgent

Agents use LiteLLM and are wrapped so structured JSON calls can retry after parse failures. Most users interact with these through the pipeline, not directly.