agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Compat] Cubesandbox Snapshot API differs from official E2B: snapshotID vs names

Open chcodex opened this issue 3 months ago • 1 comments

Summary

Cubesandbox (api.e2b.cloud.ketanyun.cn) diverges from official E2B (api.e2b.app) on POST /sandboxes/{id}/snapshots. Official returns snapshotID as the qualified alias (team/alias:tag), while Cubesandbox returns snapshotID=snap-* with names=[alias] split. This breaks SDKs that rely on a single snapshotID for sorting / deletion / restore.

Environment

  • Cubesandbox: https://api.e2b.cloud.ketanyun.cn, template tpl-82396dde2e904b528b4f43f0
  • Official: https://api.e2b.app, template code-interpreter-v1
  • SDK e2b Python 2.x, agentscope-java E2B extension

Repro

from e2b import Sandbox
alias = "agentscope-7154fc21-1787668616509"
sbx = Sandbox.create(template=TEMPLATE, api_key=KEY, api_url=API_URL)
snap = sbx.create_snapshot(name=alias)
print(snap.snapshot_id, snap.names)
# Cubesandbox: snap-68a7bcd0083f4c658e6e56ef, ['agentscope-...']
# Official:    default-team-.../agentscope-...:default, ['default-team-.../agentscope-...']

Sandbox.create(template=snap.snapshot_id, api_key=KEY, api_url=API_URL) # cubesandbox snap-* ok, official ok
Sandbox.create(template=alias, api_key=KEY, api_url=API_URL)            # cubesandbox 500 130404 template not found, official ok
Sandbox.delete_snapshot(alias, api_key=KEY, api_url=API_URL)             # cubesandbox False, official via snapshot_id True

Raw HTTP POST /sandboxes/{id}/snapshots {"name": alias}:

  • Official: {"snapshotID":"default-team-.../agentscope-...:default","names":["default-team-.../agentscope-..."]}
  • Cubesandbox: {"snapshotID":"snap-68a7bcd0083f4c658e6e56ef","names":["agentscope-..."]}

GET /snapshots Cubesandbox additionally returns status, originSandboxID, createdAt but POST only returns 2 fields.

Contract

e2b/api/client/models/snapshot_info.py:

snapshot_id: Identifier including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID

SandboxSnapshotRequest only has name (alias); snapshotID is server-assigned.

Expected

snapshotID equals qualified names[0] as on official, so a single snapshotID supports sorting / deletion / restore.

Actual

Cubesandbox splits them: alias not restorable/deletable, snap-* not sortable. In agentscope-java the previous E2bSandboxState.snapshotIds stored only snapshotID, so Cubesandbox snapshots were treated as legacy and never pruned. Fixed in #2555 by retaining last N by insertion order (FIFO), which works for both formats, but alignment is still recommended.

Suggestion

Either align Cubesandbox snapshotID to qualified alias (team/alias:tag) or make alias also restorable/deletable (Sandbox.create(template=alias) and DELETE /templates/{alias}).

Attachments

  • uvx --with e2b logs and curl raw responses
  • UI showing 模板 ID=snap-5016072f801c46eb8cbbac23 vs 别名=agentscope-7154fc21-1787668616509

chcodex avatar Aug 26 '26 05:08 chcodex

误建于 agentscope-java,应报告至 Cubesandbox。关联 #2555 的 FIFO 兼容已合入,此 issue 关闭。

chcodex avatar Aug 26 '26 05:08 chcodex