sandbox-execution-fallback-717e65
Fungsinya
Skill ini membantu agent AI berpindah dari sandbox kode yang terus gagal ke file skrip yang disimpan dan dijalankan di shell. Skill ini ditujukan untuk orang yang sandbox-nya tidak stabil atau sering kehabisan waktu.
Kapan dipakai
- ✓Saat sandbox kode gagal lagi setelah dua atau tiga kali percobaan ulang.
- ✓Saat error menunjukkan masalah layanan dan bukan bug pada kode Anda.
- ✓Saat kode kompleks dengan pembacaan dan penulisan file memerlukan pesan error yang lebih jelas.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback-717e65/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Sandbox kode terus kehabisan waktu pada pekerjaan data saya. Tulis sebagai skrip dan jalankan dari shell agar saya bisa melihat errornya.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menulis kode Python ke file dan, bila perlu, memecah pekerjaan besar menjadi beberapa file. Agent menjalankan skrip utama lewat shell, lalu membaca output dan error untuk menentukan langkah berikutnya.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Sandbox Execution Fallback
When to Use
Apply this pattern when execute_code_sandbox fails repeatedly or exhibits instability. Common triggers include:
- Sandbox returns errors after 2-3 retry attempts
- Error messages indicate provider/system issues rather than code bugs
- Execution times out or hangs inconsistently
- Complex multi-step code with file I/O is needed
- Better error visibility and debugging is required
Procedure
Step 1: Detect When to Switch
Recognize the failure pattern:
execute_code_sandboxproduces repeated errors despite code corrections- Error output suggests infrastructure issues (not syntax/logic errors)
- The sandbox environment appears unstable or limited
Step 2: Write Python Script to File
Use write_file to save your script:
write_file(
path="script.py",
content="#!/usr/bin/env python3
# Your Python code here
import sys
print('Executing via file-based approach')
# ... rest of your code
"
)
For multi-file projects, write each file separately:
write_file(path="utils.py", content="# Utility functions\ndef helper(): ...")
write_file(path="main.py", content="from utils import helper\nhelper()")
Step 3: Execute via Shell
Run the script using run_shell:
run_shell(command="python3 script.py")
For scripts in subdirectories:
run_shell(command="cd mydir && python3 script.py")
Step 4: Handle Output and Clean Up
- Parse stdout/stderr from
run_shelloutput - Inspect created files directly using
read_fileif needed - Remove temporary scripts after successful execution:
run_shell(command="rm script.py")
Advantages Over Sandbox Execution
| Benefit | Explanation |
|---|---|
| Bypasses provider limitations | No sandbox resource constraints |
| Better error visibility | Full stack traces and system errors |
| Environment control | Direct access to system Python and packages |
| Multi-file support | Easy imports and module structure |
| Persistence | Files remain for inspection and debugging |
| Reliability | More consistent execution behavior |
Complete Example
# Scenario: execute_code_sandbox failing on data processing task
# Step 1: Write the script
write_file(
path="process_data.py",
content="#!/usr/bin/env python3
import json
import csv
# Load and process data
with open('input.json', 'r') as f:
data = json.load(f)
# Transform data
results = []
for item in data:
results.append({'processed': item['value'] * 2})
# Write output
with open('output.csv', 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=['processed'])
writer.writeheader()
writer.writerows(results)
print('Processing complete')
"
)
# Step 2: Execute via shell
run_shell(command="python3 process_data.py")
# Step 3: Read results
read_file(filetype="csv", file_path="output.csv")
# Step 4: Clean up (optional)
run_shell(command="rm process_data.py")
Best Practices
- Use absolute or clear relative paths - Avoid ambiguity in file locations
- Add error handling in scripts - Catch exceptions and print meaningful messages
- Validate script content before writing - Ensure proper Python syntax
- Log execution steps - Track what was written and executed for debugging
- Clean up temporary files - Remove scripts after use unless needed for later inspection
Troubleshooting
| Issue | Solution |
|---|---|
python3 not found |
Try python or specify full path /usr/bin/python3 |
| Import errors | Use run_shell(command="pip3 install package") first |
| Permission denied | Add execute permission: run_shell(command="chmod +x script.py") |
| Working directory issues | Use absolute paths or cd in the command |
Pertanyaan umum
Bagaimana saya tahu sandbox adalah penyebabnya?
Skill ini meminta agent beralih ketika error menunjukkan masalah infrastruktur, seperti kegagalan berulang atau timeout, bukan kesalahan kode.
Bisakah pekerjaan memakai beberapa file?
Bisa. Skill ini meminta setiap file ditulis terpisah dan file utama dijalankan, yang kemudian mengimpor file-file lainnya.
Bisakah skrip di sub-folder dijalankan?
Bisa. Skill ini menunjukkan cara berpindah ke sub-folder sebelum menjalankan skrip.
Detail
Deskripsi asli dari pembuat
Fallback from execute_code_sandbox to file-based run_shell execution when sandbox fails
repo: HKUDS/AgentPilot
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #12985
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- …
Skill lain dari repositori ini
agentpilot
7.8kMembantu agent Anda meningkatkan proyek langkah demi langkah dengan menyiapkan tugas dan menjalankan loop AgentPilot yang mengusulkan, menguji, dan memberi skor pada perubahan.
openspace
7.8kMembantu agent Anda menyiapkan OpenSpace, alat yang menyimpan dan mengambil skill agent, lalu menghubungkannya ke aplikasi AI Anda melalui MCP.
rsi-arena
7.8kMembantu agent Anda menyiapkan dan menjalankan tes benchmark AI standar, seperti AIME dan Terminal-Bench, untuk membandingkan berbagai metode perbaikan.
experiment-guide
7.8kMembantu agent Anda merencanakan eksperimen kecil, membaca hasilnya, dan mencatat temuan saat menyelidiki cara memperbaiki sebuah program.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.