
书名:《Agent Runtime 工程化:从工具调用循环到可恢复执行系统》
作者:陈堂会
章节:第八章 Checkpoint、Resume、Rollback / 8.1 checkpoint 保存什么
电子版系列:查看完整目录
第八章 Checkpoint、Resume、Rollback:8.1 checkpoint 保存什么
一个 checkpoint 至少包含:
- session id、run id、step id;
- message history 或其可重建引用;
- 当前计划和 stop condition 状态;
- tool call 计划、执行结果、是否有副作用;
- 审批记录;
- 文件系统变更摘要;
- token/cost/step 预算;
- provider response id 或 continuation metadata;
- trace 位置。
示例:
type Checkpoint = {
id: string;
runId: string;
stepId: string;
createdAt: string;
messagesRef: string;
runState: RunState;
toolLedger: ToolLedgerEntry[];
fileSnapshot: FileSnapshot;
budget: BudgetState;
};
注意 toolLedger。它记录哪些工具已经执行、是否可重试、是否产生副作用。没有 ledger,resume 时很容易重复执行'发邮件''删文件''提交订单'这类不可重复动作。

