fallback-code-execution
하는 일
이 스킬은 샌드박스가 알 수 없거나 불안정한 오류를 계속 낼 때 Python 코드를 실행하는 우회 방법입니다. 결과가 필요한 코드를 AI가 실행하는 사람에게 맞습니다.
사용하는 경우
- ✓같은 코드로 샌드박스가 두 번 이상 연속 실패했을 때.
- ✓오류가 일반적이어서 코드 실수보다 환경 문제를 가리키는 경우.
- ✓스크립트를 검사하고 다시 실행할 수 있도록 파일로 보관하고 싶을 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-code-execution/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 스크립트에서 샌드박스가 일반적인 오류만 계속 냅니다. 로직은 맞으니 파일로 저장해서 실행해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 작업 공간에 설명이 담긴 이름으로 스크립트를 쓰고, 먼저 의존성을 설치한 뒤, 셸에서 실행하며 출력을 기록합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Fallback Code Execution Workflow
Overview
This skill defines a robust workaround for executing code (specifically Python) when the primary execute_code_sandbox tool fails repeatedly with unknown or transient errors. Instead of continuing to retry the failing tool, the agent switches to a manual file-write and shell-execution pattern.
Trigger Conditions
Activate this workflow when:
execute_code_sandboxfails 2 or more times consecutively for the same logic.- Error messages are generic, unknown, or indicate environment issues rather than syntax errors.
- The code logic itself is verified correct but the execution environment is unstable.
Procedure
Step 1: Write Script to File
Use the write_file tool to save the Python script to a specific path in the workspace.
- Path: Choose a descriptive name ending in
.py(e.g.,scripts/generate_report.py). - Content: Ensure the script includes necessary error handling and print statements for debugging.
- Dependencies: If the script requires external libraries, ensure a
requirements.txtis updated or installed via shell beforehand.
Example:
tool: write_file
path: workspace/scripts/process_data.py
content: |
import sys
# ... script logic ...
print("Success")
Step 2: Execute via Shell
Use the run_shell tool to execute the script using the system Python interpreter.
- Command:
python3 <path_to_script>orpython <path_to_script>. - Working Directory: Ensure the shell command runs from the workspace root or the directory containing the script.
- Capture Output: Store stdout and stderr for verification.
Example:
tool: run_shell
command: python3 scripts/process_data.py
Step 3: Verify Execution
- Check Exit Code: Ensure the shell command returned exit code
0. - Check Output: Verify expected files were created or expected stdout messages appeared.
- Handle Errors: If the shell execution fails, inspect the stderr output. This often provides more detailed tracebacks than the sandbox tool.
Best Practices
- Absolute Paths: When writing scripts that access files, use absolute paths or resolve paths relative to
__file__to avoid working directory issues. - Permissions: Ensure the workspace directory allows file creation and execution.
- Cleanup: Optionally remove temporary scripts after successful execution if cleanliness is required.
- Logging: Add explicit
print()statements in the Python script to log progress, as shell output capture is sometimes more reliable than sandbox return values.
Example Scenario
Problem: execute_code_sandbox times out while generating a PDF.
Solution:
- Write
generate_pdf.pytoworkspace/scripts/. - Run
python3 workspace/scripts/generate_pdf.pyviarun_shell. - Confirm
output.pdfexists in the workspace.
자주 묻는 질문
스크립트를 파일로 보관하는 이유는 무엇인가요?
저장된 파일은 검사하고 바꿔서 다시 실행할 수 있으므로 코드를 매번 다시 쓸 필요가 없습니다.
스크립트는 어디에 저장되나요?
작업 공간에 설명이 담긴 이름으로, .py로 끝나게 저장됩니다.
패키지가 필요하면 어떻게 하나요?
가이드는 requirements 파일이나 셸을 통해 미리 설치하라고 안내합니다.
상세 정보
작성자의 원본 설명
Fallback workflow for running code via file write and shell when sandbox execution fails
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12879
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.