# 概览

Canonical URL: https://developers.iagenify.com/zh/sdk/agent/checkpoints/
Language: zh

工作空间在您每次发信息之前都被拍照。 回到一个文件时, 将每个文件都完全置于原样, 并直截了当地说出它无法撤销的东西。

Status: on by default · needs a session · 20 kept

撤消日志对代理器不起作用。 命令书写的文件没有前一版本, 在一个事实之后创建的文件“ ” 之前没有“ ” , 重命名没有反转。 因此引擎保存一个快照, 而不是一个反转列表 。

## 使用它 {#using}

```javascript
const agent = api.agents.create({
  runtime: "local", machine: pc, model: "gemini-3.5-flash",
  memory: true,                        // checkpoints need a session
  mode: "auto",
});

await agent.run({ inputs: "Rename every component to PascalCase." });
await agent.run({ inputs: "Now update the imports." });

const points = await agent.checkpoints();
// [{ n: 1, at, text: "Rename every component…", files: 184, partial: false, outside: [] },
//  { n: 2, at, text: "Now update the imports.",  files: 184, partial: false, outside: [] }]

await agent.rewind(2);     // back to just before the second message
```

## 一点是信息,不是一步 {#numbering}

`n` 计数 **您的** 返回到 `n` 恢复该信件之前的文件,从对话、设备日记和账户中删除信件和之后的所有内容。

## 后回回缩报告 {#returns}

```javascript
{
  n: 2,
  removed: { messages: 11, turns: 5 },
  files: { restored: [...], recreated: [...], deleted: [...], skipped: [...] },
  kept: ["send_mail", "deploy"],           // what left the machine and stays done
  credits: { spent: 24, refunded: 0 }
}
```

> **并退还:0是诚实的部分**
>
> 发送了一条信息。一个网站在网上公布。 已经花费的信用被花费了。 答案不是让“ 倒回 ” , 而是让他们的名字, 意味着世界被放回了。

## 需要的东西 {#requirements}

| 所需 | 否则 |
| --- | --- |
| `memory: true` | `session_required` - 没有任何届会可附加点数。 |
| 目前未回答 | `agent_running` - 打电话 `stop()` 头一个。 |
| `checkpoints` 未关机 | `checkpoints_disabled`. |
| 不是子试剂 | 亚试剂没有保留任何内容:它没有自己的谈话可剪切。 |

## 关掉它 {#turning-off}

```javascript
api.agents.create({ runtime: "local", machine: pc, model, memory: true, checkpoints: false });
```

在一个巨大的工作空间上,或者在储存配额比返回更重要的地方,一个无法接受的快照永远无法阻挡一个答案,却被跳过,而运行仍在继续。

- [快照的工作原理](/zh/sdk/agent/checkpoints/snapshots): 调试、重文件夹、跳过的内容。
- [回退无法撤销的操作](/zh/sdk/agent/checkpoints/limits): 诚实的名单
- [rewind()](/zh/sdk/ref/local-agent/rewind): 方法

```python
agent = api.agents.create(
    runtime="local", machine=pc, model="gemini-3.5-flash",
    memory=True,                         # checkpoints need a session
    mode="auto",
)

agent.run(inputs="Rename every component to PascalCase.")
agent.run(inputs="Now update the imports.")

points = agent.checkpoints()
# [{"n": 1, "at", "text": "Rename every component…", "files": 184, "partial": False},
#  {"n": 2, "at", "text": "Now update the imports.",  "files": 184, "partial": False}]

agent.rewind(2)     # back to just before the second message
```

```python
{
    "n": 2,
    "files": {"restored": [...], "recreated": [...], "deleted": [...], "skipped": [...]},
    "kept": [],                          # what left the machine and stays done
    "credits": {"spent": 0, "refunded": 0},
}
```

```python
api.agents.create(runtime="local", machine=pc, model=model, memory=True, checkpoints=False)
```
