> ## Documentation Index
> Fetch the complete documentation index at: https://docs.osmosis.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建自己的 Rollout

> 使用 AI coding agent 创建 task-specific rollout

当您已经有任务、数据集或现有 agent code，并希望 AI coding agent 帮您把它变成可运行的 Osmosis rollout 时，请使用这条路径。

如果您是 Osmosis 新用户，并且想走最短的复制粘贴路径，请先从 [运行 Multiply 示例](/zh/platform/quickstart) 开始。

<Note>
  本指南假设您已经完成 [Onboarding](/zh/platform/onboarding)：workspace repository 已 clone，CLI 已安装并认证，并且您的 AI coding environment 已在 workspace directory 中打开。
</Note>

## Workspace Skills 的作用

Platform-created workspace repositories 会在 `.agents/skills/` 下包含 project-local Agent Skills。支持 open Agent Skills format 的 agents 可以使用这些 skills，按照有经验 Osmosis 用户会采用的本地 loop 推进：

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
plan from dataset -> create rollout -> submit evaluation run -> debug failures -> prepare training run
```

它不是 CLI 的替代品。Agent 仍然会把 Osmosis CLI 作为 workspace checks、dataset validation、evaluation runs 和 training run preflight 的 source of truth。

## 何时使用这条路径

| 适合使用这条路径                          | 适合运行 multiply example  |
| --------------------------------- | ---------------------- |
| 您已经知道想训练的任务                       | 您想先证明平台可以端到端跑通         |
| 您有 sample data 或 platform dataset | 您还不想设计数据集              |
| 您想让 agent 创建或改造 rollout 代码        | 您想复制命令，而不做产品选择         |
| 您愿意检查生成的代码和 evaluation run output | 您还在学习 Osmosis workflow |

## 使用 Workspace Repository 中的 Skills

在您的 AI coding environment 中打开 platform-created workspace repository。该仓库会把 workspace contract 和 Agent Skills 与 rollout code、configs、data 放在一起：

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
repository/
├── .agents/
│   └── skills/
├── .claude/
│   └── skills/
├── rollouts/
├── configs/
│   ├── eval/
│   └── training/
├── data/
├── AGENTS.md
├── CLAUDE.md
└── pyproject.toml
```

`AGENTS.md` 包含 always-loaded workspace contract。`.agents/skills/` 包含 canonical workflow skills，`.claude/skills/<skill-name>` 会通过指向 `.agents/skills/` 的 symlinks，把同一组 skills 暴露给 Claude Code。

## 从 Workspace Repository 开始

这些 skills 假设 source files 使用以下仓库布局：

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
repository/
├── rollouts/
├── configs/
│   ├── eval/
│   └── training/
├── data/
└── pyproject.toml
```

在要求 agent 编写 rollout 代码前，确认 CLI 能解析 workspace：

```bash theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
osmosis doctor
osmosis auth whoami
```

## 让 Agent 从数据集开始规划

先描述您的 task，并让 agent 从 workspace 的规划 skill 开始。一个有用的初始 prompt 是：

```text wrap theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
I want to train a model for <task> in this Osmosis workspace. Start with the `plan-training` skill: read the workspace instructions, help me settle the dataset plan, and propose the next step before creating rollouts, running evaluation runs, or submitting a training run.
```

Workspace skills 应该引导 agent 执行以下步骤：

<Steps>
  <Step title="规划训练">
    检查 `data/`、现有 rollouts 和 workspace config。Agent 应先确定 dataset schema，再编写 rollout 代码。
  </Step>

  <Step title="创建或改造 rollout">
    编写能加载、运行并给 samples 打分的最小 `AgentWorkflow` 和 `Grader`。生成的文件应保持在 `rollouts/`、`configs/eval/`、`configs/training/` 和 `data/` 下。
  </Step>

  <Step title="提交 evaluation run">
    Push rollout 到 workspace repository，并提交一次 evaluation run 作为 quality gate：

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
    git push
    osmosis eval submit configs/eval/<name>.toml
    osmosis eval info <eval-run-name>
    ```
  </Step>

  <Step title="Debug 到 evaluation run 干净通过">
    Training run 前修复 loading、dataset、grader、dependency 和 reward 问题。通过 evaluation run 是从创建阶段交接到 training run 准备阶段的节点。
  </Step>

  <Step title="准备 training run">
    Rollout 验证通过后，让 agent 检查 training run config 并运行 submit-time preflight。只有在您准备启动 platform training run 时才提交。
  </Step>
</Steps>

<Warning>
  不要跳过 evaluation run。`osmosis train submit` 应该发生在 rollout 能够在平台上干净加载、运行并给 samples 打分之后。
</Warning>

## Workspace Skills

Workspace skills 围绕 rollout creation stages 组织：

| Skill               | Purpose                                                              |
| ------------------- | -------------------------------------------------------------------- |
| `plan-training`     | 将任务想法或数据集转化为具体的 experiment plan                                      |
| `create-rollouts`   | 创建或改造 rollout code、graders、entrypoints 和 baseline evaluation configs |
| `evaluate-rollouts` | 提交 evaluation runs、比较 baselines，并检查 failures                         |
| `debug-rollouts`    | 诊断 evaluation、config、dataset、dependency 或 preflight failures         |
| `submit-training`   | 准备 training run config、提交 training run，并检查 training run status       |

通常不需要按名称调用这些 skills。描述您想要的结果，agent 应该会应用正确的阶段。

## 下一步

<CardGroup cols={2}>
  <Card title="Rollout 概览" icon="diagram-project" href="/zh/cli/rollout/overview">
    理解生成的 rollout 代码背后的 `AgentWorkflow` 和 `Grader` contract。
  </Card>

  <Card title="评估" icon="flask-vial" href="/zh/cli/rollout/eval">
    提交 training run 前用 evaluation run 验证 rollouts。
  </Card>

  <Card title="Git Sync" icon="rotate" href="/zh/cli/workspace/git-sync">
    Push rollout 修改，并让平台同步 evaluation run 和 training run 使用的代码版本。
  </Card>

  <Card title="Training Runs" icon="play" href="/zh/platform/training-runs">
    Evaluation run 通过后提交并监控 training run。
  </Card>
</CardGroup>
