Agent Skills › dtyq/magic › sandbox-manager

sandbox-manager

GitHub

管理当前Agent运行沙箱的环境,支持检查状态、版本及执行升级或重启操作。适用于用户询问沙箱信息或明确要求更新环境时。

backend/super-magic/agents/skills/sandbox-manager/SKILL.md dtyq/magic

触发场景

查询沙箱状态或版本 请求升级沙箱环境 请求重启沙箱

安装

npx skills add dtyq/magic --skill sandbox-manager -g -y
更多选项

非标准路径

npx skills add https://github.com/dtyq/magic/tree/master/backend/super-magic/agents/skills/sandbox-manager -g -y

不安装直接使用

npx skills use dtyq/magic@sandbox-manager

指定 Agent (Claude Code)

npx skills add dtyq/magic --skill sandbox-manager -a claude-code -g -y

安装 repo 全部 skill

npx skills add dtyq/magic --all -g -y

预览 repo 内 skill

npx skills add dtyq/magic --list

SKILL.md

Frontmatter
{
    "name": "sandbox-manager",
    "description": "Inspect, upgrade, or restart the sandbox this Agent is running in. Use when the user asks about this Agent's sandbox or virtual machine status, Agent image version, or explicitly asks to upgrade or restart its current environment."
}

Sandbox Manager

This skill manages the execution environment hosting the current Agent. “Current sandbox” means the environment running this Agent process, not an arbitrary sandbox selected by the user.

User terminology

In this product, “virtual machine”, “VM”, and “virtual machine environment” are user-facing names for the current sandbox hosting this Agent. Treat requests to inspect, upgrade, or restart that virtual machine as requests for the corresponding sandbox operation. Do not interpret them as requests to manage the host machine or another sandbox.

These are Code Mode tools. Execute every example through run_sdk_snippet with sdk.tool.call(...); do not invent or pass a sandbox ID.

Read the result correctly

result.content is the model-facing summary. result.data is the structured payload for programmatic decisions. A run_sdk_snippet call only exposes its standard output to the outer Agent, so print both values when inspecting a result.

Use this error pattern:

if not result.ok:
    print(result.content)
    raise SystemExit(1)

Inspect the current sandbox

Use get_sandbox_info for the current sandbox ID, runtime status, current Agent image version, latest available version, and update flag.

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("get_sandbox_info", {})
if not result.ok:
    print(result.content)
    raise SystemExit(1)

print(result.content)
print(result.data)

data = result.data
if data["needs_update"]:
    print("Latest image:", data["latest_version"])
""")

Typical result.content:

Current sandbox information:
- Sandbox ID: sandbox_example
- Status: Running
- Current Agent image version: v1
- Latest Agent image version: v2
- Update needed: yes

Typical result.data:

{
  "sandbox_id": "sandbox_example",
  "status": "Running",
  "current_version": "v1",
  "latest_version": "v2",
  "needs_update": true
}

status is one of Pending, Running, Exited, Unknown, or NotFound. Version strings can be empty when the service cannot determine them.

Upgrade the current sandbox

Call upgrade_sandbox only after the user explicitly asks to upgrade this sandbox to the latest Agent image. It does nothing when the image is already current.

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("upgrade_sandbox", {})
if not result.ok:
    print(result.content)
    raise SystemExit(1)

print(result.content)
print(result.data)

data = result.data
if data["operation"] == "already_current":
    print("No rebuild is needed")
elif data["operation"] == "upgrade_scheduled":
    print("Scheduled after", data["delay_seconds"], "seconds")
""")

When an update is needed, the tool schedules the existing rebuild API and returns before rebuilding:

The current sandbox upgrade has been scheduled. The sandbox is scheduled to be rebuilt in 10 seconds. Reply to the user now and do not call more tools. This confirms scheduling, not completion; after the sandbox is available again, use get_sandbox_info to verify the new image version.

Typical requested result.data:

{
  "sandbox_id": "sandbox_example",
  "operation": "upgrade_scheduled",
  "current_version": "v1",
  "latest_version": "v2",
  "needs_update": true,
  "delay_seconds": 10
}

If the image is already current, the result is:

{
  "sandbox_id": "sandbox_example",
  "operation": "already_current",
  "current_version": "v2",
  "latest_version": "v2",
  "needs_update": false,
  "delay_seconds": 0
}

upgrade_scheduled means only that a delayed rebuild request was created in the current Agent process. It does not mean the new image is running. Send the user a short final response immediately and do not call another tool in the same run. After the Agent is available again, call get_sandbox_info to verify the actual image version.

Restart the current sandbox

Call restart_sandbox only from the interactive main Agent after the user explicitly asks to restart this sandbox, regardless of its image version. Sub-agents must return the request to the main Agent.

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("restart_sandbox", {})
if not result.ok:
    print(result.content)
    raise SystemExit(1)

print(result.content)
print(result.data)

data = result.data
if data["operation"] == "restart_requested":
    print("Restart requested; it will be sent after this Agent run is finalized")
""")

Typical result.content:

The unconditional restart of the current sandbox has been requested. After your final reply, other Agent tasks will be interrupted and the existing archive will be attempted before the restart request is sent. No fixed duration is promised. Reply to the user now and do not call more tools. A new user message or interruption before API dispatch will cancel the pending restart. After the sandbox is available again, the runtime will automatically resume this conversation and use get_sandbox_info to verify its status.

Typical result.data:

{
  "sandbox_id": "sandbox_example",
  "operation": "restart_requested"
}

For a requested restart, sandbox_id is the ID of the sandbox being replaced. It is not a promise that the rebuilt sandbox will have the same ID. The request is held until the main Agent finishes its reply, other Agent tasks receive interruption, and the existing archive is attempted. Cleanup timeout or archive failure does not prevent restarting. A new user message or interruption before API dispatch can cancel the pending request. Send the user a short final response immediately and do not call another tool in the same run. After recovery, the runtime resumes the conversation and calls get_sandbox_info; report the current availability without assuming the earlier restart request succeeded.

Safety and persistence

  • Never upgrade or restart merely because needs_update is true; both operations require explicit user intent.
  • Save required work in .workspace before a rebuild. Files there persist across sandbox rebuilds; processes, temporary VM state, and files outside .workspace do not.
  • Restart waits for the main Agent's final reply, bounded interruption of other Agent tasks, and a best-effort archive. A process crash before dispatch can lose the pending request.
  • The tool stores a resumption before registering the deferred restart. After the new runtime is ready, it resumes this conversation and checks the current sandbox status before replying.
  • A new user message or interruption before API dispatch cancels the pending restart. Once dispatch begins, no new Agent work starts in the old runtime. A failed API request is not automatically retried.
  • Do not automatically retry a failed or interrupted upgrade/restart. Inspect the returned error, and after recovery use get_sandbox_info before deciding what to do next.

版本历史

  • 0f1432c 当前 2026-11-03 04:32
  • f9973c5 2026-08-20 03:37

同 Skill 集合

backend/super-magic/agents/skills/agent-info/SKILL.md
backend/super-magic/agents/skills/canvas-designer/SKILL.md
backend/super-magic/agents/skills/chat-history/SKILL.md
backend/super-magic/agents/skills/cli-manager/SKILL.md
backend/super-magic/agents/skills/compact-chat-history/SKILL.md
backend/super-magic/agents/skills/creating-slides/SKILL.md
backend/super-magic/agents/skills/develop-data-analysis-dashboard/SKILL.md
backend/super-magic/agents/skills/document-converter/SKILL.md
backend/super-magic/agents/skills/download/SKILL.md
backend/super-magic/agents/skills/env-manager/SKILL.md
backend/super-magic/agents/skills/file-bundle/SKILL.md
backend/super-magic/agents/skills/html-design-style/SKILL.md
backend/super-magic/agents/skills/im-channels/SKILL.md
backend/super-magic/agents/skills/magic-calendar/SKILL.md
backend/super-magic/agents/skills/magicbase/SKILL.md
backend/super-magic/agents/skills/micro-app-architect/SKILL.md
backend/super-magic/agents/skills/persona-research/SKILL.md
backend/super-magic/agents/skills/self-media-pre-publish-analyzer/SKILL.md
backend/super-magic/agents/skills/share/SKILL.md
backend/super-magic/agents/skills/skill-vetter/SKILL.md
backend/super-magic/agents/skills/slide-template-maker/SKILL.md
backend/super-magic/agents/skills/slide-template-replacement/SKILL.md
backend/super-magic/agents/skills/startup-manager/SKILL.md
backend/super-magic/agents/skills/subagents/SKILL.md
backend/super-magic/agents/skills/super-magic/SKILL.md
backend/super-magic/agents/skills/teamshare-cli/SKILL.md
backend/super-magic/agents/skills/use-magicbase/SKILL.md
backend/super-magic/agents/skills/user-info/SKILL.md
backend/super-magic/agents/skills/using-cron/SKILL.md
backend/super-magic/agents/skills/using-llm/SKILL.md
backend/super-magic/agents/skills/using-mcp/SKILL.md
frontend/magic-web/.agents/skills/antd-style-to-tailwind/SKILL.md
frontend/magic-web/.agents/skills/code-review-expert/SKILL.md
frontend/magic-web/.agents/skills/dual-edition-module-migration/SKILL.md
frontend/magic-web/.agents/skills/frontend-storage-requirements/SKILL.md
frontend/magic-web/.agents/skills/magic-web-error-logging/SKILL.md
frontend/magic-web/.agents/skills/sw-best-practices/SKILL.md
frontend/magic-web/.agents/skills/ui-data-testid/SKILL.md
frontend/magic-web/.agents/skills/vercel-composition-patterns/SKILL.md
frontend/magic-web/.agents/skills/vercel-react-best-practices/SKILL.md
backend/super-magic/agents/skills/ai-card-generator/SKILL.md
backend/super-magic/agents/skills/canvas-manager/SKILL.md
backend/super-magic/agents/skills/crew-creator/SKILL.md
backend/super-magic/agents/skills/deep-research/SKILL.md
backend/super-magic/agents/skills/dingtalk-cli/SKILL.md
backend/super-magic/agents/skills/html-api-sdk/SKILL.md
backend/super-magic/agents/skills/html-app-architect/SKILL.md
backend/super-magic/agents/skills/lark-cli/SKILL.md
backend/super-magic/agents/skills/memory/SKILL.md

元信息

文件数
0
版本
0f1432c
Hash
b849c22a
收录时间
2026-08-20 03:37

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-11-04 17:43
浙ICP备14020137号-1