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

sandbox-fallback-execution

하는 일

이 스킬은 샌드박스가 실패하거나 시간 초과될 때 AI 에이전트가 쓸 수 있는 간단한 Python 대체 방법을 보여 줍니다. 샌드박스 없이 짧은 Python 작업을 끝내야 하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓코드 샌드박스가 알 수 없는 오류를 내거나 시간 초과될 때.
  • ✓같은 작업에서 샌드박스가 두 번 넘게 실패했을 때.
  • ✓코드를 실행하기 전에 Python 패키지를 설치해야 할 때.

스킬 링크

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

AI에게 요청하는 예시

“샌드박스가 제 스크립트에서 알 수 없는 오류를 냈습니다. 필요하면 pandas를 설치하고 셸에서 코드를 실행해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 필요한 패키지를 pip로 설치한 다음, heredoc을 사용해 셸에서 Python 코드를 실행합니다. 다음 단계로 넘어가기 전에 성공 메시지나 오류를 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Sandbox Fallback Execution

When to Use This Skill

Use this pattern when execute_code_sandbox fails with unknown errors, timeouts, or persistent execution failures. This fallback bypasses sandbox restrictions by using run_shell with a Python heredoc script.

Pattern Overview

execute_code_sandbox fails → run_shell with pip install → Python heredoc execution

Step-by-Step Instructions

Step 1: Detect Sandbox Failure

Monitor for these failure indicators from execute_code_sandbox:

  • Unknown or unexplained errors
  • Repeated execution failures (>2 attempts)
  • Timeout errors
  • Environment/package availability issues

Step 2: Install Required Dependencies (If Needed)

Use run_shell to install any required Python packages:

pip install <package_name>

For multiple packages:

pip install package1 package2 package3

Step 3: Execute Python via Heredoc

Run Python code using a heredoc script with run_shell:

python3 << 'EOF'
# Your Python code here
import sys
print("Hello from fallback execution")
EOF

Key heredoc syntax notes:

  • Use << 'EOF' (quoted) to prevent shell variable expansion
  • Use << EOF (unquoted) if you need shell variable interpolation
  • Close with EOF on its own line

Step 4: Verify and Iterate

  • Check stdout/stderr for success indicators
  • If errors persist, inspect output and adjust the script
  • Capture any generated artifacts (files, outputs) for verification

Complete Example

Scenario: Need to create a Word document but execute_code_sandbox keeps failing.

# Step 1: Install required package
pip install python-docx

# Step 2: Execute Python script via heredoc
python3 << 'EOF'
from docx import Document

doc = Document()
doc.add_heading('Proposal Document', 0)
doc.add_paragraph('This is the proposal content.')
doc.save('proposal.docx')
print("Document created successfully")
EOF

Best Practices

  1. Quote the heredoc delimiter ('EOF') to avoid unintended shell expansion of Python code
  2. Install packages first before running the script to ensure availability
  3. Print status messages in your script for easier debugging
  4. Save outputs to files when possible for verification
  5. Keep scripts focused - break complex tasks into multiple heredoc executions if needed

Troubleshooting

Issue Solution
pip not found Try pip3 or python3 -m pip install
Script hangs Add timeout to run_shell command
Permission errors Check file paths are writable
Import errors Verify package was installed successfully

Related Tools

  • run_shell: Execute shell commands directly
  • execute_code_sandbox: Primary Python execution tool (try first)
  • shell_agent: For more complex multi-step shell tasks
자주 묻는 질문

따옴표가 있는 EOF와 없는 EOF는 어떻게 다른가요?

따옴표가 있는 종료 표시는 셸이 변수를 바꾸지 못하게 하고, 따옴표가 없으면 셸이 값을 채워 넣습니다.

에이전트가 패키지를 설치하나요?

네, 코드에 패키지가 필요하면 스킬은 먼저 pip로 설치하라고 안내합니다.

오류가 남아 있으면 어떻게 하나요?

스킬은 출력을 읽고, 코드를 고친 뒤 다시 실행하라고 안내합니다.

상세 정보

작성자의 원본 설명

Fallback workflow for executing Python code when execute_code_sandbox fails

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12990
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬