Scripts2026年5月7日·1 分钟阅读

Daytona Snapshots — Reproducible AI Workspaces

Daytona Snapshots freeze a sandbox state — files, processes, environment — and create new sandboxes in milliseconds. Build agent tree search & benchmarks.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:New
入口
Asset
通用 CLI 安装命令
npx tokrepo install 9bdcb279-aab3-4554-ba02-eacb9dabf513

简介

Daytona Snapshot 把完整 sandbox 状态 —— 文件、装好的包、环境变量、甚至运行中进程(支持时)—— 冻结成不可变镜像。从快照启新 sandbox 毫秒级。适合 agent 树搜索算法、可复现 benchmark fixture、多个 agent 从同起点试不同方案的分支探索。需要 Daytona Python / TypeScript SDK。装机时间 1 分钟。


拍快照

from daytona import Daytona

daytona = Daytona()

# 搭基础环境
sandbox = daytona.create()
sandbox.process.exec("apt-get install -y postgresql")
sandbox.process.exec("git clone https://github.com/example/app /work")
sandbox.process.exec("cd /work && npm install")

# 冻结状态 —— 下游任务快速恢复
snapshot_id = sandbox.snapshot(name="app-base-2026-05-07")

从一个快照起多个 sandbox

# 每个 sandbox 都从快照状态开始 —— 不重装、不重 clone
sb_lint = daytona.create_from_snapshot(snapshot_id)
sb_test = daytona.create_from_snapshot(snapshot_id)
sb_e2e = daytona.create_from_snapshot(snapshot_id)

# 并行跑不同的事情
sb_lint.process.exec("npm run lint")
sb_test.process.exec("npm test")
sb_e2e.process.exec("npx playwright test")

Agent 树搜索

def explore(snapshot, depth=0, max_depth=3):
    if depth >= max_depth:
        return evaluate(snapshot)

    candidates = generate_next_actions(snapshot)
    best_score = -float("inf")
    best_action = None

    for action in candidates:
        sb = daytona.create_from_snapshot(snapshot)
        sb.process.exec(action.command)
        new_snapshot = sb.snapshot()
        score = explore(new_snapshot, depth + 1, max_depth)
        if score > best_score:
            best_score, best_action = score, action

    return best_score

每个分支都是带真实状态的真实 sandbox —— agent 能跑测试、观察失败、基于真实结果决策,而不是幻觉预测。

可复现 benchmark

# Bench fixture —— SWE-Bench / HumanEval 等的冻结状态
fixture = daytona.create_from_snapshot("swebench-django-3.2.fixture")

# 打 agent 的补丁
fixture.fs.upload_file("/repo/patch.diff", patch_text)
fixture.process.exec("cd /repo && git apply patch.diff")

# 跑测试套件
result = fixture.process.exec("cd /repo && pytest tests/django/")
score(result)

每次模型跑用同一个 fixture —— 没有 flaky 环境差异。


FAQ

Q: Snapshot 免费吗? A: Snapshot 算进 Daytona 存储配额。免费档含一定 snapshot 存储;生产用按 GB-月计费。看 daytona.io/pricing 拿当前费率。

Q: Snapshot 能多大? A: Snapshot 能到几十 GB(完整 Linux + 依赖 + 数据)。Daytona 底层用写时复制 —— 从 snapshot 起 sandbox 不复制数据,从一个 snapshot 起很多分支成本很低。

Q: Snapshot 跨账号能共享吗? A: 能 —— snapshot 可以公开或在组织内共享。给团队分发 benchmark fixture 或起步环境很有用。


🙏

来源与感谢

Built by Daytona. Apache-2.0 (core).

daytona.io/docs — Snapshots documentation

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产