Langsung ke konten
Skillpedia
Pemrograman umum7.8k · #12983

sandbox-exec-fallback

Fungsinya

Skill ini memberi tahu agent AI untuk beralih dari sandbox kode ke file skrip Python yang disimpan dan dijalankan di shell. Skill ini ditujukan untuk orang yang membuat spreadsheet, keluaran data, atau file lain dengan Python.

Kapan dipakai

  • ✓Saat sandbox kode gagal ketika membuat file spreadsheet atau CSV.
  • ✓Saat tugas pengolahan data gagal di sandbox dan Anda tetap memerlukan outputnya.
  • ✓Saat pekerjaan Python yang panjang atau berat memori memerlukan waktu lebih lama daripada batas sandbox.

Link skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-exec-fallback/SKILL.md

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-exec-fallback/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Sandbox gagal saat membuat spreadsheet pengeluaran saya. Simpan Python ke file, jalankan, dan pastikan file spreadsheet-nya ada.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent menulis kode Python lengkap ke file skrip, menjalankannya dengan python3 di shell dengan batas waktu, lalu memeriksa output yang ditampilkan. Setelah itu agent mendaftar folder untuk menemukan file yang dibuat skrip.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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: python3 in 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:

  1. write_file with path="generate_spreadsheet.py" and the code above as content
  2. run_shell with command="python3 generate_spreadsheet.py"
  3. Verify output.xlsx was created with list_dir

Tips

  • Increase timeout for 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
Pertanyaan umum

Di mana file output disimpan?

Skill ini menyatakan file output muncul di folder kerja saat ini, sehingga agent mendaftar folder itu untuk menemukannya.

Berapa lama skrip boleh berjalan?

Skill ini menyarankan batas waktu yang lebih panjang, misalnya 300 detik, untuk pekerjaan panjang.

Bagaimana jika skrip masih gagal?

Skill ini meminta agent membaca pesan error, memperbaiki skrip, lalu menjalankannya lagi.

Detail

Deskripsi asli dari pembuat

Fallback pattern for executing Python code when execute_code_sandbox fails by writing to file and running via shell

repo: HKUDS/AgentPilot

Popularitas

Bintang GitHub
7.8k
Peringkat
#12983
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa