본문으로 건너뛰기
Skillpedia
일반 코딩7.8k · #12984

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback-238489/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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_sandbox returns 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

  1. Include all dependencies in the script - Make the script self-contained
  2. Add error handling - Include try/except blocks to catch and report errors
  3. Use absolute or clear relative paths - Ensure file paths work in the execution context
  4. Verify prerequisites - Check that required Python packages are available
  5. 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬