由 RL 影片教學到生產級 RL 工程技能
打造 Terminal-Bench 和 Harbor 的團隊分享了大量得來不易的 RL 工程知識——他們如何打包任務、如何揪出代理作弊、如何將 rollout 變成訓練數據。當中大部分都藏在冗長的會議講座裏。
其中三段講座加起來約一個半小時。每一分鐘都值得看,卻很難重用。下次建構環境時,你又要在時間軸上來回拖動,尋找記憶中的那一張簡報。
於是我們把「看影片」這件事交給一隊代理。在 Eigent 內使用 Gemini 4,一份任務說明就把三段 Terminal-Bench 講座變成四個面向生產級 RL 環境工程的檔案式技能,另附一份帶來源連結、能說明每個觀點出處的報告。
完整工作流程一覽
講座由你挑選,之後一份任務說明就能一直做到代理可重用的技能。每個階段都會留下檔案,方便你逐步檢查成果。
| 階段 | 做甚麼 | 得到甚麼 |
|---|---|---|
| 挑選 | 選擇你想學習的 YouTube 講座 | 任務說明中的一份簡短影片連結清單 |
| 觀看 | 下載字幕和畫面影格,完整觀看每段講座 | 每段講座附時間戳記的大綱 |
| 分析 | 擷取方法、洞見、報告的結果和警示 | 標示為 OBSERVED、INFERRED 或 UPDATED 的學習重點 |
| 比較 | 將講座放在一起互相比較 | 它們的共識、分歧,以及如何互補彼此的缺口 |
| 提煉 | 按實際能力將方法和洞見分組 | 每個技能一個 SKILL.md 和一個 evidence.md |
| 驗證 | 檢查結構、執行腳本、在新任務上試用技能 | 每個技能標示為 STRUCTURALLY CHECKED、EXECUTED 或 UNTESTED |
| 報告 | 建立 HTML 報告並在 127.0.0.1 上提供服務 | 嵌入的講座、可點擊的時間戳記和標出缺口的覆蓋矩陣 |
| 重用 | 讓協作代理讀取某個 SKILL.md | 在你自己的項目中進行生產級 RL 環境工程 |
以下逐步教你自己執行一次,當中還包括我們撰寫任務說明時學到的一課。
你將得到甚麼
- 可重用的技能——每個都是一個
SKILL.md加一個evidence.md,其他代理毋須看講座就能直接應用。 - 一份附來源連結的 HTML 報告——在本機提供服務,嵌入每段講座,附時間戳記大綱,學習重點可點擊直接跳到對應時刻。
- 一個覆蓋矩陣——哪個技能涵蓋 RL 工作流程的哪一部分,以及哪些範疇沒有任何講座談及。
- 一份誠實的紀錄——每項論點都標示為 OBSERVED、INFERRED 或 UPDATED,每個技能都標示為已執行、已做結構檢查或未測試。
開始之前
- 在你的電腦上安裝好 Eigent。
- 一條 Gemini API 金鑰。
- 你希望代理學習的 YouTube 連結。我們用的是這三段:
| 講座 | 頻道 | 長度 |
|---|---|---|
| Introducing Terminal-Bench: Evaluating LLM Agents in Realistic Terminal Settings | Anyscale (Ray Summit 2025) | 31:23 |
| Everything Is a Rollout - Alex Shaw + Ryan Marten | AI Engineer | 21:11 |
| Terminal-Bench 2.0: Launch + Q&A with the founders | Latent Space | 35:00 |
加入你的 Gemini API 金鑰
- 開啟 Settings → Models。
- 找到 Gemini 並開啟其設定。
- 貼上你的 API key。
- 將 model type 設為
gemini-4。 - 點擊 Save。
選擇 Gemini 4
- 在主畫面上,開啟輸入框下方的 模型選擇器。
- 選擇 Gemini → gemini-4。
- 如有需要可設定思考強度,預設值已經可以。
貼上任務說明
將下方的任務說明複製到 Cowork with 輸入框。換成你自己的影片連結,並將 Docker 那一行設為 allowed 或 not allowed。
Watch the YouTube videos listed below and turn their methods and insights into reusable,
file-based agent skills. Then publish the results as a well-designed HTML report served from a
local web server.
Videos:
- https://www.youtube.com/watch?v=zt-U4lDdenY&t=1559s
- https://www.youtube.com/watch?v=jRCpXUjz4CI
- https://www.youtube.com/watch?v=5wo0mLlG0fk&t=1815s
Use only these videos as primary sources. Do not search for, substitute, or add other videos.
You may consult official documentation and the code repositories the videos link to or name,
but only to check or update details shown in the videos.
## Focus
Extract practical, repeatable methods. Where the videos cover them, include:
- Defining tasks, observations, actions, and termination conditions.
- Creating reproducible environments and reset behaviour.
- Building verifiers and reward functions.
- Detecting reward hacking and invalid successes.
- Collecting, scoring, and reviewing agent trajectories.
- Preparing data for agent training and evaluation.
Do not invent coverage for areas the videos don't address. List those areas as gaps instead.
Capture insights, not only procedures. For every method, record why the speakers use it, what
went wrong before they did, any results or numbers they reported, and the warnings they gave.
Treat named tools and frameworks (for example Harbor or Terminal-Bench) as one implementation
of a method. Record the underlying principle first and the tool-specific steps second.
## Permissions and limits
- Allowed: reading the video pages; downloading subtitles, transcripts, and the video files
for analysis; extracting frames; reading official docs and repositories named in the
videos; creating a local virtual environment and installing open-source packages into it;
running a local static web server bound to 127.0.0.1.
- Docker: [allowed / not allowed].
- Not allowed: model training, GPU jobs, paid hosted services, calls to paid LLM APIs, or
publishing anything to a public host. For trajectory collection tests, use a scripted,
rule-based, or random policy.
- Keep all files inside ./rl-env-skills/ in the current working directory. Delete downloaded
video files when finished.
- Do not ask for confirmation for the actions allowed above. Stop and report only if a required
action falls outside them.
- If a video is private, removed, region-locked, or has no usable audio or transcript, say so in
the report. Continue with the remaining videos, and do not replace it.
## Capability honesty
Before starting, record which relevant capabilities you have: video viewing, frame
extraction, transcript access, code execution, browser preview. If you cannot inspect video
visuals, work from transcripts and mark every visual claim as "not observed".
Never describe on-screen content you did not actually see.
## Analysis
For each video:
- Record title, channel, published date, duration, and view count with the date checked.
- Watch it in full. Inspect visual demonstrations, code, diagrams, and narration where your
capabilities allow.
- Build a timestamped outline of the main sections.
- Preserve timestamps for every important procedure, decision, and warning.
- List the key insights and takeaways: design decisions and the reasons behind them, lessons
learned, failure stories, reported results, and warnings. Give each one a timestamp.
- Label each claim OBSERVED (seen or heard in the video), INFERRED (your interpretation), or
UPDATED (adapted to current official docs; cite the doc URL and the date checked).
- Re-inspect unclear moments. Record unresolved details instead of guessing.
- Paraphrase. Quotes must be under 15 words and carry a timestamp. Do not reproduce transcripts.
Then note where the videos agree, where they differ, and where one fills a gap in another.
## Skills
Create 2–4 skills grouped by practical capability. A skill may draw from several videos.
Layout:
rl-env-skills/
<skill-name>/
SKILL.md # required
evidence.md # timestamps, OBSERVED/INFERRED/UPDATED labels, source per point
scripts/ templates/ # only if they materially help; scripts must be tested
report/
index.html # the HTML report (see below)
assets/ # extracted frames or screenshots used in the report, if any
REPORT.md
manifest.json
SKILL.md must begin with YAML frontmatter:
---
name: <kebab-case, matches folder name>
description: <1–2 sentences: what it does and when to use it, including trigger phrases>
---
The body must cover: prerequisites, required inputs, key insights (the principles and lessons
behind the procedure, each with its source and timestamp), procedure (numbered steps), expected
outputs, decision rules, failure recovery, observable success checks, and a tool-agnostic path
for projects that don't use the tools shown in the videos. Another agent should be able to
apply it to a new project without watching the videos.
A skill must not be only a wrapper around one tool's features. If you removed every
tool-specific command, the insights and decision rules should still stand on their own.
Keep these four things distinct throughout: task datasets, recorded trajectories, supervised
training examples, and RL policy optimisation. Never imply that exporting trajectories is RL
training.
## Validation
- Structural: frontmatter is present and valid, the name matches the folder, every referenced
file exists, every evidence timestamp falls within the source video's duration, and every
skill has a key insights section with at least three sourced insights.
- Execution: run every script you created. Where feasible, apply at least one skill end to end on
a small example the videos don't use (e.g. a text grid-world, or a "make this failing unit
test pass" task).
- Report each item as STRUCTURALLY CHECKED, EXECUTED (with command and result), or UNTESTED
(with reason).
## HTML report (report/index.html)
### Content, in this order
1. Header: report title, date checked, the agent's capability summary (had / lacked).
2. Summary: 3–5 sentences on what was produced and the main limitations. No marketing language.
3. Sources: one row per video (title, channel, published date, duration, views with date
checked, linked code or repository, access status).
4. One section per video:
- The original video embedded with a privacy-enhanced YouTube embed
(https://www.youtube-nocookie.com/embed/<VIDEO_ID>), with a 16:9 responsive frame.
- Link to the original.
- Timestamped outline of the video.
- Key insights and takeaways, each with a clickable timestamp and a label.
- Learning points: numbered, each with a clickable timestamp that seeks the embedded player
(YouTube IFrame Player API) and an OBSERVED / INFERRED / UPDATED label.
- Unresolved details.
- If embedding is blocked, show the video thumbnail linked to youtube.com/watch?v=<ID>
and state that embedding was unavailable.
5. How the videos compare: agreements, differences, and how each fills the others' gaps.
6. One section per skill:
- Name, absolute path to SKILL.md, one-sentence purpose, and when to use it.
- Key insights the skill carries, with their sources.
- Procedure summary (the key steps, not the whole file).
- Evidence: every supporting source point as a row — video, timestamp (clickable), label,
and what the skill took from it. Include doc URLs for UPDATED items.
- Validation status with the command and result if executed.
7. Coverage matrix: skills × the videos, showing which video supports which skill, plus
the focus areas no video covered.
8. Data distinctions: a short table defining task dataset, trajectory, supervised example, and
RL policy optimisation, and which of them the skills actually produce.
9. Limitations and untested items.
10. Three copy-paste reuse requests, each in a code block with a copy button.
### Visual design: light mode, in Google's design language
- Style only: do not use Google logos or wordmarks, or suggest the report is a Google product.
- Colours: page #FFFFFF; secondary surfaces #F8F9FA; borders #DADCE0; primary text #202124;
secondary text #5F6368; links and primary actions #1A73E8. Use the Google accent set
(blue #4285F4, red #EA4335, yellow #FBBC04, green #34A853) only for status and labels,
e.g. OBSERVED blue, INFERRED yellow tint with dark text, UPDATED green, UNTESTED red.
Text must meet WCAG AA contrast.
- Type: Google Sans / Google Sans Text if available from Google Fonts, otherwise Roboto; Roboto
Mono or Google Sans Code for code and timestamps. Clear scale: one H1, H2 per section, 16px
body, 1.5 line height, comfortable line length (about 70–80 characters).
- Layout: 8px spacing grid, max content width about 1100px, sticky left table of contents on
desktop that collapses on mobile, flat cards with 1px borders or a subtle Material elevation
shadow, 8–12px corner radius, plain tables with hairline row dividers.
- Avoid the generic "AI-generated" look: no gradients, purple/indigo themes, glassmorphism,
glowing effects, emoji used as icons, sparkle icons, oversized hero banners, decorative
blobs, or hype copy ("unlock", "supercharge", "seamless"). Prefer real content, tables, and
data over decoration.
- Technical: one self-contained HTML file with inline CSS and JS. Only external requests allowed:
Google Fonts and YouTube embed/API. Responsive down to 360px width with no horizontal
page scroll. Semantic HTML, keyboard-accessible controls, alt text on images.
### Serve and verify
1. Start a static server from rl-env-skills/report/ bound to 127.0.0.1, e.g.
`python3 -m http.server 8000 --bind 127.0.0.1`. If port 8000 is busy, use the next free port.
Keep the server running when you finish.
2. Do not rely on opening the file from disk: YouTube embeds often fail without an http origin.
3. Verify: the page returns HTTP 200; every embed loads or shows the fallback; timestamp links
seek the player; all anchors and file links resolve; no console errors. If you have a browser
tool, take a desktop and a 375px-wide screenshot and save them to report/assets/.
4. Report how you verified each item, and which checks you could not run.
## Deliverables
- REPORT.md: a plain-text version of the report's findings.
- manifest.json:
{ "date_checked": "...",
"videos": [{"url","title","channel","published","duration","views","access_status"}],
"skills": [{"name","path","sources":["<video id>", "..."],
"insights": <number of sourced insights>,
"validation":"executed|structural|untested"}],
"capabilities": {"video": bool, "frames": bool, "transcripts": bool, "code_exec": bool,
"browser_preview": bool},
"report": {"path": "<absolute path to index.html>", "preview_url": "http://127.0.0.1:<port>/",
"server_command": "...", "verified": [...], "not_verified": [...]} }
- Final reply: the preview link on its own line first
(http://127.0.0.1:<port>/), then the command to restart the server if it stops, then a short
summary of the videos, skills with absolute paths, validation results, and limitations.
這份任務說明中,有幾部分起關鍵作用:
- Use only these videos 令代理只使用你選定的來源——不替換,也不額外加入。
- Capture insights, not only procedures 確保「為甚麼」與「怎樣做」一起保留下來。下文會詳細說明。
- Capability honesty 防止任何人描述一個根本沒有人看過的影片畫面。
- OBSERVED / INFERRED / UPDATED 標籤 將事實、詮釋與經文件核對的更新區分開來。
- 數據區分 令任務數據集、軌跡、監督式範例和 RL 策略優化各自獨立,因此匯出軌跡永遠不會被誤當作訓練。
我們對任務說明作了哪些修改,以及原因
我們影片中的那次執行使用的是這份任務說明的早期版本。它做對了很多事。Gemini 4 看完了全部三段講座,對照 Harbor 文件和程式碼庫核對了細節,並建立了四個技能。每個技能的腳本都在一個講座沒有用到的任務上完整跑通——修復一個名為 fix-ini-interpolator 的 Python 設定解析器。
但在閱讀這些技能時,我們留意到一個問題:它們過度依賴 Harbor 的功能——任務資料夾結構、軌跡格式和 CLI 指令。而它們背後的洞見大多留在了報告裏。
這些講座充滿洞見。報告本身就記錄了以下幾點:
- 腳手架和模型同樣重要。 及早取消卡住的指令帶來約 5–10% 的提升,在一次執行中混用多個模型帶來約 5–6% 的提升(Ray Summit 講座,18:05–19:23)。
- 及早為規模作規劃。 一部手提電腦最多同時執行約六個容器,這正是各團隊轉用雲端沙箱的原因(全部三段講座)。
- 獎勵作弊就是 RL 中的過度擬合。 對待一個高得可疑的分數,要像對待低得可疑的驗證損失一樣(AI Engineer 講座,06:35)。
一個只知道如何執行某個工具的技能,無法告訴你這種方法何時會失效,也無法告訴你在沒有該工具的技術棧上該怎樣做。所以我們作了四項修改:
- 洞見是一等產出。 現在每個影片章節和每個技能都會記錄講者的推理、經驗教訓、結果和警示——每項都附時間戳記。
- 先原則,後工具。 Harbor 和 Terminal-Bench 只是應用某種方法的一種方式,而不是方法本身。
- 不做工具包裝。 每個技能都需要一個關鍵洞見章節和一條工具無關的路徑。拿走所有指令後,技能仍應能教會你一些東西。
- 驗證會檢查這一點。 每個技能必須包含至少三項有來源的洞見,否則無法通過結構檢查。
我們亦修正了一個小小的不一致。早期的任務說明寫的是「兩段影片」,卻列出了三個連結。Gemini 4 發現了這一點,在報告中加以說明,並分析了全部三段影片——而新的措辭適用於任何數量的影片。
讓代理開始工作
發送任務說明。Gemini 4 會規劃工作並啟動代理。之後,整個執行過程會按任務說明進行:
- 觀看 每段講座——字幕、畫面影格、簡報和現場示範——並保留時間戳記。
- 提煉 方法和洞見成為技能,每個技能都有自己的證據檔案。
- 驗證 技能,記錄哪些經過檢查、哪些已執行、哪些未測試。
- 生成報告 並在
127.0.0.1上提供服務。
在我們的執行中,代理下載了全部三段講座,擷取了 25 個以上的關鍵影格,取得完整的附時間戳記字幕,並對照官方文件核對了 Harbor 的細節——然後按任務說明的要求清除了下載的影片檔案。
開啟報告
報告會在本機伺服器上開啟——在我們的執行中是 http://127.0.0.1:8000。你會看到:
- 能力——代理具備甚麼、欠缺甚麼,由影片觀看到瀏覽器預覽。
- 摘要與來源——每段講座的頻道、發佈日期、長度、觀看次數和連結的程式碼庫。
- 每段講座一個章節——以私隱強化播放器嵌入影片,附時間戳記大綱和帶標籤的學習重點。
- 講座比較——它們的共識、分歧,以及如何互補彼此的缺口。
- 每個技能一個章節——用途、關鍵步驟、證據以及確切的驗證指令。
- 限制——哪些內容未經測試及其原因,例如雲端沙箱和付費模型 API。
解讀覆蓋矩陣
矩陣顯示哪個技能涵蓋 RL 工作流程的哪一部分——以及講座留下了哪些缺口。
| 重點範疇 | Task Scaffolder | Verifier & Anti-Cheat | Rollout Collector | SFT Dataset Preparer |
|---|---|---|---|---|
| 定義任務、觀測、動作和終止條件 | 主要 | 次要 | 主要 | - |
| 可重現的環境與重設 | 主要 | 次要 | 次要 | - |
| 建立驗證器與獎勵函數 | 次要 | 主要 | - | - |
| 偵測獎勵作弊與無效成功 | - | 主要 | 次要 | - |
| 收集、評分和審閱軌跡 | - | - | 主要 | 次要 |
| 為 SFT 訓練和評估準備數據 | - | - | - | 主要 |
| 缺口: RL 策略梯度數學與訓練器內部機制 | 未涵蓋 | 未涵蓋 | 未涵蓋 | 分開處理 |
| 缺口: 步驟層級的密集過程獎勵塑形 | 未涵蓋 | 只有結果獎勵 | 未涵蓋 | 未涵蓋 |
這兩行缺口很重要。講座提到 SkyRL 和 Tinker 等訓練器,但從未展示訓練迴圈——所以這些技能也不會假裝涵蓋它。
讓技能投入使用
每個技能都位於 rl-env-skills/ 下各自的資料夾:
sandboxed-task-environment-scaffolder——建立並驗證可重現的容器化任務。verifier-and-anti-cheat-auditor——建立結果驗證器,並審核當中的獎勵作弊。rollout-trajectory-collector-and-debugger——執行沙箱 rollout、記錄軌跡,並將失敗分類。trajectory-to-sft-dataset-preparer——將經驗證的軌跡過濾成乾淨的 SFT 數據,並與 RL 訓練嚴格分開。
讓協作代理讀取其中一個,並交給它一項真實的工作,例如:
Use rl-env-skills/verifier-and-anti-cheat-auditor/SKILL.md to design a verifier
for my "make this failing unit test pass" task. Flag any way an agent could
pass without fixing the bug.
技能包含流程、決策規則和成功檢查,證據檔案則記錄了出處——而有了新的任務說明,洞見亦會一併保留。
打造你自己的版本
這份任務說明適用於任何一組技術講座。替換影片連結和重點清單,其餘保持不變:
- 保留洞見規則。 正是它們把一本工具手冊變成得來不易的判斷力。
- 保留誠實規則。 能力檢查和論點標籤令產出值得信賴。
- 保留驗證步驟。 從未執行過的技能只是筆記,不是技能。
一個半小時的講座,不必永遠只是一個半小時的講座。把它們交給你的代理,並留住它們學到的東西。
鳴謝:使用 Gemini 4 和 Eigent 製作。講座來自 Mike Merrill(Ray Summit 2025)、Alex Shaw 和 Ryan Marten(AI Engineer),以及 Latent Space 上的 Terminal-Bench 創辦人,原片請到 YouTube 觀看。音樂:"Wallpaper" Kevin MacLeod (incompetech.com),採用 Creative Commons: By Attribution 4.0 授權。



