Agent Build智能体搭建 Tutor教程
Map地图 / Module模块 15 / labs/m15_*

Operations and deployment运维与部署

Supervision, scheduling, logs, backups, and recovery, so the system runs when nobody is watching.进程守护、调度、日志、备份和恢复,让系统在没人盯着的时候也能运行。

What it is and why it exists它是什么,为什么需要它

What是什么

Operations covers how services start and restart, how background work yields to live traffic, how you see what is up, and how data is backed up and restored.运维涵盖:服务如何启动和重启、后台任务如何给实时流量让路、如何查看哪些服务在运行,以及数据如何备份和恢复。

Why为什么

An agent that works in a terminal session and dies on reboot is a demo. Most of the reference build's lost time came from operational causes: a stripped service environment, a noisy probe, single-writer stores, backups on the volume they protected.只能在终端会话里运行、一重启就挂掉的智能体只是个演示。参考系统损失的大部分时间都源于运维问题:服务启动环境被精简、探针产生大量噪音、单写入方存储、备份放在它要保护的同一个卷上。

How it works工作原理

Where it sits in the build order它在搭建顺序中的位置

Needs first前置模块

  • Inference engineering推理工程The engine is the first service to supervise, and its memory limits decide what may run at the same time.引擎是第一个需要守护的服务,它的内存上限决定了哪些东西可以同时运行。Build out of order不按顺序搭建 Stand in with:可用以下替代: Start services by hand in terminal tabs.在终端标签页里手动启动服务。
  • Harness engineeringHarness 工程The agent server is the main service. Its health path and busy marker are what the supervisor and scheduler read.智能体服务是主服务。守护进程和调度器读取的正是它的健康检查路径和忙碌标记。Build out of order不按顺序搭建 Stand in with:可用以下替代: Supervise the engine alone.只守护引擎。
  • Evaluation评估Scheduled evals and the daily report are how you learn that a change made things worse.定时评估和每日报告,是你得知某次改动让情况变糟的途径。Build out of order不按顺序搭建 Stand in with:可用以下替代: A manual smoke test after each change.每次改动之后手动做一次冒烟测试。

Unlocks解锁

Nothing depends on this. It is an end point of the map.没有模块依赖它。它是地图上的一个终点。

In the reference build在参考系统中

Path路径Role作用
Install-Autostart.commandInstalls supervised services.安装受守护的服务。
Check-All-LLM-Status.commandOne-screen status of every service and model.一屏显示所有服务和模型的状态。
apps/agent-server/nightly/scheduler.pyDuty cycle and preemption.占空比控制和抢占。
apps/ops/pg_backup.shDatabase backup, with a restore test beside it.数据库备份,旁边配有恢复测试。
SOP-LLM-OPERATIONS.mdOperating procedures.操作规程。

Process map流程图

A background unit of work meets a live request后台工作单元遇上实时请求

  1. 1
    Window opens时间窗开启The scheduler starts at a set hour with a list of small units.调度器在设定的时刻启动,带着一串小的工作单元。
  2. 2
    Busy?忙吗?Before each unit, check the marker file.每个单元开始前,检查标记文件。
  3. 3
    Wait等待A live request holds the marker until its answer is fully sent.实时请求在回答完全发出之前一直持有标记。
  4. 4
    Run one unit运行一个单元Small enough to finish in seconds.足够小,几秒内就能完成。
  5. 5
    Budget预算Stop when the duty share or the window is used up.占空比或时间窗用完时停止。
  6. 6
    Report报告What ran, what waited, what was skipped.运行了什么、等待了什么、跳过了什么。

Build steps搭建步骤

Follow them in order the first time. Each step names what it uses from earlier steps and what it leaves for later ones. Code is read from the lab files, and output is what the lab printed when it was run.第一次请按顺序做。每一步都写明它用到前面步骤的什么成果,又为后面的步骤留下什么。代码直接读取自 lab 文件,输出是 lab 实际运行时打印的内容。

  1. 1List every service, its port, and its interpreter列出每个服务、它的端口和解释器
  2. 2Put each service under the supervisor把每个服务交给守护进程
  3. 3Write one status command写一条状态命令
  4. 4Add the busy marker to the server给服务加上忙碌标记
  5. 5Schedule background work with preemption and a duty cycle用抢占和占空比来调度后台任务
  6. 6Back up what cannot be reproduced, and test the restore备份无法重新生成的东西,并测试恢复
  7. 7Rotate logs and keep signal apart from noise轮转日志,并把信号与噪音分开
  8. 8Wire the nightly window把夜间时间窗串起来
  9. 9Adopt a change discipline建立改动纪律
01List every service, its port, and its interpreter列出每个服务、它的端口和解释器
Why this step is here为什么这一步排在这里You cannot supervise what you have not listed. The list also exposes two services sharing a port or needing different environments.没列出来的东西无法守护。这份清单还能暴露两个服务共用端口或需要不同运行环境的情况。

Do this操作

  1. For each long-running process write: name, port, the absolute path of its interpreter, its working directory, its log file.为每个长期运行的进程写下:名称、端口、解释器的绝对路径、工作目录、日志文件。
  2. Note which virtual environment each uses. A service started with the wrong one fails at launch.注明每个服务使用哪个虚拟环境。用错环境启动的服务会在启动时失败。
You are done when完成标志Every port in use on the machine is on the list.机器上每个正在使用的端口都在清单上。
Produces产出A service inventory.一份服务清单。
02Put each service under the supervisor把每个服务交给守护进程Not executed in the labslab 中未执行
Why this step is here为什么这一步排在这里Supervision is the first operational step because everything after it assumes services come back by themselves.守护是运维的第一步,因为之后的一切都默认服务会自己恢复。

Do this操作

  1. Write one unit file per service from the inventory.根据清单为每个服务写一个单元文件。
  2. Use absolute paths everywhere. The supervisor starts with a minimal PATH and no shell profile.所有地方都用绝对路径。守护进程启动时 PATH 很精简,也不会加载 shell 配置。
  3. Turn on keep-alive and run-at-load.开启自动重启和开机自启。
  4. Kill the process and confirm it restarts.杀掉进程,确认它自动重启。
labs/m15_ops/units/com.example.agent-server.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- macOS. Copy to ~/Library/LaunchAgents/, replace AGENT_HOME, then:
     launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.agent-server.plist
     launchd starts services with a minimal PATH and no shell profile, so every path here is absolute. -->
<plist version="1.0"><dict>
  <key>Label</key><string>com.example.agent-server</string>
  <key>ProgramArguments</key>
  <array>
    <string>AGENT_HOME/venv/bin/python3</string>
    <string>-m</string><string>uvicorn</string><string>main:app</string>
    <string>--host</string><string>127.0.0.1</string><string>--port</string><string>8788</string>
  </array>
  <key>WorkingDirectory</key><string>AGENT_HOME</string>
  <key>EnvironmentVariables</key>
  <dict><key>PATH</key><string>/opt/homebrew/bin:/usr/bin:/bin</string></dict>
  <key>KeepAlive</key><true/>
  <key>RunAtLoad</key><true/>
  <key>StandardOutPath</key><string>AGENT_HOME/logs/agent-server.log</string>
  <key>StandardErrorPath</key><string>AGENT_HOME/logs/agent-server.log</string>
</dict></plist>

The Linux equivalents are in the same folder: a systemd service and a timer.Linux 下的对应文件在同一目录:一个 systemd service 和一个 timer。

This step describes work on your own machine or account. Its commands were not run when the labs were tested.这一步描述的是在你自己的机器或账号上的操作。测试 lab 时没有运行这些命令。

Checked on the reference machine在参考机器上的检查结果Not checked on a machine yet. On your own machine run the command below. It only reads, and it writes the result here when you add --write.还没有在机器上检查过。在你自己的机器上运行下面的命令。它只做读取操作;加上 --write 后会把结果写到这里。
run
python3 labs/machine/check.py --write
You are done when完成标志After `kill`, the service is back within seconds, and after a reboot every service is up.执行 `kill` 之后服务在几秒内恢复;重启机器后所有服务都在运行。
Produces产出Services that survive crashes and reboots.能扛住崩溃和重启的服务。
Feeds供给No later step consumes this directly.没有后续步骤直接使用它。
03Write one status command写一条状态命令
Why this step is here为什么这一步排在这里After supervision, you need to see state in one place. This is also what the watchdog calls.有了守护之后,你需要在一个地方看到全部状态。看门狗调用的也是它。
Uses用到

Do this操作

  1. Probe each service's unauthenticated health path with a short timeout.用较短的超时探测每个服务的无认证健康检查路径。
  2. Print one line per service: up or down, and the reason.每个服务输出一行:在线或离线,以及原因。
  3. Never send a key from the probe. Liveness needs none.探针里绝不发送密钥。存活检查不需要它。
labs/m15_ops/status.py · status
def probe(url: str, timeout: float = 3.0) -> dict:
    t0 = time.time()
    try:
        with urllib.request.urlopen(url, timeout=timeout) as r:
            return {"url": url, "up": 200 <= r.status < 300, "ms": int((time.time() - t0) * 1000), "detail": r.status}
    except Exception as e:  # noqa: BLE001
        return {"url": url, "up": False, "ms": int((time.time() - t0) * 1000), "detail": type(e).__name__}


def report(services: dict) -> str:
    lines = []
    for name, url in services.items():
        p = probe(url)
        lines.append(f"{'UP  ' if p['up'] else 'DOWN'} {name:14s} {p['detail']}")
    return "\n".join(lines)
run
python3 -m labs.m15_ops.demo
Recorded output / 记录的输出 · m15.demo
1 status:
   UP   gateway        200
   DOWN engine         URLError
You are done when完成标志The running gateway shows UP and the unreachable address shows DOWN with a reason.运行中的网关显示 UP,无法访问的地址显示 DOWN 并附原因。
Produces产出`report()`: the daily driver.`report()`:日常最常用的命令。
04Add the busy marker to the server给服务加上忙碌标记
Why this step is here为什么这一步排在这里The marker has to exist before any background job, because it is the only way a job learns that a user is waiting.在任何后台任务出现之前,这个标记就得存在,因为它是任务得知“有用户在等”的唯一途径。

Do this操作

  1. Wrap every live request in a context manager that creates a file and removes it afterward.用一个上下文管理器包裹每个实时请求:开始时创建文件,结束后删除。
  2. Hold it for the whole streamed answer, not only until the first token.在整个流式回答期间都要持有它,而不是只到第一个 token。
  3. Treat a marker older than a few minutes as left by a crash.把存在超过几分钟的标记视为崩溃遗留的。
labs/m15_ops/scheduler.py · busy
@contextmanager
def busy(marker: Path):
    """Wrap every live request in this."""
    marker.write_text(str(time.time()))
    try:
        yield
    finally:
        marker.unlink(missing_ok=True)


def is_busy(marker: Path, stale_after: float = 600) -> bool:
    """A marker older than stale_after is from a crashed request and is ignored."""
    try:
        return time.time() - marker.stat().st_mtime < stale_after
    except FileNotFoundError:
        return False
You are done when完成标志The file exists during a request and is gone after it.请求期间文件存在,请求结束后文件消失。
Produces产出`busy()` and `is_busy()`.`busy()` 和 `is_busy()`。
05Schedule background work with preemption and a duty cycle用抢占和占空比来调度后台任务
Why this step is here为什么这一步排在这里It needs the marker. It is what lets evals and the learning loop share one machine with live users.它依赖忙碌标记。正是它让评估和学习循环能与在线用户共用一台机器。

Do this操作

  1. Break every job into units that finish in seconds.把每个任务拆成几秒内就能完成的单元。
  2. Before each unit: wait while the marker is present.每个单元开始前:只要标记存在就等待。
  3. Stop starting units when the duty share of the window is spent, or the window has closed.当时间窗内的占空比用完或时间窗关闭时,不再启动新单元。
  4. Log what ran, waited, and was skipped.记录哪些运行了、哪些等待了、哪些被跳过。
labs/m15_ops/scheduler.py · scheduler
def run_window(jobs: Iterable, marker: Path, window_s: float, duty: float = 0.5,
               clock: Callable = time.time, sleep: Callable = time.sleep) -> list:
    """jobs yields (name, unit_fn). Each unit is small enough to finish in seconds.

    duty      share of the window background work may use; the rest stays idle
    preempt   before every unit, if a live request is in flight, wait
    """
    log, start, worked = [], clock(), 0.0
    for name, unit in jobs:
        while is_busy(marker):
            log.append((name, "waited: live request"))
            sleep(0.05)
        if clock() - start >= window_s:
            log.append((name, "skipped: window closed"))
            continue
        if worked >= duty * window_s:
            log.append((name, "skipped: duty budget spent"))
            continue
        t0 = clock()
        unit()
        worked += clock() - t0
        log.append((name, "ran"))
    return log
Recorded output / 记录的输出 · m15.demo
2 scheduler: units run [0, 1, 2, 3, 4, 5] | paused yes while a live request held the marker
3 duty 50% of a 0.2 s window: ['ran', 'ran', 'ran', 'ran', 'skipped', 'skipped']
You are done when完成标志All units run, with a pause while the live request held the marker. With a 50 percent duty the last units are skipped.所有单元都运行了,实时请求持有标记期间有一次暂停。占空比为 50% 时,最后几个单元被跳过。
Produces产出`run_window()`: used to run evals and the nightly loop.`run_window()`:用来运行评估和夜间循环。
06Back up what cannot be reproduced, and test the restore备份无法重新生成的东西,并测试恢复
Why this step is here为什么这一步排在这里Backups come once there is state worth keeping. The restore test is part of the same step because an untested backup is a hope.有了值得保留的状态,就该做备份。恢复测试属于同一步,因为没有测试过的备份只是一种希望。
Uses用到

Do this操作

  1. List what is irreplaceable: databases, keys, prompts, skills, eval sets, scripts.列出不可替代的东西:数据库、密钥、提示词、技能、评估集、脚本。
  2. Skip what can be downloaded again: model weights, source documents.跳过可以重新下载的东西:模型权重、原始文档。
  3. Use the database's online backup so a copy taken during writes is consistent.使用数据库的在线备份功能,保证写入过程中取得的副本是一致的。
  4. After each backup: open it, run an integrity check, compare row counts with the live database.每次备份之后:打开它,运行完整性检查,把行数与在线数据库比较。
  5. Send one encrypted copy off the machine.把一份加密副本发送到机器之外。
labs/m15_ops/backup.py · backup
def backup(db_path: Path, dest_dir: Path, keep: int = 7) -> Path:
    """Online backup: consistent even while the database is being written."""
    dest_dir.mkdir(parents=True, exist_ok=True)
    dest = dest_dir / f"{db_path.stem}-{time.strftime('%Y%m%d-%H%M%S')}.db"
    src, out = sqlite3.connect(str(db_path)), sqlite3.connect(str(dest))
    with out:
        src.backup(out)
    src.close()
    out.close()
    for old in sorted(dest_dir.glob(f"{db_path.stem}-*.db"))[:-keep]:      # keep the newest N
        old.unlink()
    return dest


def restore_test(live: Path, backup_file: Path, tables: list) -> dict:
    """A backup that was never restored is a hope. Open it, check integrity, compare row counts."""
    a, b = sqlite3.connect(str(live)), sqlite3.connect(str(backup_file))
    ok = b.execute("PRAGMA integrity_check").fetchone()[0] == "ok"
    counts = {t: (a.execute(f"SELECT count(*) FROM {t}").fetchone()[0],
                  b.execute(f"SELECT count(*) FROM {t}").fetchone()[0]) for t in tables}
    a.close()
    b.close()
    return {"integrity": ok, "counts": counts, "match": ok and all(x == y for x, y in counts.values())}
Recorded output / 记录的输出 · m15.demo
4 backup: agent-202...db | restore test: {'integrity': True, 'counts': {'kb_chunks': (20, 20), 'kb_edges': (18, 18)}, 'match': True}
You are done when完成标志The restore test reports integrity True and matching counts.恢复测试报告完整性为 True,行数一致。
Produces产出`backup()` and `restore_test()`.`backup()` 和 `restore_test()`。
07Rotate logs and keep signal apart from noise轮转日志,并把信号与噪音分开
Why this step is here为什么这一步排在这里Other jobs read your logs: self-observation reads them every night. Noise in a log that a job reads is how a signal stops being seen.别的任务会读你的日志:自我观察每晚都读。任务要读的日志里混进噪音,信号就会被淹没。

Do this操作

  1. Keep structured request and tool logs in their own files, apart from server output.把结构化的请求日志和工具日志放在独立的文件里,与服务输出分开。
  2. Rotate by size or date on a schedule.按大小或日期定时轮转。
  3. When a probe or a test fills a log, fix the probe. Do not filter the log.当某个探针或测试把日志刷满时,修的是探针,而不是去过滤日志。
labs/m15_ops/logs.py · rotate
def rotate(log: Path, keep: int = 3, max_bytes: int = 2_000) -> bool:
    """Size-based copytruncate. log -> log.1 -> log.2 ... oldest dropped. Returns True if rotated."""
    if not log.exists() or log.stat().st_size < max_bytes:
        return False
    for i in range(keep - 1, 0, -1):
        older = log.with_name(f"{log.name}.{i}")
        if older.exists():
            older.replace(log.with_name(f"{log.name}.{i + 1}"))
    shutil.copy2(log, log.with_name(log.name + ".1"))
    with log.open("r+") as f:
        f.truncate(0)
    return True
on your machine (Linux)
# /etc/logrotate.d/agent
/srv/agent/logs/*.log /srv/agent/logs/*.jsonl {
  daily
  rotate 14
  compress
  missingok
  copytruncate
}

With copytruncate a job that tracks a byte offset must reset its cursor when the file shrinks.使用 copytruncate 时,按字节偏移量跟踪的任务必须在文件变小时重置游标。

run
python3 -m labs.m15_ops.logs
Recorded output / 记录的输出 · m15.logs
1 tool log 40 lines, only tool calls | server log 800 lines of probe noise kept apart
2 first read: naive cursor 40 lines, fixed cursor 40 lines
3 rotated: True | size now 0 bytes | kept ['tool_calls.jsonl.1']
4 after rotation and 3 new calls: naive cursor read 0 | fixed cursor read 3
5 five more rotations: files ['tool_calls.jsonl', 'tool_calls.jsonl.1', 'tool_calls.jsonl.2', 'tool_calls.jsonl.3'] | largest 2270 bytes
You are done when完成标志After rotation the fixed cursor reads the 3 new lines and the naive cursor reads none. The tool log holds only tool calls, and its files stay bounded.轮转之后,修正后的游标读到 3 行新内容,而原始游标一行也读不到。工具日志里只有工具调用,文件大小始终有上限。
Produces产出Logs that stay readable by people and by jobs.人和任务都能持续读懂的日志。
Feeds供给No later step consumes this directly.没有后续步骤直接使用它。
08Wire the nightly window把夜间时间窗串起来Not executed in the labslab 中未执行
Why this step is here为什么这一步排在这里This joins operations to evaluation and self-evolution. It is last among the runtime steps because it schedules everything built before it.这一步把运维与评估、自进化连在一起。它在运行时步骤里排最后,因为它调度的是之前搭建的一切。

Do this操作

  1. Create a timer that opens the window at a quiet hour.创建一个定时器,在空闲时段开启时间窗。
  2. In the window run, in order: backup, retrieval eval, the learning loop in report mode, the agent eval weekly.在时间窗内按顺序运行:备份、检索评估、报告模式的学习循环、每周一次的智能体评估。
  3. Write one report with a line per job: latest value, previous value, anything skipped.生成一份报告,每个任务一行:最新值、上一次的值、被跳过的内容。
labs/m15_ops/units/agent-nightly.timer
# Linux. Pair with an agent-nightly.service that runs the nightly loop once.
[Unit]
Description=Nightly learning window

[Timer]
OnCalendar=*-*-* 01:00:00
Persistent=true

[Install]
WantedBy=timers.target

This step describes work on your own machine or account. Its commands were not run when the labs were tested.这一步描述的是在你自己的机器或账号上的操作。测试 lab 时没有运行这些命令。

Checked on the reference machine在参考机器上的检查结果Not checked on a machine yet. On your own machine run the command below. It only reads, and it writes the result here when you add --write.还没有在机器上检查过。在你自己的机器上运行下面的命令。它只做读取操作;加上 --write 后会把结果写到这里。
run
python3 labs/machine/check.py --write
You are done when完成标志The morning report exists, and every job appears in it as ran, waited, or skipped.早上的报告已生成,每个任务都以“已运行、等待过、被跳过”之一出现在其中。
Produces产出A system that measures and maintains itself every night.一个每晚自我测量、自我维护的系统。
Feeds供给No later step consumes this directly.没有后续步骤直接使用它。
09Adopt a change discipline建立改动纪律Not executed in the labslab 中未执行
Why this step is here为什么这一步排在这里Last, because it governs every change you make from now on to all fifteen modules.放在最后,因为从现在起你对全部十五个模块的每次改动都受它约束。

Do this操作

  1. Before editing a running file, save a dated copy beside it.编辑正在运行的文件之前,在旁边保存一份带日期的副本。
  2. One change per commit. Write the commit subject as what was learned.每次提交只做一个改动。提交标题写的是学到了什么。
  3. Put new behavior behind a flag, run the eval both ways, then change the default.新行为放在开关后面,开和关各跑一次评估,再改默认值。
  4. After a deploy, run the status command and the smoke questions.部署之后,运行状态命令和冒烟问题。

This step describes work on your own machine or account. Its commands were not run when the labs were tested.这一步描述的是在你自己的机器或账号上的操作。测试 lab 时没有运行这些命令。

Checked on the reference machine在参考机器上的检查结果Not checked on a machine yet. On your own machine run the command below. It only reads, and it writes the result here when you add --write.还没有在机器上检查过。在你自己的机器上运行下面的命令。它只做读取操作;加上 --write 后会把结果写到这里。
run
python3 labs/machine/check.py --write
You are done when完成标志For your last change you can show the flag, the two eval lines, and the commit.对你最近的一次改动,你能拿出开关、两行评估结果和对应的提交。
Produces产出A history in which every change has a reason and a measurement.一份历史记录,其中每次改动都有理由和测量结果。
Feeds供给No later step consumes this directly.没有后续步骤直接使用它。

How it works with the other parts它如何与其他部分协作

What went wrong in the real build真实搭建中踩过的坑

2026-07

A service that ran by hand and failed under the supervisor手动能跑、交给守护进程就失败的服务

What happened发生了什么
The supervisor's minimal PATH hid a binary, and a unit pointed at the wrong virtual environment.守护进程精简的 PATH 让某个可执行文件找不到,另一个单元文件指向了错误的虚拟环境。
Fix修复
Absolute paths in every unit, and the interpreter path recorded in the inventory.所有单元文件都用绝对路径,并在清单里记录解释器路径。
Lesson教训
The supervisor's environment is not your shell's.守护进程的运行环境和你的 shell 不是一回事。
2026-08

Backups on the volume they protected备份放在它要保护的那个卷上

What happened发生了什么
Backups covered accidental deletion and would not have survived a drive failure.这样的备份能应对误删,却扛不住磁盘损坏。
Fix修复
An encrypted offsite copy on a schedule, and a restore test.定时生成加密的异地副本,并做恢复测试。
Lesson教训
Name the failure each backup protects against.每一份备份防的是哪种故障,要明确写出来。
2026-10

The learner ran through a chat answer学习任务在聊天回答期间照常运行

What happened发生了什么
The busy marker was released when the response started, so background work resumed while tokens were still streaming.忙碌标记在响应开始时就被释放了,于是 token 还在流式输出时后台任务就恢复了。
Fix修复
Hold the marker until the streamed response finishes.把标记一直持有到流式响应结束。
Lesson教训
Busy means until the user has the whole answer.“忙”的意思是:直到用户拿到完整的回答为止。
2026-10

A helper process that grew to 71 GB一个辅助进程涨到了 71 GB

What happened发生了什么
A reranker's buffer cache grew without bound and took memory from the models.某个重排模型的缓冲区缓存无限增长,占用了模型所需的内存。
Fix修复
Cap and release the cache, and include process memory in the status command.给缓存设上限并定期释放,同时在状态命令里加入进程内存。
Lesson教训
Every process on the machine is part of the memory budget.机器上的每个进程都属于内存预算的一部分。

The same idea on other platforms同样的思路在其他平台上

Platform平台How this module maps本模块如何对应
DatabricksAgent Runtime, Jobs, and Apps are supervised by the platform. You own versions, permissions, cost alerts, and promotion between workspaces with asset bundles.Agent Runtime、Jobs 和 Apps 由平台负责守护。你负责的是版本、权限、成本告警,以及用 asset bundle 在工作区之间做发布。
IBM watsonxThe platform runs the services. You own environments, deployment spaces, and promotion between them.服务由平台运行。你负责的是环境、deployment space 以及它们之间的发布。
CodexOperations here means CI: headless runs, sandbox settings, and secrets handling for the agent.这里的运维指的是 CI:无界面运行、沙箱设置以及智能体的密钥管理。
CursorSame: team rules in the repo, background agent settings, and secrets.同理:仓库里的团队规则、后台智能体的设置和密钥。
Claude Code / Agent SDKHeadless runs in CI, managed settings, and permission policies. A service built on the SDK is operated like any other service.CI 中的无界面运行、集中管理的设置和权限策略。基于 SDK 构建的服务,运维方式与其他服务一样。
Another machinesystemd units and timers in place of launchd. The lab's scheduler, status, and backup code is plain Python.用 systemd 的 unit 和 timer 代替 launchd。lab 的调度器、状态检查和备份代码都是纯 Python。

Step-by-step guides per platform各平台的分步指南

Explain it back讲给自己听

Answer aloud first. Then open the answer and compare.先自己说一遍答案,再展开对照。

Which files do you back up, and which do you not?哪些文件要备份,哪些不用?
A strong answer参考答案Back up what cannot be reproduced: databases, keys, prompts, skills, eval sets, scripts. Skip model weights and source documents that can be downloaded again.备份无法重新生成的东西:数据库、密钥、提示词、技能、评估集、脚本。跳过可以重新下载的模型权重和原始文档。
A service runs fine by hand and fails under the supervisor. What is the usual cause?一个服务手动运行正常,交给守护进程就失败。通常是什么原因?
A strong answer参考答案Environment. The supervisor starts with a minimal PATH and no shell profile, so a binary or virtual environment is not found. Use absolute paths in the unit.运行环境。守护进程启动时 PATH 很精简、不加载 shell 配置,所以找不到某个可执行文件或虚拟环境。在单元文件里使用绝对路径。
Why does the busy marker come before the scheduler?为什么忙碌标记要先于调度器?
A strong answer参考答案The scheduler's only way to know a user is waiting is the marker. Without it, a background job and a chat compete for the same model and the user loses.调度器得知有用户在等的唯一途径就是这个标记。没有它,后台任务和聊天会争抢同一个模型,吃亏的是用户。
What happens in the nightly window, in what order, and why that order?夜间时间窗里发生什么?按什么顺序?为什么?
A strong answer参考答案Backup first, so a bad night can be undone. Then the retrieval eval, which is cheap and tells you whether search still works. Then the learning loop in report mode. The agent eval runs weekly because it is the most expensive.先备份,这样出了问题可以撤销。然后是检索评估,它便宜,能告诉你检索是否还正常。接着是报告模式的学习循环。智能体评估每周运行一次,因为它开销最大。

Terms术语

Supervisor进程守护The OS service that starts processes and restarts them when they exit.操作系统中负责启动进程、并在其退出后重启的服务。
Duty cycle占空比The share of a window background work may use.后台任务在时间窗内可以占用的比例。
Preemption抢占Pausing background work when live work arrives.实时任务到来时暂停后台任务。
Restore test恢复测试Opening a backup and checking it, on a schedule.定期打开备份并对其进行检查。

From the live build来自实时构建

Recent changes and files the sync job filed under this module. These lines are in English as written in the build.同步任务归到本模块下的近期变更和文件。这些内容保留了构建系统中的英文原文。

Ask the tutor about this module就本模块向导师提问