跳到正文
cccskills
免费在 GitHub 公开

sandbox-fallback-execution

Recover Python tasks when execute_code_sandbox fails with errors or timeouts. Install required packages, run the code through run_shell, and inspect messages and generated files to check the result.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Fallback workflow for executing Python code when execute_code_sandbox fails

集成工具Word
查看安装方法

适用场景

  • Resuming Python tasks after sandbox failures
  • Installing missing packages before execution
  • Creating a Word document through shell execution
  • Inspecting error output and generated files

包含的文件(2)

  • SKILL.md2.9 KB
  • .skill_id40 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Sandbox Fallback Execution

When to Use This Skill

Use this pattern when execute_code_sandbox fails with unknown errors, timeouts, or persistent execution failures. This fallback bypasses sandbox restrictions by using run_shell with a Python heredoc script.

Pattern Overview

execute_code_sandbox fails → run_shell with pip install → Python heredoc execution

Step-by-Step Instructions

Step 1: Detect Sandbox Failure

Monitor for these failure indicators from execute_code_sandbox:

  • Unknown or unexplained errors
  • Repeated execution failures (>2 attempts)
  • Timeout errors
  • Environment/package availability issues

Step 2: Install Required Dependencies (If Needed)

Use run_shell to install any required Python packages:

pip install <package_name>

For multiple packages:

pip install package1 package2 package3

Step 3: Execute Python via Heredoc

Run Python code using a heredoc script with run_shell:

python3 << 'EOF'
# Your Python code here
import sys
print("Hello from fallback execution")
EOF

Key heredoc syntax notes:

  • Use << 'EOF' (quoted) to prevent shell variable expansion
  • Use << EOF (unquoted) if you need shell variable interpolation
  • Close with EOF on its own line

Step 4: Verify and Iterate

  • Check stdout/stderr for success indicators
  • If errors persist, inspect output and adjust the script
  • Capture any generated artifacts (files, outputs) for verification

Complete Example

Scenario: Need to create a Word document but execute_code_sandbox keeps failing.

# Step 1: Install required package
pip install python-docx

# Step 2: Execute Python script via heredoc
python3 << 'EOF'
from docx import Document

doc = Document()
doc.add_heading('Proposal Document', 0)
doc.add_paragraph('This is the proposal content.')
doc.save('proposal.docx')
print("Document created successfully")
EOF

Best Practices

  1. Quote the heredoc delimiter ('EOF') to avoid unintended shell expansion of Python code
  2. Install packages first before running the script to ensure availability
  3. Print status messages in your script for easier debugging
  4. Save outputs to files when possible for verification
  5. Keep scripts focused - break complex tasks into multiple heredoc executions if needed

Troubleshooting

IssueSolution
pip not foundTry pip3 or python3 -m pip install
Script hangsAdd timeout to run_shell command
Permission errorsCheck file paths are writable
Import errorsVerify package was installed successfully

Related Tools

  • run_shell: Execute shell commands directly
  • execute_code_sandbox: Primary Python execution tool (try first)
  • shell_agent: For more complex multi-step shell tasks

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

中文简介正在准备中。当前显示英语简介。

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace77592026年8月13日 更新

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

中文简介正在准备中。当前显示英语简介。

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace77592026年8月13日 更新

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

中文简介正在准备中。当前显示英语简介。

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace77592026年8月13日 更新

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

中文简介正在准备中。当前显示英语简介。

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace77592026年8月13日 更新

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

中文简介正在准备中。当前显示英语简介。

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace77592026年8月13日 更新

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

中文简介正在准备中。当前显示英语简介。

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace77592026年8月13日 更新

查看 HKUDS 的全部技能

报告此技能的问题