sandbox-exec-fallback
できること
このスキルは、AIエージェントがコードサンドボックスから、シェルで実行する保存済みのPythonファイルに切り替える方法を示します。Pythonでスプレッドシート、データ出力、その他のファイルを作る人向けです。
使う場面
- ✓スプレッドシートやCSVファイルを作成中に、コードサンドボックスが失敗したとき。
- ✓データ処理の作業がサンドボックスで失敗し、それでも出力が必要なとき。
- ✓長い処理やメモリを多く使うPythonの処理に、サンドボックスの制限より多くの時間が必要なとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-exec-fallback/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“経費のスプレッドシートを作成中にサンドボックスが失敗しました。Pythonコードをファイルに保存して実行し、スプレッドシートが作られたか確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは完全なPythonコードをスクリプトファイルに書き出し、時間制限を付けてシェルでpython3を実行します。表示された出力を確認し、スクリプトが作成したファイルを探すためにフォルダーの一覧を表示します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Sandbox Execution Fallback
When to Use
Use this skill when execute_code_sandbox fails during Python code execution, particularly for tasks involving:
- Spreadsheet generation (xlsx, csv)
- Data processing and transformations
- File output operations
- Complex computations requiring libraries
Recovery Pattern
When execute_code_sandbox returns an error or fails to produce expected output:
Step 1: Write Python Code to File
Use write_file to save your Python script to a file:
# Use write_file tool with:
path: "script.py"
content: <your complete Python code as a string>
Step 2: Execute via Shell
Use run_shell to execute the script:
# Use run_shell tool with:
command: "python3 script.py"
timeout: <appropriate timeout, e.g., 300 for long-running tasks>
Step 3: Verify Output
Check the shell output for:
- Success messages or printed results
- Error messages (if any, diagnose and fix the script)
- File creation confirmations
Step 4: Access Generated Files
If the script creates output files (e.g., spreadsheets), they will be in the current working directory. Use list_dir to confirm, then read_file to access if needed.
Why This Works
- Same Python Environment:
python3in the shell uses the same environment as the sandbox - More Robust: Shell execution handles long-running or memory-intensive tasks better
- Debuggable: Errors are captured in stdout/stderr for easier diagnosis
- Identical Results: Produces the same output as sandbox execution when successful
Example: Spreadsheet Generation
Original code that failed in execute_code_sandbox:
import pandas as pd
data = {'A': [1, 2, 3], 'B': [4, 5, 6]}
df = pd.DataFrame(data)
df.to_excel('output.xlsx', index=False)
print("File created successfully")
Recovery Execution:
write_filewith path="generate_spreadsheet.py" and the code above as contentrun_shellwith command="python3 generate_spreadsheet.py"- Verify output.xlsx was created with
list_dir
Tips
- Increase
timeoutfor complex operations (default 30s may be insufficient) - Add explicit print statements for debugging
- Handle exceptions in your script and print error messages
- Clean up temporary script files after successful execution if needed
よくある質問
出力ファイルはどこに保存されますか?
スキルでは、出力ファイルは現在のワーキングフォルダーに作られると説明しているため、エージェントはそのフォルダーを一覧表示してファイルを探します。
スクリプトはどのくらい実行できますか?
長い処理には、300秒などより長いタイムアウトを設定するよう提案しています。
スクリプトがまだ失敗する場合はどうしますか?
エラーメッセージを読み、スクリプトを修正して再実行するよう述べています。
詳細
作者による元の説明
Fallback pattern for executing Python code when execute_code_sandbox fails by writing to file and running via shell
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12983
- ライセンス
- 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のイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。