长任务 Agent 怎么做检查点How to Add Checkpoints to Long-Running Agents
微型指南 · 约 8 分钟Guide · about 8 min · 引用核验 2026-11-19(仅引用链接与日期) · refs checked 2026-11-19 (reference links and dates only)
长任务不怕慢,怕的是一步错、全盘重来;检查点是把「可恢复」设计进流程。Long jobs are not afraid of being slow; they are afraid of one bad step forcing a full restart. Checkpoints design recoverability into the flow.
把任务切成可验证的阶段,每阶段有明确产物与成功条件;不要用「继续做」当阶段。
每阶段结束写结构化状态:目标、已完成、未完成、关键决策、外部 ID、花费。
副作用操作(发消息、下单、改文件)前先落检查点;失败时知道做过什么、没做什么。
恢复时先读状态再行动;不要凭对话历史猜进度。
设最大步数、预算与时限,超限暂停并请求人工;不要无限重试。
记录「不可逆操作」清单;恢复时默认不重放,先核对外部状态。
Cut the job into verifiable stages, each with a clear artefact and success condition; “keep going” is not a stage.
At the end of each stage write structured state: goal, done, not done, key decisions, external IDs, spend.
Checkpoint before side effects (send, order, edit a file), so a failure knows what was and was not done.
On resume, read the state before acting; never guess progress from chat history.
Set maximum steps, budget and time; stop and ask a human when exceeded. Do not retry forever.
Keep a list of irreversible actions; on resume, do not replay by default — verify external state first.
例子与判断Example and interpretation
以下是教学情境,不是本站运行或实测记录。A teaching scenario, not a measured or executed site test.
把「整理 20 封客户邮件并起草回复」拆成读取、分类、起草、审批四段;每段结束写一行状态(已处理几封、哪些待确认、花了多少 token)。中途杀掉进程,恢复后先读状态再继续,不重发已批准的邮件。Split "triage 20 customer emails and draft replies" into read, classify, draft and approve. After each stage write one state line: how many processed, what needs confirmation, tokens spent. Kill the process midway; on resume read the state first and never resend approved mail.
做完例子后怎么检查How to check your practice
先用自己的话解释上面的判断,再检查输入条件,最后回原文验证。说不清原因时回概念;缺日期、字段或权限时补输入;结论无出处时先撤回结论。Explain the example in your own words, inspect input constraints, then verify against the source. Revisit concepts if you cannot explain why; supply missing dates, fields or permissions; withdraw unsupported conclusions.
按这篇主题,先从“概念没分清”练习查起For this topic, start with concept confusion · 查看全部六个情境与理由See all six scenarios and their reasoning
长时任务Long-running Task 子代理隔离Sub-agent Isolation 人工复核队列Human Review Queue
怎么用 AI 做会议纪要[object Object] · 怎么用 AI 做 PPT[object Object] · 怎么用 AI 分析表格[object Object] · 怎么用 AI 写邮件与排日程[object Object]