code-exec-fallback-266cba
하는 일
이 스킬은 내장 코드 실행기가 계속 실패할 때 AI가 방법을 바꾸도록 합니다. AI 작업에 Python 코드가 성공적으로 실행되어야 하는 사람을 위한 것입니다.
사용하는 경우
- ✓코드 샌드박스가 불분명한 오류로 두 번 연속 실패할 때.
- ✓코드 실행이 계속 시간 초과되고 재시도가 도움이 되지 않는 경우.
- ✓샌드박스 대신 Python 스크립트를 명령줄에서 실행해야 할 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/code-exec-fallback-266cba/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“코드 실행기가 제 데이터 스크립트에서 계속 실패합니다. 다른 방법으로 실행하고 출력을 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 Python 코드를 파일에 쓰고, 셸 명령으로 실행하고, 출력과 오류를 읽은 뒤, 작동했는지 보고합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Code Execution Fallback Pattern
When to Use This Skill
Apply this pattern when you encounter repeated failures with execute_code_sandbox:
- 2+ consecutive failures with opaque or unknown errors
- Timeout errors that persist across retry attempts
- Environment-related errors that don't resolve with code fixes
The Fallback Workflow
Step 1: Detect Repeated Failures
Track execution failures. After 2 consecutive failures with execute_code_sandbox, switch to the fallback approach.
Step 2: Write Script to File
Use write_file to save your Python script:
write_file(
path="/workspace/script_name.py",
content="# Your Python code here\nimport sys\n..."
)
Step 3: Execute via Shell
Use run_shell to run the script:
run_shell(
command="python /workspace/script_name.py",
timeout=300
)
Step 4: Capture Output
Parse stdout/stderr from run_shell output to verify success or diagnose issues.
Complete Example
# Instead of this (which may fail):
result = execute_code_sandbox(code="import pandas as pd\n...")
# Use this fallback pattern:
script_content = """
import pandas as pd
import sys
try:
# Your logic here
df = pd.DataFrame({'col': [1, 2, 3]})
print(df.to_csv())
sys.exit(0)
except Exception as e:
print(f"ERROR: {e}", file=sys.stderr)
sys.exit(1)
"""
# Write the script
write_file(path="/workspace/my_script.py", content=script_content)
# Execute via shell
result = run_shell(command="python /workspace/my_script.py", timeout=300)
Best Practices
- Add error handling in your script - use try/except with
sys.exit()codes - Set appropriate timeouts -
run_shelldefault is 30s, increase for heavy operations - Clean up temporary files after execution if needed
- Log the fallback trigger - document why you switched approaches
- Verify Python availability - Most sandboxes have Python 3.x by default
Why This Works
write_fileis more reliable for file I/O operationsrun_shellgives you direct control over execution environment- Shell execution bypasses sandbox serialization issues
- Better error visibility through stdout/stderr streams
When NOT to Use This Pattern
- First-time execution failures (retry the sandbox first)
- Simple one-liner code (sandbox is faster)
- When sandbox errors are clearly code bugs (fix the code instead)
- Security-sensitive operations requiring sandbox isolation
자주 묻는 질문
무엇이 실패로 간주되나요?
샌드박스에서 반복된 오류, 원인 불명의 오류, 시간 초과가 해당합니다.
오류를 볼 수 있나요?
네. 출력과 오류 메시지를 캡처하므로 AI가 무엇이 잘못되었는지 보고할 수 있습니다.
코드를 왜 파일에 쓰나요?
샌드박스가 반복해서 실패했을 때 이 경로가 작동할 수 있다고 안내서가 말하기 때문입니다.
상세 정보
작성자의 원본 설명
Fallback workflow for reliable code execution when sandbox fails repeatedly
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12844
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.