sandbox-execution-fallback
하는 일
이 스킬은 실패한 코드 실행을 .py 파일로 저장하고 셸에서 실행해 복구하는 방법을 AI 에이전트에게 보여 줍니다. 스프레드시트나 데이터 작업이 샌드박스에서 시간 초과되는 사람을 위한 스킬입니다.
사용하는 경우
- ✓코드 샌드박스가 스프레드시트나 데이터 작업에서 시간 초과될 때.
- ✓pandas나 openpyxl 같은 외부 라이브러리가 필요한 작업일 때.
- ✓오래 걸리는 계산이 샌드박스의 시간 제한에 계속 걸릴 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“pandas 작업이 샌드박스에서 시간 초과됩니다. 코드를 파일로 저장하고 더 긴 제한 시간으로 셸에서 실행해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 실패한 코드를 가져와 이름이 분명한 .py 파일로 씁니다. 시스템 Python으로 실행한 뒤, 예상한 파일과 결과가 있는지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Sandbox Execution Fallback
When to Use
Apply this pattern when execute_code_sandbox fails or times out, particularly for:
- Spreadsheet generation (pandas, openpyxl, xlsxwriter)
- Complex data processing with file I/O
- Tasks requiring external library imports
- Long-running computations that hit timeout limits
Recovery Procedure
Step 1: Capture the Python Code
Extract or reconstruct the Python code that failed in execute_code_sandbox.
Step 2: Write Code to File
Use write_file to save the script with a .py extension:
write_file(
path="script_name.py",
content="""
import pandas as pd
# Your implementation here
"""
)
Step 3: Execute via run_shell
Run the script using the system Python interpreter:
run_shell(command="python3 script_name.py")
Step 4: Verify Output
Confirm the results match expected outputs (files created, data processed correctly, etc.).
Complete Example
# Failed: execute_code_sandbox with pandas Excel generation
# Recovery - Step 1 & 2: Write script to file
write_file(
path="generate_pnl_report.py",
content="""
import pandas as pd
from openpyxl import Workbook
# Create sample data
data = {
'Category': ['Revenue', 'Expenses', 'Tax'],
'Amount': [10000, 3000, 500]
}
df = pd.DataFrame(data)
# Write to Excel
df.to_excel('pnl_report.xlsx', index=False)
print('Report generated: pnl_report.xlsx')
"""
)
# Step 3: Execute via shell
run_shell(command="python3 generate_pnl_report.py")
# Step 4: Verify file was created
run_shell(command="ls -la pnl_report.xlsx")
Why This Works
| Aspect | execute_code_sandbox | run_shell + write_file |
|---|---|---|
| Environment | Sandboxed, limited | Full system Python |
| File I/O | Restricted | Full access |
| Timeout | Strict limits | More flexible |
| Library Support | May be limited | System-installed packages |
| Result | Identical output | Identical output |
Best Practices
- Use descriptive filenames - e.g.,
generate_report.py,process_data.py - Add error handling - Include try/except blocks in your script
- Print progress - Use print statements for debugging
- Clean up - Remove temporary scripts after successful execution if needed
- Verify results - Always confirm outputs before proceeding
Common Use Cases
- Excel/CSV report generation
- Data transformation pipelines
- Batch file processing
- API data aggregation
- Chart and visualization creation
Troubleshooting
If run_shell also fails:
- Check Python is available:
run_shell(command="python3 --version") - Install missing packages:
run_shell(command="pip3 install pandas openpyxl") - Check file permissions and paths
- Review stderr output for specific errors
자주 묻는 질문
코드가 저장되지 않았다면 복구할 수 있나요?
스킬은 저장되지 않았다면 실패한 시도에서 코드를 다시 만들라고 안내합니다.
어떤 Python 명령을 쓰나요?
스킬은 셸에서 python3로 스크립트를 실행합니다.
에이전트는 성공을 어떻게 확인하나요?
파일이 만들어졌고 데이터가 예상대로 처리되었는지 확인합니다.
상세 정보
작성자의 원본 설명
Recover from execute_code_sandbox failures by writing Python scripts to files and executing via run_shell
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12986
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.