sandbox-exec-fallback
Skill này làm gì
Skill này bảo AI agent chuyển từ sandbox mã sang một file Python đã lưu, chạy trong shell. Nó dành cho những người tạo bảng tính, kết quả dữ liệu hoặc các file khác bằng Python.
Khi nào nên dùng
- ✓Khi sandbox mã lỗi trong lúc tạo bảng tính hoặc file CSV.
- ✓Khi một công việc xử lý dữ liệu thất bại trong sandbox và bạn vẫn cần kết quả.
- ✓Khi một công việc Python dài hoặc tốn bộ nhớ cần nhiều thời gian hơn giới hạn của sandbox.
Liên kết skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-exec-fallback/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Sandbox bị lỗi khi tạo bảng chi tiêu của tôi. Hãy lưu mã Python thành file, chạy nó và xác nhận bảng tính đã tồn tại.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent ghi toàn bộ mã Python vào một file script, chạy nó bằng python3 trong shell với giới hạn thời gian và kiểm tra đầu ra được in ra. Sau đó nó liệt kê thư mục để tìm các file mà script đã tạo.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
File đầu ra được lưu ở đâu?
Skill nói các file đầu ra xuất hiện trong thư mục làm việc hiện tại, nên agent liệt kê thư mục đó để tìm chúng.
Script có thể chạy bao lâu?
Skill gợi ý thời gian chờ dài hơn, chẳng hạn 300 giây, cho các công việc dài.
Nếu script vẫn lỗi thì sao?
Skill yêu cầu đọc thông báo lỗi, sửa script và chạy lại.
Chi tiết
Mô tả gốc của tác giả
Fallback pattern for executing Python code when execute_code_sandbox fails by writing to file and running via shell
repo: HKUDS/AgentPilot
Độ phổ biến
- Sao GitHub
- 7.8k
- Vị trí xếp hạng
- #12983
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agentpilot
7.8kGiúp agent của bạn cải thiện dự án từng bước bằng cách chuẩn bị tác vụ và chạy vòng lặp AgentPilot, gồm đề xuất, kiểm thử và chấm điểm thay đổi.
openspace
7.8kGiúp agent của bạn thiết lập OpenSpace, công cụ lưu và lấy lại skill của agent, rồi kết nối nó với ứng dụng AI của bạn qua MCP.
rsi-arena
7.8kGiúp agent của bạn thiết lập và chạy các bài kiểm thử benchmark AI chuẩn, như AIME và Terminal-Bench, để so sánh các phương pháp cải tiến khác nhau.
experiment-guide
7.8kGiúp agent của bạn lên kế hoạch các thí nghiệm nhỏ, đọc kết quả và ghi lại phát hiện khi tìm cách cải thiện một chương trình.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.