sandbox-fallback-execution
できること
このスキルは、サンドボックスが失敗したりタイムアウトしたりしたとき、AIエージェントが使える簡単な代替方法を示します。サンドボックスを使わずに短いPythonの処理を終わらせたい人向けです。
使う場面
- ✓コードサンドボックスが原因不明のエラーやタイムアウトで失敗したとき。
- ✓同じ処理でサンドボックスが2回以上失敗したとき。
- ✓Pythonの実行前にパッケージのインストールが必要なとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-fallback-execution/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“サンドボックスが原因不明のエラーを返しました。必要ならpandasをインストールして、シェルでコードを実行してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは必要なパッケージをpipでインストールし、ヒアドキュメントを使ってシェルからPythonコードを実行します。次に進む前に、出力で成功メッセージやエラーを確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
EOFon 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
- Quote the heredoc delimiter (
'EOF') to avoid unintended shell expansion of Python code - Install packages first before running the script to ensure availability
- Print status messages in your script for easier debugging
- Save outputs to files when possible for verification
- Keep scripts focused - break complex tasks into multiple heredoc executions if needed
Troubleshooting
| Issue | Solution |
|---|---|
pip not found |
Try pip3 or python3 -m pip install |
| Script hangs | Add timeout to run_shell command |
| Permission errors | Check file paths are writable |
| Import errors | Verify package was installed successfully |
Related Tools
run_shell: Execute shell commands directlyexecute_code_sandbox: Primary Python execution tool (try first)shell_agent: For more complex multi-step shell tasks
よくある質問
引用符付きと引用符なしの終了マーカーの違いは何ですか?
引用符付きの終了マーカーはシェルが変数を展開するのを防ぎ、引用符なしの場合はシェルが変数を展開します。
エージェントはパッケージをインストールしますか?
はい。コードにパッケージが必要な場合は、先にpipでインストールするようスキルは述べています。
エラーが残ったらどうしますか?
出力を読み、コードを調整して再実行するよう述べています。
詳細
作者による元の説明
Fallback workflow for executing Python code when execute_code_sandbox fails
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12990
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。