扩展 The Harness
每种扩展都是放在已知位置的一个文件;无需修改 runtime。做完任何一种扩展后,
python -m unittest discover -s tests 会检查每个配置仍能解析,且每个 prompt pack 描述的正是其 kernel
暴露的 API。
分步说明:编写一个 skill。
skills/<name>/├── skill.toml└── __init__.pyname = "pointing"summary = "Open-vocabulary pointing and 3D localization from one or more cameras."layer = "base" # base | reactive | handlers | learnedmixin = "skills.pointing:Pointing"exports = ["point_to", "localize", "localize_3d"]needs_any = ["pointer", "vlm"] # service kinds; or needs = [...] (all), requires = [skills]order = 30 # where it sits in the session's method resolutionmixin 的方法在 kernel 的 session 中运行(即 runtime/episode.py 的 episode 核心,对机器人而言是
runtime/session.py 的 RobotSession),可以使用 self.env(worker)、self.state、用于有界运动的
self._execute(...),以及其他 skill 的方法。除非 skill 的 embodiments 指定了其他类型
(embodiments = ["desktop"]),否则它在机器人上运行。在每个 prompt pack 中把导出的函数写在
<!-- if: <name> --> ... <!-- end --> 之内,这样 prompt 会随 skill 一起去掉它们;prompt 文本也可以取决于
机器人连接报告的内容(<!-- if: measured_gripper -->、<!-- if: step_limit -->,见 runtime/prompts.py)。在 agent 中启用它:
[skills] names = [...],或通过它的层。
MCP 工具服务器
Section titled “MCP 工具服务器”任何通过 streamable HTTP 使用 Model Context Protocol 的服务器都可以成为一组供程序调用的工具:一个
mcp 类型的清单(services/mcp-units.toml 是一个例子,其服务器在
services/servers/serve_mcp_example.py),deploy 像放置任何服务一样放置它,agent 写明它并启用该 skill:
[services]mcp = ["mcp-units"]
[skills]enable = ["mcp"]之后程序可以看到 mcp_tools() 和 mcp_call(tool, **arguments)(skills/mcp)。程序在隔离环境中运行,
不能启动进程,因此只支持 stdio 的服务器要放在一个 HTTP 桥接之后,作为服务运行。
MCP 服务器在程序的沙箱之外运行:它的工具能访问的东西,程序都能通过 mcp_call 访问。文件系统或 shell
服务器会把隔离所隐藏的文件和进程(benchmark 的 checkout、任务文件、密钥)交给程序,因此只给 agent
提供那些工具可以安全地被任何程序调用的服务器。机器人命令仍然经过 worker 及其安全层(shield)。
服务,以及作为学习型 skill 的 VLA
Section titled “服务,以及作为学习型 skill 的 VLA”分步说明:添加一个 VLA。
services/<name>.toml:
kind = "policy" # policy | world_model | segmenter | pointer | vlm | llm | kinematicssummary = "..."protocol = "xpolicylab" # http | openai_chat | xpolicylabport = 19008vram_gb = 14.0 # measured; placement and swapping use itload_seconds = 180client = { url = "{url}", description = "what the model is told about it" }needs_files = ["{weights}/simate/model.safetensors"]
[xpolicylab] # an XPolicyLab policy: no server code of our ownpolicy = "Simate_beta"ckpt_name = "{weights}/simate"action_type = "joint"
[[weights]] # `harness fetch` sources (ModelScope, hf-mirror)dir = "simate"modelscope_dataset = "RoboDojo-Benchmark/RoboDojo"root = "ckpt/RoboDojo/Simate-beta/RoboDojo-sim-arx_x5-joint-0"XPolicyLab 的任何策略都可以这样成为一个学习型 skill:run_policy 使用它的协议,并把它训练时所用的
观测交给它。我们自己提供的服务用
command = ["{python}", "-u", "services/servers/<server>.py", "--port", "{port}", ...]
代替 [xpolicylab]。然后在 deploy 中放置它,并在 agent 中写明它
([services] policies = ["simate", "g05"];除非程序指定了其他策略,start 把任务交给第一个),
再根据它自己测得的分数给它写一段描述(添加一个 VLA)。
configs/ablations/<name>.toml,在 agent 之上加几行:
description = "without the verifier"include = ["../default.toml"][runtime]verifier = falseagent 指定 prompt pack、skill、skill 所用的服务、runtime 设置和预算。模型角色放在 configs/models/ 中,
这样 agent 可以用任何模型运行。harness config <experiment or agent file> --deploy <machine> 显示它解析
成什么;harness lock 写出它的 identity。对 agent 行为的改动直接写进 configs/default.toml,同时更新
AGENT_VERSION 并添加一条 changelog 条目。
configs/deploy/<machine>.toml:GPU、权重、状态目录、[sim] worker,以及每个服务的
gpu = N | "auto"、mode = "resident" | "on_demand" | "external" | "off",共享一块 GPU 的按需服务用
swap = "<group>"。configs/deploy/ 中有四块、两块、一块 GPU 和无 GPU 的示例;某台机器自己的文件放在
那里会被 git 忽略。harness doctor --deploy <machine> 检查它。
benchmark 或机器人
Section titled “benchmark 或机器人”一个 benchmark 是一个 worker,它通过 harness serve --factory module:create_environment 提供机器人 API(profile、reset、tick、state、
observe、fk、ik、plan、outcome);见 benches/robodojo/runtime.py 和
benches/robotwin/runtime.py。机器人的描述(关节组、限位、相机、标定、夹爪、安装位姿)放在
embodiments/<name>/embodiment.toml;prompt pack 放在 prompts/<bench>/。
当由别人运行策略时(XPolicyLab),有三个部分让 runtime 保持不变:一个观测契约(core/contract.py),
使开发运行看到的正是评测方交给策略的内容;一个连接器(connectors/),以评测方的接口呈现 harness;
以及一个导出模块(export/),用于写出提交文件。通过 XPolicyLab 评测
介绍了 XPolicyLab 的这三个部分。