sandbox-execution-fallback-238489
하는 일
이 스킬은 샌드박스가 라이브러리를 쓰는 파일 작업을 처리하지 못할 때 AI 에이전트가 독립형 Python 스크립트를 만들고 실행하도록 안내합니다. PDF, Word 파일 또는 스프레드시트가 필요한 사람을 위한 스킬입니다.
사용하는 경우
- ✓샌드박스가 PDF, Word, Excel 파일 생성에 실패할 때.
- ✓작업에 샌드박스가 제공하지 않는 Python 라이브러리가 필요할 때.
- ✓스크립트가 실행되는 환경을 더 직접 제어해야 할 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback-238489/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 메모로 reportlab을 사용해 PDF를 만들어 주세요. 샌드박스가 실패했으니 스크립트 파일을 만들어 실행해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 파일 쓰기 도구로 스크립트를 저장한 다음, 셸에서 python3로 실행합니다. 스크립트가 끝났는지, 예상한 파일이 만들어졌는지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Sandbox Execution Fallback
This skill provides a reliable fallback pattern when execute_code_sandbox fails for code execution tasks (especially PDF generation, complex file operations, or library-dependent tasks).
When to Use
Use this fallback pattern when:
execute_code_sandboxreturns errors or fails to produce expected output- The task requires specific Python libraries not available in the sandbox
- File I/O operations (especially PDF, docx, xlsx) fail in the sandbox environment
- You need more control over the execution environment
Step-by-Step Instructions
Step 1: Write the Python Script to a File
Instead of executing code directly in the sandbox, use write_file to create a standalone Python script:
Use write_file to create a script (e.g., script.py) with your complete Python code.
Step 2: Execute the Script Directly
Run the script using run_shell with Python:
Use run_shell with command: python3 script.py
Step 3: Verify Output
Check that the script executed successfully and produced the expected files or output.
Example Pattern
Instead of this (sandbox execution):
execute_code_sandbox with code using libraries like reportlab, fpdf, etc.
Do this (fallback pattern):
# Step 1: Create the script
write_file:
path: generate_pdf.py
content: |
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
def create_pdf(filename):
c = canvas.Canvas(filename, pagesize=letter)
c.drawString(100, 750, "Hello World")
c.save()
create_pdf("output.pdf")
# Step 2: Execute directly
run_shell:
command: python3 generate_pdf.py
Best Practices
- Include all dependencies in the script - Make the script self-contained
- Add error handling - Include try/except blocks to catch and report errors
- Use absolute or clear relative paths - Ensure file paths work in the execution context
- Verify prerequisites - Check that required Python packages are available
- Clean up temporary files - Remove intermediate scripts after successful execution if needed
Troubleshooting
If run_shell also fails:
- Check if Python 3 is available:
run_shell command: python3 --version - Install missing packages:
run_shell command: pip3 install package_name - Check file permissions and paths
- Review error output from the shell execution for specific issues
Why This Works
This pattern bypasses sandbox limitations by:
- Running code in the actual execution environment with full library access
- Avoiding sandbox timeout or resource constraints
- Enabling direct file system access for I/O operations
- Providing better error messages from the native Python interpreter
Self-Assessment
This skill captures a genuinely reusable pattern that:
- Is generalizable beyond just PDF generation to any execute_code_sandbox failure
- Provides clear, actionable steps
- Includes example code and troubleshooting guidance
- Would benefit future executions facing similar sandbox limitations
자주 묻는 질문
어떤 파일 형식을 다루나요?
스킬은 샌드박스에서 자주 실패하는 결과물로 PDF, Word, Excel 파일을 꼽습니다.
코드를 바로 실행하지 않고 파일로 쓰는 이유는 무엇인가요?
저장된 스크립트는 셸이 실행할 명확한 파일이 되고, 작업 결과를 더 쉽게 확인할 수 있게 합니다.
에이전트가 결과를 확인하나요?
네, 마지막 단계에서 예상한 파일이 만들어졌는지 확인합니다.
상세 정보
작성자의 원본 설명
Fallback pattern for when execute_code_sandbox fails - write script to file and execute directly with run_shell
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12984
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.