AWS 开源 Strands Robots SDK,将 LeRobot 的工具链封装为 AgentTools,通过一条自然语言指令即可完成从模拟演示、数据集推送、策略推理到物理机器人部署的完整流程。模拟与硬件共享同一数据格式,无需额外转换。
你有一台机器人、一份 Hugging Face Hub 上的演示数据,以及一个想让它学习的新任务。传统做法需要五套独立工具:一个录制演示、一个训练、一个在模拟中测试、一个部署到硬件、还有一个用于多机器人协调。它们各自独立,互不沟通。
Strands Robots 是 AWS 开源的 SDK(Apache 2.0),它将机器人抽象、模拟环境以及 LeRobot 栈封装成 AgentTools,组合成一个 Strands agent。集成层很薄:LeRobot 自己的脚本负责硬件录制和标定,Strands AgentTools 只接管 agent 真正需要编排的部分。模拟工具录制的 LeRobotDataset 与硬件录制格式相同。GR00T 和 LerobotLocal 提供策略推理,MolmoAct2 检查点也可通过 LerobotLocal 路径运行。一个点对点网格(mesh)可将 agent 分发到多台远程机器人。数据集格式保持 LeRobot 原生不变,agent 循环充当粘合剂。
本文通过一个 agent 内的五个步骤带你体验完整流程:构建 agent、在模拟中录制 LeRobotDataset、运行策略、将同一份 agent 代码部署到物理 SO-101 机器人(仅需修改一个关键字参数),以及通过 Zenoh mesh 向整个机器人集群广播指令。你可以在 GitHub 获得完整的示例应用,在笔记本上以模拟模式运行,无需硬件、GPU 或 Hugging Face 凭证。
Strands Robots SDK 将 LeRobot 栈封装为 AgentTools。示例 agent 做四件事:在模拟中录制新演示、将结果推送到 Hub、运行策略、以及将同一份 agent 代码部署到物理机器人。多机器人时,agent 通过内置 mesh 协调整个集群。硬件录制和标定仍由 LeRobot 的 CLI 处理。
[
]
两个设计选择保证这一点:第一,Robot("so100") 默认返回模拟(安全),mode="real" 返回由 LeRobot 驱动的硬件机器人。第二,录制 LeRobotDataset 的 DatasetRecorder 在模拟路径和硬件路径间共享,因此模拟数据集与硬件数据集格式相同。
uv pip install "strands-robots[sim-mujoco,lerobot,mesh]")。安装 Strands Robots 并克隆示例仓库:
uv pip install "strands-robots[sim-mujoco,lerobot,mesh]"
git clone https://github.com/strands-labs/robots.git
cd robots
export HF_TOKEN=hf_...
示例文件位于 examples/lerobot/hub_to_hardware.py(脚本)和 hub_to_hardware.ipynb(笔记本)。推荐从笔记本开始,在 JupyterLab 中按顺序运行模拟模式下的单元格。
模拟工具使用与 LeRobot 硬件录制相同的 DatasetRecorder 类录制 LeRobotDataset。agent 提示词几乎相同:
from strands import Agent
from strands_robots import Robot
robot = Robot("so100") # 默认 mode="sim"
agent = Agent(tools=[robot])
agent(
"Record a demonstration of 'pick the red cube and place it in the box' "
"using the Mock policy provider at FPS 30. Write the dataset to "
"my_user/cube_picking_sim and push to the Hub when done."
)
[
]
Mock 策略生成占位关节动作,使工作流可以端到端运行。录制数据集格式与 Hub 上任何 LeRobot 数据集完全一致,训练脚本可直接使用。
硬件录制:使用 LeRobot 的 CLI(lerobot-calibrate 和 lerobot-record)在物理 SO-101 上录制,输出格式与模拟录制相同。
使用 Robot() 工厂(默认模拟模式)并附加 gr00t_inference 工具:
from strands import Agent
from strands_robots import Robot, gr00t_inference
robot = Robot("so100")
agent = Agent(tools=[robot, gr00t_inference])
agent(
"Start GR00T inference on port 5555 with the cube-picking checkpoint "
"from my_user/cube-picker. Then ask the robot to pick up the red cube."
)
gr00t_inference 工具自动拉取容器镜像、下载检查点并启动服务。模拟机器人通过 run_policy 动作消费策略输出。你也可以使用 LerobotLocalPolicy 进行进程内推理,支持 ACT、Diffusion Policy、SmolVLA 等。
[
]
与步骤 3 相同代码,仅修改一个关键字参数:
robot = Robot(
"so100",
mode="real",
port="/dev/ttyACM0",
data_config="so100_dualcam",
cameras={
"front": {"type": "opencv", "index_or_path": "/dev/video0", "fps": 30},
"wrist": {"type": "opencv", "index_or_path": "/dev/video2", "fps": 30},
},
)
agent = Agent(tools=[robot, gr00t_inference])
agent(
"Start GR00T inference on port 5555 with the cube-picking checkpoint "
"from my_user/cube-picker. Then ask the robot to pick up the red cube."
)
硬件路径使用 LeRobot 的机器人抽象驱动关节和摄像头。确保已完成设备标定(lerobot-calibrate)。
Robot() 和 Simulation() 实例自动加入 Zenoh 点对点 mesh。robot_mesh 工具提供集群发现、广播和急停能力:
agent = Agent(tools=[robot_mesh])
agent(
"List every robot and simulation on the mesh. "
"Then send 'go to home pose' to each one in parallel."
)
广播等物理动作默认需要人工批准,防止 prompt 注入。robot_mesh 支持跨网络部署(通过 AWS IoT Core)和设备级通信(通过 Device Connect)。
STRANDS_MESH_AUTH_MODE=mtls 保护生产环境,STRANDS_MESH_LOCAL_DEV=1 仅限可信开发网络使用。STRANDS_MESH_HITL_ACTIONS 调整。agent.tool.gr00t_inference(action="stop", port=5555) 或 lifecycle="teardown"。~/.cache/huggingface/lerobot/<repo_id>。Strands Robots 不重复实现 LeRobot 已提供的功能。硬件抽象、标定和数据集格式保持在 LeRobot 上游。Strands 添加 AgentTool 层,使其可通过自然语言组合。模拟数据和硬件数据共享单一文件格式,训练脚本无需修改即可使用,模拟与真实的界限变为部署细节而非架构差异。
完整文档:Strands Robots 文档。更大规模的工作负载可参考 strands-labs/robots-sim 仓库,其中包含 Isaac Sim 和 LIBERO 示例。欢迎在 Apache 2.0 许可下贡献代码。
原文链接:Hugging Face
本文由前途科技编辑整理
免费获取企业 AI 成熟度诊断报告,发现转型机会
关注公众号

扫码关注,获取最新 AI 资讯
3 步完成企业诊断,获取专属转型建议
已有 200+ 企业完成诊断